Skip to content

Getting Started ​

Prerequisites ​

RequirementVersionNotes
Node.js20+Required by all three apps
pnpm10.xThe API pins pnpm@10.19.0
PostgreSQL15+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 site
bash
cd api.myeasyguide.com && pnpm install
cd ../cms.myeasyguide.com && pnpm install
cd ../myeasyguide.com && pnpm install

Databases ​

The API and CMS own separate databases. They may live on the same PostgreSQL instance, but they share no foreign keys.

sql
CREATE DATABASE walkthroughnepal;    -- api.myeasyguide.com
CREATE DATABASE cms_myeasyguide;     -- cms.myeasyguide.com

Run each app's migrations from its own directory:

bash
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 dev

WARNING

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 ​

bash
# 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 seed

Environment variables ​

API (api.myeasyguide.com/.env) ​

Start from .env.example. The values below are the required groups; optional integrations can stay blank in development.

bash
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=50

See Environment Variables for the complete list, including Cloudflare, Recombee, Claude and the inquiry relay.

CMS (cms.myeasyguide.com/.env.local) ​

bash
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-me

FRONTEND_URL and REVALIDATION_SECRET are only used to call the frontend's revalidation webhook when a post is published.

Frontend (myeasyguide.com/.env.local) ​

bash
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=1x00000000000000000000AA

NEXT_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:

bash
# 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
AppURLNotes
APIhttp://localhost:3000Swagger UI at /docs, OpenAPI JSON at /docs.json
CMShttp://localhost:3002Admin at /admin, login at /login
Frontendhttp://localhost:3001Proxies /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 ​

CommandAPICMSFrontend
pnpm devts-node-devNext devNext dev (Turbopack)
pnpm buildprisma generate + tscNext buildNext build
pnpm startRun dist/server.jsNext startNext start
pnpm lintESLintESLintESLint
pnpm seedDemo dataInitial author—
pnpm prisma studioDB browserDB browser—
pnpm test:bookingBooking unit checks——

Built with VitePress