NestJS + Prisma/PostgreSQL backend for EIPFun. It serves Ethereum Improvement Proposal (EIP/ ERC) content, manages NFT whitelist data, produces Merkle proofs for minting, and handles email subscriptions.
- Node.js / TypeScript / NestJS
- PostgreSQL with Prisma ORM (plus a light TypeORM read path)
- Mailchimp for email subscriptions
merkletreejs+keccak256for whitelist proofs
- Install dependencies
npm install- Start the database (PostgreSQL 15)
cd service
docker-compose up -d- Configure environment (see below), then migrate & generate the Prisma client
cp .env.example .env # if you keep one; otherwise create .env manually
npm run migrate:dev
npm run generate- Run the API
npm run start:dev # or: npm run start- Migrate dev schema:
npm run migrate:dev - Generate Prisma client:
npm run generate - Start DB locally:
cd service && docker-compose up -d
- Import whitelist JSON into the database:
npm run whitelist:import -- <path-to-json> - Set environment variables for whitelist sources
- Rebuild Merkle root for a token (deterministic ordering):
npm run whitelist:rebuild -- <tokenId>The resulting root is stored inMerkleRootand cached in-memory.
- Download latest EIPs:
GET /download/eips - Download latest ERCs:
GET /download/ercs - Refresh stored data:
GET /eips/update
GET /eips/list— list EIPs with pagination and optional filters (type,category,status,page,per_page)GET /eips/search?content=...— search EIPs by content/title/authorGET /nft/isWhiteAddress?address=0x...&tokenId=1— check whitelist membershipGET /nft/getAddressProof?address=0x...&tokenId=1— Merkle proof + root for a walletGET /nft/merkleRoot?tokenId=1— current Merkle root for a tokenPOST /email/subscribe— subscribe an email ({ address: "name@example.com" })
All routes are exposed from src/app.controller.ts and implemented in src/app.service.ts.
- Lint:
npm run lint - Test:
npm run test(unit),npm run test:e2e - Build:
npm run build(runs Prisma generate, then Nest build)
- Whitelist proof generation uses sorted pair hashing (
sortPairs: true) and deterministic address ordering to keep Merkle roots stable across runs. WHITELIST_SOURCEScan restrict both API lookups and rebuild scripts to a subset of sources.