Initial setup
This guide walks you through setting up your local development environment. You'll need three things running:
- Docker - for MongoDB, server, and app
- Anvil - local blockchain
- Server - the Node.js API (covered in the next section)
Quick start: Run pnpm install && pnpm setup && pnpm docker:up && pnpm dev to get everything running.
Configure environment variables
1. Copy the example env file
cp .env.example .env2. Update the values
The defaults work for local development. You'll get your PRIVATE_KEY from Anvil in the next section.
# MongoDB connection
DATABASE_URL="mongodb://tap:tap@localhost:27017/mongo?authSource=admin&retryWrites=true&w=majority"
DATABASE_REPLSET="0" # set to "1" if using replica set
# Blockchain connection (Anvil local)
RPC_URL=http://localhost:8545
CHAIN_ID=31337
# Deployer private key (get from Anvil output)
PRIVATE_KEY=UPDATE_ME
# Server port
PORT=8293Start services with Docker
1. Start all containers
pnpm docker:upThis starts MongoDB, the server, and the frontend app.
2. Verify services are running
docker psYou should see three containers running: mongodb, server, and app.
Other Docker commands: pnpm docker:down (stop), pnpm docker:logs (view logs), pnpm docker:build (rebuild).
Start Anvil (local blockchain)
Anvil is a local Ethereum node from Foundry. You'll run it in a separate terminal window.
1. Install dependencies and build contracts
pnpm install && pnpm run setup2. Start Anvil
anvil3. Copy a private key
Anvil outputs test accounts with private keys. Copy one and add it to your .env file:
PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80These are test keys only. Never use them on mainnet.
With Docker and Anvil running, you're ready to deploy the factory contract.