SWBS Backend API
A NestJS 11 REST API with the Fastify adapter, serving as the CMS backend for all three SWBS applications.
Über das Projekt
The SWBS backend is a NestJS 11 application with Fastify 5 as HTTP adapter — a combination that delivers up to 3× the throughput of Express. The API manages every content type on the platform and exposes it through typed REST endpoints.
Technical stack: NestJS with dependency injection, guards, interceptors and pipes. Mongoose 8 as ODM for MongoDB 7, with lean queries and schema validation. Redis 7 for response caching (5 minutes for lists, 10 minutes for detail pages) via Cache Manager. BullMQ for asynchronous job queues (cache invalidation, for instance).
API design: ClassSerializerInterceptor with response DTOs and @Expose() decorators prevents accidental data leaks. Every internal MongoDB ID (_id) is replaced by a NanoID-based business ID. JWT guards protect all admin endpoints. Rate limiting via @nestjs/throttler protects the public endpoints.
Content types: 15+ complete CRUD modules — technologies, services, projects (including sub-projects), case studies, blog posts, industries, locations, team members, clients, IT knowledge, use cases, testimonials, site settings, media and contact enquiries.
GDPR: a dedicated privacy controller with data export (Art. 20), deletion requests (Art. 17) and automatic deletion after six months via a cron job.
Herausforderung
Designing an API that works equally well for public reads (tuned for speed and SEO-friendly data structures) and admin writes (full CRUD with validation).
Unsere Lösung
Separate controller namespaces (/v1/technologies for public, /v1/admin/technologies for admin) with different DTOs and guards. A facade pattern to keep business logic separate. Mongoose .lean().exec() for maximum read performance.
Ergebnisse
15+ complete CRUD modules with Swagger documentation
Sub-50 ms API response times thanks to Redis caching
JWT auth with refresh token rotation for admin access
A GDPR-compliant privacy controller with export and deletion
A BullMQ architecture for asynchronous cache invalidation
Automatic OpenAPI spec generation from the NestJS decorators