NestJS async worker for the post domain. Consumes jobs from post-service via gRPC and Redis queue — handles search index synchronization and media/image processing.
- Indexing module — Sync post data to a search index when posts are created, updated, or deleted
- Media module — Process and store post images asynchronously
| Protocol | Address |
|---|---|
| gRPC | :50054 |
No HTTP server — this is a pure worker process.
NestJS 11 · TypeScript · gRPC (nestjs-grpc) · Redis (queue) · @backendworks/post-db · Jest
npm install
npm run dev # nest start --watchNODE_ENV=local
APP_NAME=@backendworks/post-worker
DATABASE_URL=postgresql://admin:master123@localhost:5432/postgres?schema=public
REDIS_URL=redis://localhost:6379
REDIS_KEY_PREFIX=post-worker:
REDIS_TTL=3600
GRPC_URL=0.0.0.0:50054
GRPC_PACKAGE=post-workerProto file: src/protos/post-worker.proto
Generated types: src/generated/post-worker.ts — do not edit manually
Worker-specific RPCs triggered asynchronously by post-service events.
src/
├── app/
│ ├── app.module.ts # Root module
│ └── worker.grpc.controller.ts # gRPC server endpoints
├── common/
│ ├── config/ # app, grpc, redis configs
│ └── services/
│ └── queue.service.ts # Redis-backed job queue consumer
├── modules/
│ ├── indexing/ # Search index sync jobs
│ │ ├── indexing.module.ts
│ │ ├── indexing.service.ts
│ │ ├── indexing.controller.ts
│ │ └── interfaces/ # Indexing event definitions
│ └── media/ # Image processing and storage jobs
├── protos/
└── generated/
npm run dev # Watch mode
npm run build # Production build
npm run lint # ESLint --fix
npm run format # Prettier --write
npm test # Unit tests (100% coverage enforced)Tests live in test/unit/. Coverage thresholds are enforced at 100% for branches, functions, lines, and statements.
npm test