Getting Started
Prerequisites
| Requirement | Version | Notes |
|---|---|---|
| Node.js | 20+ | Required by all three apps |
| pnpm | 10.x | The API pins pnpm@10.19.0 |
| PostgreSQL | 15+ | Two databases on one server is fine |
| Stripe account | — | Test mode is enough for local development |
| Cloudflare account | — | Only needed for image uploads |
| Resend account | — | Only needed for email or the inquiry relay |
Repository layout
The three apps are sibling directories. There is no root package.json — each app installs and deploys independently.
easyguide/
├── api.myeasyguide.com/ # Express REST API
├── cms.myeasyguide.com/ # Next.js CMS
├── myeasyguide.com/ # Next.js public frontend
└── docs.myeasyguide.com/ # This sitecd api.myeasyguide.com && pnpm install
cd ../cms.myeasyguide.com && pnpm install
cd ../myeasyguide.com && pnpm installDatabases
The API and CMS own separate databases. They may live on the same PostgreSQL instance, but they share no foreign keys.
CREATE DATABASE walkthroughnepal; -- api.myeasyguide.com
CREATE DATABASE cms_myeasyguide; -- cms.myeasyguide.comRun each app's migrations from its own directory:
cd api.myeasyguide.com
cp .env.example .env
# Set DATABASE_URL, JWT secrets and the keys you need
pnpm prisma migrate dev
cd ../cms.myeasyguide.com
# Create .env.local (see Environment Variables)
pnpm prisma migrate devWARNING
Never run prisma migrate against the API database from another project. The API schema no longer contains the legacy editorial tables, and a migration generated from a different schema can drop them.
Seed data
# API: creates an admin, then optional catalog + demo commerce data
cd api.myeasyguide.com
pnpm seed:admin
pnpm seed:catalog
pnpm seed
# CMS: creates the initial author/admin account
cd ../cms.myeasyguide.com
pnpm seedEnvironment variables
API (api.myeasyguide.com/.env)
Start from .env.example. The values below are the required groups; optional integrations can stay blank in development.
DATABASE_URL=postgresql://user:password@localhost:5432/walkthroughnepal
JWT_SECRET=change-me
JWT_SECRET_ADMIN=change-me-too
# Links used in verification and reset emails
BASE_URL=http://localhost:3000
FRONTEND_BASE_URL=http://localhost:3001
# Stripe
STRIPE_SECRET_KEY=sk_test_xxx
STRIPE_PUB_KEY=pk_test_xxx
STRIPE_WHSEC_KEY=whsec_xxx
# Email
RESEND_API_KEY=re_xxx
RESEND_FROM=MyEasyGuide <no-reply@myeasyguide.com>
# Public-write endpoints (Turnstile)
TURNSTILE_SECRET=1x0000000000000000000000000000000AA
TURNSTILE_HOSTNAMES=localhost,myeasyguide.com,www.myeasyguide.com
# Money
PLATFORM_COMMISSION_RATE=0.3
MIN_PAYOUT_AMOUNT=50See Environment Variables for the complete list, including Cloudflare, Recombee, Claude and the inquiry relay.
CMS (cms.myeasyguide.com/.env.local)
DATABASE_URL=postgresql://user:password@localhost:5432/cms_myeasyguide
JWT_SECRET=change-me-to-a-long-random-string
CLAUDE_API_KEY=sk-ant-xxx # or ANTHROPIC_API_KEY
CLAUDE_MODEL=claude-sonnet-4-20250514
FRONTEND_URL=http://localhost:3001
REVALIDATION_SECRET=change-meFRONTEND_URL and REVALIDATION_SECRET are only used to call the frontend's revalidation webhook when a post is published.
Frontend (myeasyguide.com/.env.local)
NEXT_PUBLIC_API_BASE_URL=http://localhost:3000
NEXT_PUBLIC_POST_URL=http://localhost:3002
NEXT_PUBLIC_SITE_URL=http://localhost:3001
NEXT_PUBLIC_TURNSTILE_SITEKEY=1x00000000000000000000AANEXT_PUBLIC_* values are embedded in the browser bundle. Never put secrets there.
Running locally
Next.js uses port 3000 by default, so give each app an explicit port:
# Terminal 1 — API on 3000
cd api.myeasyguide.com && pnpm dev
# Terminal 2 — CMS on 3002
cd cms.myeasyguide.com && pnpm dev -- -p 3002
# Terminal 3 — frontend on 3001
cd myeasyguide.com && pnpm dev -- -p 3001| App | URL | Notes |
|---|---|---|
| API | http://localhost:3000 | Swagger UI at /docs, OpenAPI JSON at /docs.json |
| CMS | http://localhost:3002 | Admin at /admin, login at /login |
| Frontend | http://localhost:3001 | Proxies /api/v1/* to the API |
Port conflicts
If you see EADDRINUSE, something is already on 3000. Change the API with PORT=3100 pnpm dev, then point NEXT_PUBLIC_API_BASE_URL at the new port.
Useful scripts
| Command | API | CMS | Frontend |
|---|---|---|---|
pnpm dev | ts-node-dev | Next dev | Next dev (Turbopack) |
pnpm build | prisma generate + tsc | Next build | Next build |
pnpm start | Run dist/server.js | Next start | Next start |
pnpm lint | ESLint | ESLint | ESLint |
pnpm seed | Demo data | Initial author | — |
pnpm prisma studio | DB browser | DB browser | — |
pnpm test:booking | Booking unit checks | — | — |