Skip to content

midnightntwrk/create-mn-app

create-mn-app

Scaffold Midnight Network applications on Preprod.

npm version npm downloads License: Apache-2.0 Node.js

Quick Start

npx create-mn-app@latest my-app
cd my-app
npm run setup

The setup command:

  1. Starts proof server via Docker
  2. Compiles the Compact contract
  3. Deploys to Preprod (prompts for faucet funding)

Fund your wallet at faucet.preprod.midnight.network

Why create-mn-app?

  • Zero Configuration - Start building immediately
  • Preprod Ready - Deploys to Midnight Preprod network
  • SDK 3.0 - Uses latest Midnight wallet and contract SDKs
  • One Command Setup - Single npm run setup handles everything
  • Auto-updates - Built-in notifier for new versions

Templates

Templates are organized by category. The interactive flow guides you through category → template selection.

npx create-mn-app@latest my-app         # interactive: pick category then template
npx create-mn-app@latest my-app --list  # list all templates grouped by category

Contract

Template Description
hello-world (default) Basic message storage contract demonstrating state management
npx create-mn-app@latest my-app
cd my-app
npm run setup     # starts proof server, compiles, deploys
npm run cli       # interact with deployed contract

Full DApp

Template Description
counter Increment/decrement app with zkProofs (source)
bboard Multi-user bulletin board with privacy patterns (source)
dex Decentralized exchange using FungibleToken (coming soon)
midnight-kitties NFT-based full stack DApp (coming soon)
npx create-mn-app@latest my-app --template counter
npx create-mn-app@latest my-app --template bboard

Requires Compact compiler — the CLI will check and offer to install it.

Connector

Integration examples and patterns (coming soon).

Requirements

Requirement Version Notes
Node.js 22+ Required for all templates
Docker Latest Runs proof server
Compact Compiler 0.28.0+ Counter and Bboard templates (auto-install offered)

CLI Options

npx create-mn-app@latest [project-name] [options]
Option Description
-t, --template <name> Template: hello-world, counter, bboard
--list List all available templates grouped by category
-y, --yes Accept all defaults (non-interactive mode)
--dry-run Preview what will be created without writing files
--from <owner/repo> Create from a custom GitHub repository
--use-npm/yarn/pnpm/bun Force package manager
--skip-install Skip dependency installation
--skip-git Skip git initialization
--verbose Show detailed output
-h, --help Show help
-V, --version Show version

Non-Interactive / CI Mode

Use -y or set CI=true / GITHUB_ACTIONS=true to skip all prompts:

npx create-mn-app@latest my-app -y -t counter    # defaults, no prompts
CI=true npx create-mn-app@latest my-app           # auto-detected in CI

npx create-mn-app@latest my-app --dry-run         # preview without writing files
npx create-mn-app@latest my-app --from user/repo  # clone any GitHub repo

Project Structure

my-app/
├── contracts/
│   └── hello-world.compact    # Compact smart contract
├── src/
│   ├── cli.ts                 # Interact with deployed contract
│   ├── deploy.ts              # Deploy contract to Preprod
│   └── check-balance.ts       # Check wallet balance
├── docker-compose.yml         # Proof server config
├── package.json
└── deployment.json            # Generated after deploy (contains wallet seed)

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Links

License

Apache-2.0 © 2025 Midnight Foundation

Packages

 
 
 

Contributors