Welcome to the PCPI Microservice repo!
This project is a microservices-based application built with NestJS and gRPC. It consists of:
- Gateway - HTTP/REST API gateway (port 3000)
- Auth Service - Authentication & authorization (port 50051)
- Evaluation Service - Evaluation management (port 50052)
- Event Service - Event management (port 50053)
- Invitation Service - Invitation handling (port 50054)
- Project Service - Project management (port 50055)
- Notification Service - Email notifications (port 50056)
Each service has its own PostgreSQL database and communicates via gRPC.
Since we are using gRPC for our services, we can't use Swagger to build an API docs page in the conventional way. For this reason, the API contracts are defined in the proto folder under /libs/common/src/protos. There you can find all the contracts for each service!
- Docker & Docker Compose installed
- Node.js 18+ (for local development)
- pnpm installed (
npm install -g pnpm)
The easiest way to run the entire application in development mode with hot reload:
# Using Makefile (recommended)
make dev-up
# Or using docker-compose directly
docker-compose -f docker-compose.base.yml -f docker-compose.dev.yml up
# Run in background
make dev-up-d
# or
docker-compose -f docker-compose.base.yml -f docker-compose.dev.yml up -d
# View logs
make dev-logs
# or
docker-compose -f docker-compose.base.yml -f docker-compose.dev.yml logs -f
# Stop services
make dev-down
# or
docker-compose -f docker-compose.base.yml -f docker-compose.dev.yml downDevelopment Features:
- ✅ Hot reload enabled - code changes automatically restart services
- ✅ Volume mounts for live code editing
- ✅ Database ports exposed (5432-5436) for local tools like pgAdmin or DBeaver
- ✅ Automatic Prisma migrations and proto generation on startup
- ✅ Uses
.envfiles from each service directory
For production deployment:
# 1. Create environment file from example
cp .env.example .env
# 2. Edit .env and fill in production values (database passwords, JWT secrets, etc.)
nano .env
# 3. Start services
make prod-up
# or
docker-compose -f docker-compose.base.yml -f docker-compose.prod.yml up -d
# View logs
make prod-logs
# Stop services
make prod-downProduction Features:
- ✅ Optimized production builds
- ✅ No exposed database ports (internal network only)
- ✅ Environment variables from system/CI (not .env files in services)
- ✅ Restart policies configured
- ✅ Health checks enabled
make help # Show all available commands
make dev-up # Start dev services
make dev-down # Stop dev services
make dev-logs # View dev logs
make dev-build # Build dev services
make dev-rebuild # Rebuild without cache
make prod-up # Start prod services
make prod-down # Stop prod services
make prod-logs # View prod logs
make proto-gen # Generate protobuf files
make clean # Clean Docker resources
make clean-all # Clean all Docker resources including images
# Individual services (dev mode)
make gateway # Start only gateway
make auth # Start only auth-service
make eval # Start only evaluation-service
make event # Start only event-service
make invite # Start only invitation-service
make project # Start only project-service
make notify # Start only notification-serviceIf you want to run a service outside Docker for development:
-
Set up databases:
# Start only databases docker-compose -f docker-compose.base.yml -f docker-compose.dev.yml up auth-db evaluation-db event-db invitation-db project-db -d -
Generate proto files:
make proto-gen # or npm run proto:generate -
Run a specific service:
# Example: Run auth service cd apps/auth-service pnpm install npx prisma generate npx prisma db push pnpm run start:dev
Each service requires its own .env file:
apps/auth-service/.envapps/evaluation-service/.envapps/event-service/.envapps/invitation-service/.envapps/project-service/.envapps/gateway/.envapps/notification-service/.env
Create these files based on the service requirements. Common variables include:
DATABASE_URL- PostgreSQL connection stringJWT_SECRET- Secret for JWT tokens- Service-specific configuration
You just need to create your proto file under /libs/common/src/protos and then run:
make proto-gen
# or
pnpm run proto:generateYour TypeScript files will be generated automatically in /libs/common/src/generated!
The project uses multiple Docker Compose files for different environments:
docker-compose.base.yml- Base configuration shared across all environmentsdocker-compose.dev.yml- Development-specific overrides (hot reload, exposed ports)docker-compose.prod.yml- Production-specific overrides (optimized builds, security)docker-compose.yml- Legacy production setup (deprecated, use new setup above)
For more details, see README.docker.md.
docker psAll services have a health status that you can check in the output.
# Development
docker-compose -f docker-compose.base.yml -f docker-compose.dev.yml logs -f gateway
# Production
docker-compose -f docker-compose.base.yml -f docker-compose.prod.yml logs -f gatewayIn development mode, databases are exposed on these ports:
- Auth DB:
localhost:5432 - Evaluation DB:
localhost:5433 - Event DB:
localhost:5434 - Invitation DB:
localhost:5435 - Project DB:
localhost:5436
Use any PostgreSQL client (pgAdmin, DBeaver, etc.) with credentials:
- User:
postgres - Password:
postgres(development only!) - Database:
{service}_service
make dev-down-v # Stop and remove volumes
make dev-rebuild # Rebuild without cache
make dev-up # Start freshmake proto-gen # Generate locally first
make dev-restart # Then restart containers- Check that database health checks are passing:
docker ps - Verify
DATABASE_URLin service .env files matches container names - Check for port conflicts with locally running PostgreSQL
- Proto Files - gRPC service contracts
- Service Documentation - service-level documentation for gateway and backend microservices