Skip to content

senorMk/fullstack-monorepo-template

Repository files navigation

Fullstack Monorepo Template

A production-ready monorepo template with:

  • apps/api — NestJS + Prisma + PostgreSQL (auth, JWT, email confirmation, password reset)
  • apps/web — React 19 + Vite SSR + Tailwind 4 (landing page, Terms, Privacy)
  • apps/mobile — Flutter (BLoC architecture, light/dark themes, auth-ready)
  • deploy/ — Nginx reverse proxy + VPS Docker Compose
  • .github/workflows/ — GitHub Actions: build & push to GHCR, deploy via Coolify

Getting started

# 1. Clone or use this as a GitHub template
git clone https://github.com/senorMk/fullstack-monorepo-template my-project
cd my-project

# 2. Run the init script — it replaces all placeholders with your project details
bash scripts/init.sh

# 3. Install JS dependencies
npm install

# 4. Start Postgres
docker compose up -d

# 5. Set up the database
cp apps/api/.env.example apps/api/.env   # edit secrets
npm run prisma:migrate:dev --workspace=apps/api

# 6. Start the API and web app
npm run api   # http://localhost:3000
npm run web   # http://localhost:4000

# 7. Start the Flutter app
cd apps/mobile
flutter pub get
flutter run

Placeholders

The init script replaces these tokens across all files:

Token Example Used in
APP_NAME my-app package.json, Docker image tags, Nginx routes
APP_DISPLAY_NAME My App Swagger, web title, Flutter app title
APP_SNAKE my_app Flutter package name, Postgres user/db
APP_DOMAIN myapp.com Nginx, email links, CORS
GITHUB_USERNAME johndoe GHCR image paths, CI/CD

Project structure

.
├── apps/
│   ├── api/          # NestJS API
│   │   ├── prisma/   # Prisma schema (User + auth tokens)
│   │   └── src/
│   │       ├── common/          # Guards, filters, decorators, exceptions
│   │       ├── modules/auth/    # Signup, signin, refresh, email confirm, password reset
│   │       ├── modules/profile/ # GET/PATCH /v1/profile/me
│   │       ├── email/           # Email service stub (swap in Resend/SES/Postmark)
│   │       └── prisma/          # PrismaService
│   ├── web/          # React + Vite SSR
│   │   └── src/
│   │       ├── components/Layout.tsx
│   │       └── pages/           # Home, Terms, Privacy
│   └── mobile/       # Flutter
│       └── lib/
│           ├── config/          # Style / theme definitions
│           ├── cubit/           # AuthCubit, ThemeCubit
│           ├── data/auth/       # AuthRepository stub
│           ├── domain/          # AppUser, AppSession, AuthRepository interface
│           └── ui/screens/      # HomeScreen
├── deploy/
│   ├── nginx/app.conf           # Nginx HTTPS reverse proxy
│   └── docker-compose.vps.yml  # VPS production stack
├── .github/workflows/deploy.yml # Build → GHCR → Coolify deploy
├── docker-compose.yml           # Local Postgres only
├── docker-compose.coolify.yml   # Coolify managed stack
└── scripts/init.sh              # Placeholder replacement script

API endpoints (out of the box)

GET  /health
POST /v1/auth/signup
POST /v1/auth/signin
POST /v1/auth/signout
POST /v1/auth/refresh
POST /v1/auth/forgot-password
POST /v1/auth/reset-password
POST /v1/auth/confirm-email
GET  /v1/profile/me
PATCH /v1/profile/me

Swagger UI available at http://localhost:3000/docs in development.

Adding modules to the API

cd apps/api
npx nest generate module modules/my-feature
npx nest generate controller modules/my-feature
npx nest generate service modules/my-feature

Then import MyFeatureModule in app.module.ts.

Deploying

  1. Add secrets to your GitHub repo: COOLIFY_WEBHOOK_URL
  2. Push to main — GitHub Actions builds and pushes Docker images to GHCR
  3. Coolify picks up the webhook and redeploys

For VPS (without Coolify), use deploy/docker-compose.vps.yml directly.

About

Production-ready monorepo template: NestJS API + React/Vite SSR web + Flutter mobile, with Docker, GitHub Actions CI/CD, and a one-command init script.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors