For the complete documentation index, see llms.txt
Edda Midnight starter template
Edda Midnight Starter Template is a full-stack monorepo for building DApps on the Midnight Network. It ships a working counter application with a Compact smart contract, a React (Vite) frontend, and a CLI - ready to clone, build, and deploy to Vercel. A live demo runs at counter.nebula.builders.
The project includes educational materials with video walkthroughs in English, Spanish, and Portuguese, making it a practical entry point for developers new to Midnight.
The Edda Labs maintainers built this as a fork of MeshJS/midnight-starter-template, adding the Apache-2.0 license, deployment automation, and the educational-material directory.
Edda Labs maintains this template, not the Midnight Foundation. It has not been audited. The smart contract is a minimal counter example intended for learning - evaluate any production use independently.
Prerequisites
Before using the template, ensure that you have:
- Node.js v22+ installed.
- pnpm v10+ installed.
- Docker running (for the proof server and standalone network).
- Git Large File Storage (LFS) installed - required for zero-knowledge proof artifacts (
.prover,.verifier,.bzkir,.zkirfiles). - The Compact developer tools installed and updated to
0.30.0. - The Lace wallet browser extension configured for the Preview network.
Compatibility
This template targets specific Compact compiler, runtime, and tooling versions. Verify these against your local environment before building.
| Component | Version | Notes |
|---|---|---|
| Compact compiler | 0.30.0 | Set via compact update +0.30.0 |
| Compact language | >= 0.22 | Per pragma in the contract source |
| Node.js | 22+ | Pinned in .node-version and engines.node |
| pnpm | 10.14.0 | Pinned via packageManager in package.json |
| Build orchestrator | Turborepo | Top-level scripts dispatch through turbo run |
| Networks | undeployed, Preview, Preprod, Mainnet | Standalone undeployed network runs via Docker |
| License | Apache-2.0 | (Upstream Mesh template carries no license; Edda's fork added Apache-2.0.) |
Monorepo structure
The template organizes code into three workspace packages:
| Package | Purpose |
|---|---|
counter-contract | Compact smart contract with a single increment circuit that advances a public round counter. Compiles to TypeScript bindings and ZK proof artifacts. |
counter-cli | CLI tool for deploying and interacting with the contract from the terminal. Supports all three networks. |
frontend-vite-react | React 19 + Vite frontend with Lace wallet integration, TailwindCSS styling, and TanStack Router. Connects to the deployed contract and displays counter state. |
Installation
Clone the repository:
git clone https://github.com/eddalabs/midnight-starter-template.git
cd midnight-starter-template
Download the zero-knowledge proof artifacts via Git Large File Storage (LFS):
git lfs install
git lfs pull
Update the Compact Toolchain to the version the template targets:
compact update +0.30.0
Install dependencies and build all workspace packages:
pnpm install
pnpm build
Both counter-cli/ and frontend-vite-react/ ship a .env_template file. Copy each to .env and fill in the values before running locally.
The repository stores zero-knowledge proof artifacts (prover keys, verifier keys, ZKIR files) via Git LFS. Without git lfs install and git lfs pull, these files appear as text pointers instead of binary data, and contract deployment fails with "mismatched verifier keys" errors.
Run locally
Start the frontend against the Preview network:
pnpm dev:frontend
For a fully local setup with no external network dependency, start the standalone network first:
pnpm setup-standalone
pnpm dev:frontend
The standalone network runs Midnight node, indexer, and proof server containers in Docker.
Testing
The CLI ships Vitest-based test suites that run the contract end-to-end on each network:
pnpm --filter @eddalabs/counter-cli test-undeployed
pnpm --filter @eddalabs/counter-cli test-preview
pnpm --filter @eddalabs/counter-cli test-preprod
These scripts spin up the relevant infrastructure (containers for undeployed, faucet calls for preview / preprod), deploy the contract, and assert on circuit behavior. They serve as a useful reference for setting up your own contract test harness.
The smart contract
The contract is a minimal counter with a single exported circuit:
pragma language_version >= 0.22;
import CompactStandardLibrary;
export ledger round: Counter;
export circuit increment(): [] {
round.increment(1);
}
The contract is deliberately minimal - the template's value is the full-stack scaffolding around it (wallet connection, provider wiring, deployment pipeline), not the contract logic. Replace it with your own contract and the surrounding infrastructure adapts.
Deploy to Vercel
The Edda Labs team documents the full deployment procedure in their DEPLOYMENT_PROCEDURE.md. The key steps:
- Enable Git LFS in your Vercel project settings before the first build.
- Set the build command to
npm run build-production(the script is workspace-aware and pulls LFS artifacts before building). - Set the output directory to
frontend-vite-react/dist. - Add
VITE_CONTRACT_ADDRESSas an environment variable with your deployed contract address.
If you deploy without enabling Git LFS in Vercel's settings, then the build completes but the DApp fails at runtime. The proof artifacts are LFS pointers instead of binary files. Enable LFS first, then redeploy without cache.
Educational materials
The repository includes an educational-material/ directory with structured session guides covering:
- zero-knowledge proofs and privacy-enhanced DApps
- devnet, Preview, and Testnet environments
- Video walkthroughs on the Edda Labs YouTube channel
- Available in English, Spanish, and Portuguese
Resources
- Project repository: Source, README, and contributor guide.
- Live demo: The deployed counter DApp running on the Preview environment.
- Deployment procedure: Step-by-step Vercel deployment, including the Git LFS toggle.
- Educational material: Session guides for devnet, Preview, and Testnet workflows.
- Edda Labs: The maintainer organization. Sibling repo:
eddalabs/midnight-contracts. - Upstream template (MeshJS): The original starter that Edda's fork builds on.
Report issues
For issues with the template, file on Edda Labs' tracker.
For issues with this documentation page, file on the Midnight docs repository.