NestJS-based authorization service for the e-commerce platform. Exposes gRPC APIs and integrates with PostgreSQL, Redis, and RabbitMQ.
- Node.js 18+
- Docker (optional, for containerized dev)
- Access to PostgreSQL, Redis, RabbitMQ
Required unless a default is shown.
# Application
NODE_ENV=development
PORT=3012
# gRPC
GRPC_PACKAGE=app
GRPC_PORT=50052 # 50053 is default in code; 50052 used in docker-compose
GRPC_PROTO_PATH=proto/app.proto
# Database
DATABASE_URL=postgresql://user:password@localhost:5432/ecom
# Messaging / Cache
RABBITMQ_URL=amqp://guest:guest@localhost:5672
REDIS_URL=redis://localhost:6379
# Tracing (optional)
JAEGER_ENDPOINT=
# JWT
JWT_ACCESS_TOKEN_SECRET=replace-with-strong-secret
JWT_ACCESS_TOKEN_EXPIRATION_TIME=3600 # seconds
JWT_REFRESH_TOKEN_SECRET=replace-with-strong-secret
JWT_REFRESH_TOKEN_EXPIRATION_TIME=86400 # secondsCreate a local .env file or use .env.docker when running with Docker Compose.
If using asymmetric keys instead of shared secrets, you can generate an EC key pair (P-256) for ES256 JWTs:
chmod +x key_gen.sh
./key_gen.shThis will create .env.keys with the generated keys.
npm install
npm run start:dev# Ensure required infra services and external network exist (see your platform stack)
docker compose up --buildThe service listens on gRPC port 50052 in the compose file and debug port 9229 is mapped to 9230.
npm run start:dev: start with watchnpm run build: compile TypeScriptnpm run test: run unit testsnpm run lint: lint sources
- Keep
DATABASE_URL,RABBITMQ_URL, andREDIS_URLreachable from where you run the service. - Defaults in code may differ from compose mappings; prefer your
.envvalues.