Skip to content

HoplaGeiss/nest-projects-api

Repository files navigation

Nest / Angular Monorepo learning project

Monorepo containing NestJS API backend and Angular frontend.

📚 See LEARNING.md for a detailed list of concepts and features demonstrated in this project.

Structure

├── apps/
│   ├── api/          # NestJS backend API
│   └── web/          # Angular frontend

Setup

Prerequisites

  • Node.js (see .node-version)
  • pnpm 9.0.0+

Installation

  1. Install dependencies:
pnpm install
  1. Set up environment variables for the API:
cd apps/api
# Create .env file with your configuration

Required environment variables:

  • DATABASE_URL - SQLite database file path (e.g., file:./dev.db)
  • JWT_SECRET - Secret key for JWT token signing

Optional environment variables:

  • JWT_EXPIRES_IN - JWT access token expiration (default: 15m)
  • REFRESH_TOKEN_SECRET - Secret key for refresh token signing (defaults to JWT_SECRET if not set)
  • REFRESH_TOKEN_EXPIRES_IN - Refresh token expiration (default: 7d)
  • FRONTEND_URL - Frontend URL for CORS (default: http://localhost:4200)
  • PORT - Server port (default: 3000)
  • NODE_ENV - Environment mode (development, production, or test)
  1. Generate Prisma Client:
cd apps/api
npx prisma generate
  1. (Optional) Push database schema:
cd apps/api
npx prisma db push

Development

Run API

pnpm start:api
# or
pnpm --filter @nest-projects/api start:dev

Run Angular App

pnpm start:web
# or
pnpm --filter @nest-projects/web start

Run Both

# Terminal 1
pnpm start:api

# Terminal 2
pnpm start:web

Testing

API Unit Tests

pnpm test:api

API E2E Tests

pnpm test:api:e2e

Angular Tests

pnpm test:web

Frontend E2E Tests (Playwright)

# Install Playwright browsers (first time only)
pnpm test:e2e:install

# Run E2E tests
pnpm test:e2e

# Run E2E tests with UI mode
pnpm test:e2e:ui

Note: Make sure both the API (pnpm start:api) and Angular app (pnpm start:web) are running before executing Playwright E2E tests.

Build

Build API

pnpm build:api

Build Angular App

pnpm build:web

Build All

pnpm build:all

API Documentation

Once the API is running, Swagger documentation is available at:

About

First Nest JS project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages