Initial setup

This guide walks you through setting up your local development environment. You’ll need three things running:

  1. Docker - for MongoDB, server, and app
  2. Anvil - local blockchain
  3. 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 .env

2. Update the values

The defaults work for local development. You’ll get your PRIVATE_KEY from Anvil in the next section.

.env
# 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=8293

Start services with Docker

1. Start all containers

pnpm docker:up

This starts MongoDB, the server, and the frontend app.

2. Verify services are running

docker ps

You 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 setup

2. Start Anvil

anvil

3. Copy a private key

Anvil outputs test accounts with private keys. Copy one and add it to your .env file:

PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
⚠️

These are test keys only. Never use them on mainnet.

Targeting Plume Mainnet

To point the stack at Plume Mainnet instead of Anvil, override these values in .env:

.env
RPC_URL=https://rpc.plume.org
CHAIN_ID=98866
PRIVATE_KEY=<PLUME_FUNDED_SERVER_PRIVATE_KEY>
NEXT_PUBLIC_FACTORY_ADDRESS=0xcd6Df14406b0569ceEABa884A18717774EdeaCA1
NEXT_PUBLIC_CHAIN_ID=98866
NEXT_PUBLIC_OPERATOR_ADDRESS=<SERVER_WALLET_ADDRESS>
⚠️

Use a Plume-funded server wallet. The API signs onchain transactions with PRIVATE_KEY.

With Docker and Anvil running, you’re ready to deploy the factory contract.