Skip to content

lexand-dev/parallel-app-monorepo

Repository files navigation

Parallel App Monorepo

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.

Features

  • 🚀 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

Using this example

To use this example, you can either clone the repository or create a new Turborepo monorepo and copy the files over.

Structure

This Turborepo includes the following packages/apps:

Apps and Packages

  • api: a NestJS app with GraphQL API
  • parallel: a Next.js frontend application
  • @workspace/ui: a stub React component library shared by applications
  • @workspace/eslint-config: eslint configurations (includes eslint-config-next and eslint-config-prettier)
  • @workspace/typescript-config: tsconfig.jsons used throughout the monorepo

Each package/app is 100% TypeScript.

Utilities

This Turborepo has some additional tools already setup for you:

Getting Started

Prerequisites

Installation

  1. Clone the repository:
git clone https://github.com/lexand-dev/parallel-app-monorepo.git
cd parallel-app-monorepo
  1. Install dependencies:
pnpm install
  1. Set up environment variables:

    Backend (API):

cp apps/api/.env.example apps/api/.env
# Edit apps/api/.env with your database and authentication configuration

Frontend (Next.js):

cp apps/parallel/.env.example apps/parallel/.env
# Edit apps/parallel/.env with your application URL configuration

Note: 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.

Development with Docker Compose

  1. Build and start all services:
docker compose build --no-cache
docker compose up --build
  1. Install additional dependencies (if needed):
docker compose exec app pnpm add dotenv -D --filter=api-gql
  1. Set up the database schema:
docker compose exec app pnpm --filter=api-gql db:push

Useful Docker Commands

  • 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

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •