-
Copy the environment file:
cp .env.local.example .env.local
-
Required environment variables:
Variable Required Description DATABASE_URLYes PostgreSQL connection string NEXTAUTH_SECRETYes (prod) Secure random string for JWT signing NEXTAUTH_URLYes Your domain (http://localhost:3001 for dev) -
Blockchain / On-chain (Polygon Amoy testnet):
Variable Required Description AMOY_RPC_URLFor on-chain JSON-RPC URL (e.g. https://rpc-amoy.polygon.technology)DEPLOYER_PRIVATE_KEYFor on-chain Hex private key of the server relayer wallet (with 0xprefix)NFT_CONTRACT_ADDRESSOptional Override deployed NFT contract address ENS_REGISTRAR_ADDRESSOptional Override deployed ENS registrar address ⚠️ Security: Never commit private keys to version control. Use a.env.localfile (gitignored) or a secrets manager (Vercel Environment Variables, AWS Secrets Manager, HashiCorp Vault). -
IPFS / Pinata:
Variable Required Description PINATA_JWTFor IPFS Pinata SDK JWT token PINATA_GATEWAY_URLOptional Custom Pinata gateway URL In development without
PINATA_JWT, the app falls back to local files underpublic/local-metadata/. -
AI Agent:
Variable Required Description OPENAI_API_KEYOptional OpenAI API key for AI-powered learning assistant OPENAI_BASE_URLOptional Custom OpenAI-compatible API base URL OPENAI_MODELOptional Model name (default: gpt-3.5-turbo)Without
OPENAI_API_KEY, the agent returns helpful mock responses. -
OAuth Providers (optional):
GOOGLE_CLIENT_ID/GOOGLE_CLIENT_SECRETfor Google sign-inGITHUB_CLIENT_ID/GITHUB_CLIENT_SECRETfor GitHub sign-in- Email server settings (
EMAIL_HOST,EMAIL_PORT, etc.) for magic link auth
- Never commit secrets to git. All sensitive values belong in
.env.local(gitignored). - Vercel deployments: Add env vars in the Vercel Dashboard → Project Settings → Environment Variables.
- Local development: Use
.env.localfor secrets. The demo credentials provider is automatically disabled in production. - Key rotation: Rotate
DEPLOYER_PRIVATE_KEYandNEXTAUTH_SECRETperiodically. Update Vercel env vars and redeploy. - Deployer wallet security: The
DEPLOYER_PRIVATE_KEYcontrols a server-side relayer wallet used to mint NFTs and register ENS names on behalf of users. Keep its balance low (only enough MATIC for gas). Consider using a hardware wallet or KMS for mainnet deployments.
- Install PostgreSQL (if not already installed)
- Create a database named
eipsinsight - Update DATABASE_URL in
.env.local - Run migrations:
npx prisma migrate dev
To deploy the NFT and ENS contracts to Polygon Amoy testnet:
# Set env vars
export AMOY_RPC_URL="https://rpc-amoy.polygon.technology"
export DEPLOYER_PRIVATE_KEY="0x..."
# Deploy contracts
pnpm deploy:amoy
# Pin genesis NFT assets to IPFS
export PINATA_JWT="..."
pnpm pin:genesis
# Run smoke test
node scripts/smoke-amoy.mjsAfter deployment, update NFT_CONTRACT_ADDRESS and ENS_REGISTRAR_ADDRESS in your .env.local.
See docs/STAGING_CHECKLIST.md for a full staging deploy checklist: required env vars, CI flags, pre-deploy and post-deploy verification steps.
See docs/RELEASE_CHECKLIST.md for the production launch & rollback checklist.
-
Install dependencies:
pnpm install
-
Start the development server:
pnpm dev
-
Access the application:
- Open http://localhost:3001
- Use SIWE (Sign In With Ethereum) to authenticate with your wallet
If pnpm install or the Vercel build fails with registry errors such as ERR_INVALID_THIS or Value of "this" must be of type URLSearchParams, this is usually an environment mismatch (Node / pnpm) or transient registry problem. Recommended fixes:
- Ensure Vercel is using Node 18+ (set Node Version to 18.x or 20.x in Project Settings).
- Ensure the project uses
pnpmas the package manager (Vercel detectspackageManagerin package.json). - Clear Vercel build cache and redeploy (Dashboard → Redeploy → Clear cache).
- If you see a DevTools console warning about
unsafe-evalorlockdown-install.js, it is most often caused by a browser extension injecting SES/lockdown scripts (not the app itself). - Open an Incognito window with extensions disabled — if the warning disappears, it was an extension.
- Do NOT enable
unsafe-evalin production.
The app uses SIWE (Sign In With Ethereum) for wallet-based authentication. You can also optionally configure:
- OAuth providers (Google, GitHub) via environment variables
- Email authentication if needed
- Use a strong, unique
NEXTAUTH_SECRETin production
- NextAuth CLIENT_FETCH_ERROR: Ensure
NEXTAUTH_SECRETis set in.env.local - Database connection errors: Check your
DATABASE_URLformat - OAuth errors: Verify OAuth provider credentials and callback URLs
- On-chain operations fail: Check
AMOY_RPC_URLandDEPLOYER_PRIVATE_KEYare set, and the relayer wallet has enough MATIC for gas - IPFS uploads fail: Ensure
PINATA_JWTis set for production