A modern full-stack monorepo project using Next.js for the frontend and Nest.js for the backend, with Docker and Traefik for containerization and reverse proxy.
🚨 IMPORTANT: There is a with-db branch that includes DrizzleORM with PostgreSQL, providing end-to-end type safety from back to front! 🚨
- Frontend: Next.js application with TypeScript
- Backend: Nest.js API with TypeScript
- Monorepo: PNPM workspace for efficient package management
- Docker: Containerized development and production environments
- Traefik: Reverse proxy with automatic SSL certificate management
- Local Development: Automatic local domain setup with SSL certificates
- Database: PostgreSQL database with DrizzleORM for schema management and migrations
- Node.js (v18 or later)
- PNPM (v8 or later)
- Docker and Docker Compose
- mkcert for local SSL certificates
# Install Chocolatey first, then:
choco install nodejs pnpm docker-desktop mkcertbrew install node pnpm docker mkcert# Node.js and PNPM
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
npm install -g pnpm
# Docker
sudo apt-get install docker.io docker-compose
# mkcert
sudo apt install mkcert- Clone the repository:
git clone https://github.com/Clstialdev/next-nest-starter.git
cd next-nest-starter- Run the setup command:
make setupThis will:
- Install all dependencies
- Configure local domains
- Generate SSL certificates
- Set up the development environment
# Start in verbose mode (see logs)
make upmake helpCommon commands:
make up- Start containers in detached modemake up -v- Start containers in verbose modemake down- Stop containersmake restart- Restart containersmake dev- Start development environmentmake build- Build all packages and applicationsmake clean- Clean up node_modules and build artifactsmake db:migrate- Apply database migrations using DrizzleORMmake db:seed- Seed the database with initial data
The project sets up the following local domains:
- Frontend:
https://frontend.localhost - Backend:
https://backend.localhost - Traefik Dashboard:
https://traefik.localhost
.
├── apps/
│ ├── frontend/ # Next.js application
│ └── backend/ # Nest.js application
├── packages/ # Shared packages
├── scripts/ # Utility scripts
├── docker-compose.yml
├── traefik.yml
└── Makefile
Create .env files in the respective directories:
apps/frontend/.env
apps/backend/.env- PostgreSQL: The project uses PostgreSQL as the database. Ensure you have PostgreSQL installed and running.
- DrizzleORM: DrizzleORM is used for schema management and migrations. The configuration is located in
packages/shared/drizzle/drizzle.config.ts.
# apps/backend/.env
DATABASE_URL=postgresql://user:password@localhost:5432/yourdbdocker-compose.yml: Main Docker configurationtraefik.yml: Traefik reverse proxy configuration
The project uses mkcert to generate local SSL certificates. These are automatically generated during setup and stored in the letsencrypt directory.
To clean up the project:
make cleanThis will remove:
- All node_modules directories
- Build artifacts
- Generated files
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.