Skip to content

feat: Production Docker, Security Hardening, BullMQ Queues & Swagger DTOs#1076

Open
RUKAYAT-CODER wants to merge 1 commit into
CodeGirlsInc:mainfrom
RUKAYAT-CODER:feat/be-03-04-05-09-docker-security-bullmq-swagger
Open

feat: Production Docker, Security Hardening, BullMQ Queues & Swagger DTOs#1076
RUKAYAT-CODER wants to merge 1 commit into
CodeGirlsInc:mainfrom
RUKAYAT-CODER:feat/be-03-04-05-09-docker-security-bullmq-swagger

Conversation

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Summary

  • BE-03: Production-ready multi-stage Dockerfiles for backend and frontend, docker-compose.prod.yml with postgres/redis/backend/frontend services and health checks, plus separate backend-ci.yml and frontend-ci.yml GitHub Actions workflows
  • BE-04: HTTP security headers (CSP, X-Frame-Options, HSTS, etc.) on all Next.js routes, new api-keys module with cryptographic key generation/validation via X-API-Key guard, full environment variable audit with Joi schema and .env.example
  • BE-05: BullMQ integration with three named queues (stellar-anchor, email-send, pdf-generate) and processors with 3-attempt exponential backoff and progress tracking; TasksService cron jobs for stuck-shipment flagging (daily 2AM) and temp-file cleanup (daily 3AM); GET /admin/queue/stats endpoint
  • BE-09: Response DTOs (BidResponseDto, AddressResponseDto, ReviewResponseDto, WebhookResponseDto, AuditLogResponseDto) with full @ApiProperty decoration; typed @ApiResponse added to GET endpoints so Swagger renders complete response schemas

Test plan

  • docker build -f backend/Dockerfile backend/ and docker build -f frontend/Dockerfile frontend/ complete without errors
  • docker compose -f docker-compose.prod.yml up brings all four services healthy
  • POST /api-keys returns the full key once; GET /api-keys returns prefix only
  • X-API-Key header with a valid key authenticates a protected endpoint; expired/invalid key returns 401
  • All three BullMQ queues are registered (visible via redis-cli keys bull:*)
  • GET /admin/queue/stats returns job counts for each queue (403 for non-admins)
  • /docs shows populated request/response schemas for bids, addresses, reviews, webhooks
  • Security headers appear on every frontend response (curl -I http://localhost:3000)
  • Backend CI: lint, tests, build, and migration dry-run all pass
  • Frontend CI: type-check, lint, and build all pass

Closes #960
Closes #961
Closes #962
Closes #969

BE-03 (Docker + CI):
- Add multi-stage backend/Dockerfile (node:20-alpine, EXPOSE 6006)
- Add multi-stage frontend/Dockerfile (standalone Next.js, EXPOSE 3000)
- Add docker-compose.prod.yml with postgres, redis, backend, frontend services
- Add .github/workflows/backend-ci.yml (lint, test, build, migration dry-run)
- Add .github/workflows/frontend-ci.yml (type-check, lint, build)
- Add backend/.npmrc for legacy-peer-deps compatibility

BE-04 (Security):
- Add HTTP security headers to frontend/next.config.ts (CSP, X-Frame-Options, HSTS, etc.)
- Add output:standalone and Cloudinary remotePattern to next.config.ts
- Add backend/src/api-keys/ module (entity, service, guard, controller)
- Update env-validation with JWT_SECRET as required, add REDIS_HOST/PORT/PASSWORD,
  Twilio, Web Push, Stellar contract vars, and PLATFORM_FEE_PERCENT
- Add .env.example with all environment variables documented

BE-05 (BullMQ + Cron Jobs):
- Install @nestjs/bullmq and bullmq
- Add backend/src/queue/ module with three named queues: stellar-anchor,
  email-send, pdf-generate with 3-attempt exponential backoff
- Add processor classes with updateProgress(25/50/75/100) pattern
- Add backend/src/tasks/ module with stuck-shipment check (daily 2AM)
  and temp-file cleanup (daily 3AM) cron jobs
- Add GET /admin/queue/stats endpoint returning job counts per queue
- Register BullModule.forRootAsync in AppModule using REDIS_HOST/PORT

BE-09 (Swagger DTOs):
- Create BidResponseDto, AddressResponseDto, ReviewResponseDto,
  WebhookResponseDto, AuditLogResponseDto
- Add @apiresponse({ type }) to GET endpoints in bids, addresses, reviews,
  webhooks, audit-log controllers

Fixes: correct HealthIndicatorResult return type in cloudinary, smtp, and
db health indicators (was HealthCheckResult)

Closes CodeGirlsInc#960
Closes CodeGirlsInc#961
Closes CodeGirlsInc#962
Closes CodeGirlsInc#969
@vercel

vercel Bot commented Jun 28, 2026

Copy link
Copy Markdown

@RUKAYAT-CODER is attempting to deploy a commit to the Mftee's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant