Roomco — Legacy Platform Modernization
Migrating a legacy Express.js and Node 12 platform to a NestJS modular monolith, merging two Express apps into one, extracting moderation microservices, and modernizing the MongoDB data layer.
Role: Lead Developer and Migration Architect
Overview
Roomco is a social and chat application for young users. Its backend had grown on Node 12 with outdated dependencies, two separate Express apps (one for the chat sockets, one for the API), a legacy MongoDB version and weak data structures. I led the move to a NestJS and TypeScript modular monolith on a current Node.js version, merged the two apps into one, extracted content moderation into independent microservices, upgraded and cleaned up MongoDB, and designed the roadmap for consolidating users from Firebase and the legacy Mongo database into a better-structured, performance-optimized schema.
Tech Stack
backend
ai
data
Key Numbers
10 (12 to 22)
Node.js major versions upgraded
75%
Runtime error reduction
< 500 ms
Image scan response time
95%+
Nudity detection accuracy
40%
Chatbot engagement increase
The Problem
The platform ran on an aging stack: Node 12 with outdated dependencies, plain Express.js without static typing, and separate Express applications for the socket server and the REST API. Users lived in two places, a Firebase database and a legacy MongoDB with outdated and poorly designed data structures. Each of these made the system harder to change safely and added operational complexity.
- Upgrade Node.js from 12 to 22 and resolve outdated or incompatible dependencies without breaking behaviour
- Migrate from Express.js to NestJS and TypeScript while the product kept running
- Remove the complexity of running a separate chat-socket Express app alongside the API Express app
- Isolate heavy content moderation (media and text) from the main application
- Upgrade a legacy MongoDB version and fix outdated, badly structured data
- Plan the merge of users from Firebase and legacy MongoDB into one optimized structure
- Bring the development team along with the new architecture
The Solution
- 1Migrate incrementally to NestJS with TypeScript under a documented migration strategy supervised across the team
- 2Merge the chat socket app and the API app into a single NestJS modular monolith instead of splitting into more services
- 3Extract only what benefits from independent scaling, content moderation, into separate microservices
- 4Upgrade MongoDB and repair data structures, then roadmap the user consolidation from Firebase and legacy Mongo
- 5Document the patterns and train the team so the new architecture is maintainable
Express to NestJS migration
Led the migration of the codebase from Express.js to NestJS with TypeScript, defining the migration plan, supervising the team with regular code reviews, and documenting patterns and best practices.
Node.js 12 to 22 upgrade
Upgraded Node.js across ten major versions with comprehensive testing, resolving outdated dependencies along the way.
Modular monolith merging chat and API
Combined the separate chat-socket Express app and API Express app into one NestJS application organised in modules, removing the duplicated infrastructure and cross-app complexity.
Moderation microservices
Content moderation extracted into independent services. A FastAPI service with a fast.ai nudity-detection model scans images in real time, communicating with NestJS over Redis Pub/Sub; text moderation is a separate service.
MongoDB upgrade and data cleanup
Upgraded the legacy MongoDB version to a current one and resolved outdated and poorly designed data structures.
User consolidation roadmap
A roadmap for merging users from Firebase and the legacy MongoDB into a more comprehensive, performance-optimized MongoDB data structure.
AI chatbots
Chatbots built on the ChatGPT SSE API with streaming responses, multi-language replies validated with JSON schemas, and image generation.
Knowledge transfer
A migration guide, training materials and mentoring on NestJS, TypeScript and microservices.
Architecture
NestJS modular monolith with extracted moderation microservices
- 1Upgrade Node.js 12 to 22 and resolve outdated dependencies
- 2Migrate Express.js to NestJS with TypeScript
- 3Merge the chat-socket and API apps into a modular monolith
- 4Extract media and text moderation into microservices
- 5Upgrade MongoDB and fix legacy data structures
- 6Roadmap: consolidate Firebase and legacy Mongo users into the new schema
- 1User uploads an image
- 2NestJS publishes a scan request on Redis Pub/Sub
- 3FastAPI service runs the fast.ai nudity-detection model
- 4Result returned over Redis Pub/Sub
- 5NestJS allows or blocks the content
Components
Application
NestJS, TypeScript, Node.js 22One modular monolith replacing the separate API and chat-socket Express apps.
Real-time
Socket.ioChat gateway living as a module inside the same application as the API.
Moderation services
FastAPI, fast.ai, Redis Pub/SubIndependent services for media and text moderation that scale separately from the main app.
AI features
ChatGPT API (SSE)Streaming chatbots with JSON-schema-validated multi-language responses and image generation.
Data
MongoDBUpgraded from a legacy version with cleaned-up data structures; target of the Firebase and legacy-Mongo user consolidation.
Key Decisions
Modular monolith instead of splitting into more services
Why: The separate chat-socket and API Express apps were creating complexity. One NestJS application with clear modules keeps deployment and development simple.
Microservices only for content moderation
Why: Moderation is a distinct, compute-heavy concern that benefits from a Python and ML stack and independent scaling, so it is the one part extracted from the monolith.
NestJS with TypeScript for the rewrite target
Why: Static typing and an opinionated module structure improve maintainability and reduce runtime errors.
Redis Pub/Sub between NestJS and the moderation services
Why: Lightweight asynchronous messaging suits real-time image scanning without coupling the services.
Roadmap for user consolidation rather than a one-shot merge
Why: Users in Firebase and legacy MongoDB need a carefully planned move into a new structure, so it is staged.
Technical Challenges
Upgrading Node.js across ten major versions
Solution: Resolved outdated dependencies and validated the upgrade with comprehensive testing.
Outcome: Reported as completed without breaking changes.
Migrating the whole codebase to NestJS while the team kept delivering
Solution: A documented migration strategy, regular code reviews, a migration guide and training sessions.
Outcome: Reported as completed with zero downtime.
Outcomes
- Entire codebase migrated from Express.js to NestJS with zero downtime
- Node.js upgraded across 10 major versions without breaking changes
- Type-safe architecture reducing runtime errors by 75%
- Real-time image scanning in under 500ms using Redis Pub/Sub
- Nudity-detection model with 95%+ accuracy protecting young users
- AI chatbot increasing user engagement by 40%
Engineering Practices
- Documented migration plan, guide of patterns and best practices, and training materials
- Regular code reviews supervising the team through the migration
- Type-safe architecture with TypeScript
- JSON schema validation of multi-language chatbot responses
- Independently scalable moderation microservices
Next Steps
- Execute the roadmap to merge users from Firebase and legacy MongoDB into the optimized MongoDB structure