Next.js 16 β’ Nest.js β’ Expo β’ tRPC β’ Prisma
Omni-tRPC-Stack is a high-performance, production-ready Monorepo architecture. It eliminates the friction between your Backend and multiple Frontends by providing a unified, 100% Type-Safe communication layer.
- π§© Single Source of Truth: Forget about duplicating validation logic. Use Shared Zod schemas to validate data across Web, Mobile, and Server simultaneously. Change once, update everywhere.
- π‘οΈ E2E Type-Safety (Zero-runtime errors): Experience the magic of tRPC. Catch API breaking changes at compile time before they ever reach production. If your backend changes, your frontend won't build until it's fixed.
- π± Native Mobile Integration: Not just a web-wrapper. A fully-fledged Expo (React Native) application is baked into the monorepo, sharing logic and state with your web apps out of the box.
- π’ DevOps-as-a-Service: Industrial-grade deployment. From Docker Orchestration to automated GitHub Actions CI/CD for your own VPS. It's not just a boilerplate; it's a complete production pipeline.
- π Advanced Security Included: Full 2FA (Two-Factor Authentication) with Backup Codes, Role-based Access Control (RBAC), and secure Session management are already pre-configured.
- Monorepo: PNPM Workspaces + Turborepo
- API Layer: tRPC (End-to-End Type-Safety)
- Database: PostgreSQL + Prisma ORM
- DevOps: Docker, Nginx Proxy Manager, GitHub Actions
- Web Framework: Next.js 16 (App Router)
- Mobile: Expo (React Native) + Expo Router
- UI Toolkit: HeroUI (ex. NextUI) + TailwindCSS
- State: Zustand + TanStack Query
- Core: Nest.js (Modular Architecture)
- Auth: NextAuth.js (Web) + JWT (Mobile)
- Validation: Shared Zod schemas across the entire Monorepo
.
βββ apps
β βββ admin # Admin Dashboard (Next.js)
β βββ website # Customer Web App (Next.js)
β βββ mobile # Cross-platform App (Expo / React Native)
β βββ server # Backend API (Nest.js)
βββ packages
β βββ api # Shared tRPC router & client logic & shared Zod validation schemas
β βββ store # Shared state management (Zustand)
β βββ prisma # Database schema & Prisma Client (Shared ORM)
β βββ ui # Shared theme provider
β βββ next-auth # Centralized Auth configurations & providers
β βββ shared # Common components, hooks, utilities and constants
β βββ tailwind-config # Base TailwindCSS configurations
β βββ eslint-config # Centralized linting rules
βββ docker-compose.local.yml # Local development orchestration
βββ docker-compose.prod-ci.yml # Production deploy orchestrationEnsure you have the following installed:
- Node.js (v20+)
- PNPM (v9+)
- Docker Desktop
-
Clone the repository
git clone https://github.com/dmytro-komlyk/fullstack-boilerplate-next-nest-vps.git cd fullstack-boilerplate-next-nest-vpsor use the repository button Use this template
-
Install dependencies
pnpm install
-
Setup environment variables
Copy example env files for all apps and fill in the required fields (e.g., Auth secrets, Database credentials):
pnpm run setup:local:env
-
Spin up development environment
pnpm dev
-
To build the project for production:
pnpm build:mobile
-
To start the production build:
pnpm start:mobile
π» Local Development Run the entire stack (Database + Redis + Services) locally without installing dependencies on your host machine.
-
Set up environment variables
Copy example env files for all apps and fill in the required fields (e.g., Auth secrets, Database credentials):
pnpm run setup:local:env
-
Build and run Docker containers
docker compose -f docker-compose.local.yml up -d --build
This project uses GitHub Actions for continuous integration and continuous deployment. The configuration files are located in the .github/workflows directory.
-
Set up your secrets and variables in a GitHub repository
Go to your repository Settings > Secrets and variables > Actions and fill in the following:
Sensitive values (masked in logs). Add these in the Secrets tab.
Secret Name Description Example SSH_PASSWORDPassword for your VPS user your_secure_passwordEXPO_TOKENAccess token for Expo EAS expo_token_abc123...DOCKER_HUB_USERNAMEYour Docker Hub username dmytro_komlykDOCKER_HUB_TOKENDocker Hub token or GitHub PAT ghp_your_personal_access_tokenConfiguration values. Add these in the Variables tab.
Variable Name Description Example SSH_HOSTIP address of your VPS 123.456.78.90SSH_USERNAMESSH login user rootorubuntuSSH_PORTSSH port (default is 22) 22SSH_FOLDERTarget directory on VPS /home/root/my-projectPROD_NAMEProject identifier for Docker my-boilerplateDOCKER_HUB_USERNAMEYour Docker Hub/GHCR username dmytro-komlykWEBSITE_DOMAINMain website domain example.comADMIN_DOMAINAdmin dashboard domain admin.example.comSERVER_DOMAINAPI server domain api.example.com -
π·οΈ Set up Pull Request Labels
This project uses a Smart Build System. To save CI/CD minutes and speed up deployment, images are only built when specific labels are added to a Pull Request.
- Go to your repository Pull Requests > Labels.
- Click New label and create these three (names must match exactly):
backendβ triggers Nest.js server build.websiteβ triggers Next.js client app build.adminβ triggers Next.js admin dashboard build.
When you create a Pull Request, simply attach the relevant labels. For example, if you only changed the API, add the
backendlabel. GitHub Actions will skip building the frontend apps, saving you time.π‘ Tip: You can attach multiple labels if your changes affect several applications.
-
Initial Server Preparation
Connect to your VPS via SSH and install the necessary engine:
sudo apt update sudo apt install -y docker.io docker-compose sudo systemctl enable --now docker -
Project Infrastructure Setup
Navigate to your target directory (defined in your SSH_FOLDER variable) and create the following structure.
π‘ Note: You only need to manually create the environment files and configuration. Docker images will be pulled automatically by the CI/CD pipeline.
mkdir -p apps/website apps/admin apps/server nginx
${SSH_FOLDER} βββ .env # Global production variables (DB credentials, etc.) βββ apps β βββ website/.env.production # Next.js Client environment β βββ admin/.env.production # Next.js Admin environment β βββ server/.env.production # Nest.js API environment βββ nginx/ # (Optional) Nginx Proxy Manager data βββ docker-compose.prod-ci.yml # Copied from the repository -
First Manual Start (Bootstrap) Before the first automated deploy, log in to Docker Hub and start the initial stack:
# 1. Login to Docker (Use your DOCKER_HUB_TOKEN) echo "YOUR_DOCKER_HUB_TOKEN" | docker login -u YOUR_DOCKER_HUB_USERNAME --password-stdin # 2. Start the project docker compose -f docker-compose.prod-ci.yml -p <PROD_NAME> up -d
We enforce Conventional Commits using Husky and Commitlint:
- feat: A new feature
- fix: A bug fix
- docs: Documentation only changes
- style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- refactor: A code change that neither fixes a bug nor adds a feature
- perf: A code change that improves performance
- test: Adding missing tests or correcting existing tests
- build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
- ci: Changes to CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)