MVP Base Documentation

A production-ready Next.js + NestJS monorepo with Docker, Clerk, and TypeORM.

πŸš€ Getting Started

Clone the repository and install dependencies:

git clone https://github.com/juntals01/mvpbase
cd mvpbase
npm install
npm run docker:up
npm run dev

This runs both the frontend (Next.js) and backend (NestJS) in parallel.

πŸ“ Project Structure

mvpbase/
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ web/    # Next.js frontend
β”‚   └── api/    # NestJS backend
β”œβ”€β”€ docker-compose.yml
β”œβ”€β”€ .env
└── package.json

βš™οΈ Environment Variables

Configure your local `.env` in the project root:

# App
API_PORT=4000
WEB_PORT=3000
NEXT_PUBLIC_API_URL=http://localhost:4000

# Clerk
CLERK_PUBLISHABLE_KEY=pk_test_xxx
CLERK_SECRET_KEY=sk_test_xxx

# Database
POSTGRES_USER=mvpbase_user
POSTGRES_PASSWORD=mvpbase_pass
POSTGRES_DB=mvpbase_db
POSTGRES_PORT=5433

# Redis
REDIS_PORT=6379

🧱 Common Commands

# Run both web + api
npm run dev

# Run only API
npm run dev -w apps/api

# Run only Web
npm run dev -w apps/web

# Start Docker services (Postgres, Redis, MinIO)
npm run docker:up

# Stop Docker
npm run docker:down

πŸ” Authentication (Clerk)

MVP Base uses Clerk for authentication on both the frontend and backend.

# Web
npm install -w apps/web @clerk/nextjs

# API
npm install -w apps/api @clerk/clerk-sdk-node @clerk/express

Clerk handles login, sign-up, and JWT verification for the API.

πŸ—„οΈ Database & Migrations

# Generate a migration
npm run -w apps/api migration:generate src/database/migrations/AddUserTable

# Run migrations
npm run -w apps/api migration:run

# Reset DB
npm run -w apps/api db:reset

πŸ’‘ Development Tips

  • Restart Docker with npm run docker:restart if DB changes.
  • Environment variables in root `.env` apply to both apps.
  • Frontend runs on http://localhost:3000.
  • API runs on http://localhost:4000.
Β© 2025 MVP Base β€” Built with Next.js, NestJS, and Clerk.