Prerequisites
Before building Prisma Engines, ensure you have the following installed:Install Rust Toolchain
Install the latest stable version of Rust. You can get the toolchain at rustup or use your package manager.
Environment Setup
The repository uses.envrc to configure essential environment variables:
.envrc.local file (gitignored) for local overrides.
Optional: Nix Users
The repository includes ashell.nix file for Nix users. If you have Nix installed and direnv configured, all dependencies will be automatically set up.
To disable Nix in environments where it’s pre-installed (e.g., Gitpod):
Building the Engines
Build All Engines (Debug Mode)
To build all engines in debug mode:target/debug/:
| Component | Binary Path |
|---|---|
| Schema Engine | ./target/debug/schema-engine |
| Prisma Format | ./target/debug/prisma-fmt |
Build All Engines (Release Mode)
For optimized production binaries:target/release/.
Build Specific Components
Build Query Compiler Wasm
The query compiler is a library crate that compiles to Wasm for the JavaScript runtime:query-compiler/query-compiler-wasm/pkg/
Build Driver Adapters
Driver adapters enable the query compiler to work with JavaScript database drivers:Ensure prisma/prisma Repository
The driver adapters build process requires the main Prisma repository as a sibling:
Build Targets Reference
Makefile Targets
| Target | Description |
|---|---|
make build | Build all engines (debug) |
make release | Build all engines (release) |
make build-qc-wasm | Build query compiler Wasm (fast + small) |
make build-qc-wasm-fast | Build query compiler Wasm (fast variant) |
make build-qc-wasm-small | Build query compiler Wasm (size-optimized) |
make build-se-wasm | Build schema engine Wasm |
make build-schema-wasm | Build Prisma schema Wasm package |
make build-driver-adapters-kit | Build driver adapters (full) |
make build-driver-adapters-kit-qc | Build driver adapters for query compiler |
make pedantic | Run formatting and clippy checks (CI mode) |
make clean | Clean all build artifacts |
Clean Build Artifacts
Code Quality
Format Code
Run Linter (Clippy)
Pedantic CI Check
Emulate the CI compilation checks locally:cargo fmt -- --check(formatting validation)cargo clippy --all-features --all-targets -Dwarnings(lint checks)- Additional Wasm target checks
Optimizing Build Performance
Parallel rust-analyzer Builds
When rust-analyzer runscargo check, it locks the build directory. To avoid this:
- Open VSCode settings
- Search for “Check on Save: Extra Args”
- Add a custom target directory:
Using LLD Linker (Linux)
The.envrc automatically configures the faster LLD linker on Linux if available:
Troubleshooting
OpenSSL Not Found (Linux)
If you encounter OpenSSL linking errors:direnv Not Loading
Ensure direnv is properly hooked in your shell config:Wasm Build Fails
Ensure the Wasm target is installed:Next Steps
Once you’ve successfully built the engines:- Learn about testing
- Explore debugging techniques
- Review contribution guidelines