This is a Turborepo monorepo example that demonstrates how to set up and manage multiple applications and packages in a single repository. It includes a NestJS API with GraphQL support and a Next.js frontend application, along with shared configurations and utilities.
- 🚀 NestJS API with GraphQL endpoint
- ⚡ Next.js Frontend with modern React features
- 📦 Shared Packages for code reuse across applications
- 🐳 Docker Support with multi-service orchestration
- 🔧 Development Tools with hot reloading and type safety
- 🎯 Turborepo for efficient builds and caching
To use this example, you can either clone the repository or create a new Turborepo monorepo and copy the files over.
This Turborepo includes the following packages/apps:
api: a NestJS app with GraphQL APIparallel: a Next.js frontend application@workspace/ui: a stub React component library shared by applications@workspace/eslint-config:eslintconfigurations (includeseslint-config-nextandeslint-config-prettier)@workspace/typescript-config:tsconfig.jsons used throughout the monorepo
Each package/app is 100% TypeScript.
This Turborepo has some additional tools already setup for you:
- TypeScript for static type checking
- ESLint for code linting
- Prettier for code formatting
- Docker for containerization
- Docker Compose for multi-service orchestration
- Node.js (version 18 or later)
- pnpm package manager
- Docker and Docker Compose
- Clone the repository:
git clone https://github.com/lexand-dev/parallel-app-monorepo.git
cd parallel-app-monorepo- Install dependencies:
pnpm install-
Set up environment variables:
Backend (API):
cp apps/api/.env.example apps/api/.env
# Edit apps/api/.env with your database and authentication configurationFrontend (Next.js):
cp apps/parallel/.env.example apps/parallel/.env
# Edit apps/parallel/.env with your application URL configurationNote: The default configuration is already set up to work with Docker Compose. You only need to modify the environment variables if you're running outside of Docker or need custom settings.
- Build and start all services:
docker compose build --no-cache
docker compose up --build- Install additional dependencies (if needed):
docker compose exec app pnpm add dotenv -D --filter=api-gql- Set up the database schema:
docker compose exec app pnpm --filter=api-gql db:push-
Stop and remove containers:
docker compose down
-
View logs:
docker compose logs -f
-
Run database migrations:
docker compose exec app pnpm --filter=api-gql db:generate docker compose exec app pnpm --filter=api-gql db:migrate docker compose exec app pnpm --filter=api-gql db:push
-
Access the database container:
docker compose exec db psql -U postgres -d parallel_app_db -
Access the app container:
docker compose exec app sh