- ✅ Compound Indexing: Added MongoDB compound indexes across
ArticlesandGlossarymodels for fast feed pagination and tag filtering. - ✅ Full-Text Search (FTS): Built-in weighted text search indexes (
title,summary,description,content). - ✅ Stateless Glossary Autodetect: High-speed, sliding-window medical terminology extraction for article preview pages.
- ✅ Sub-Millisecond Auth: Upgraded token service to RS256 Asymmetric JWT + Redis JTI tracking & User Token Versioning.
The core backend engine powering UltimateHealth — a community-driven open-source health platform.
Provides secure, high-throughput REST & WebSocket APIs for:
- Multilingual health articles, podcasts & series playlists
- Medical terminology autodetect & glossary search
- Collaborative content review & admin moderation workflows
- High-performance RS256 JWT auth with Redis session revocation
- Asynchronous Kafka event queues for notifications & analytics
- Gemini AI medical assistant chat integration
- Frontend Repository: ultimatehealth-app
- Admin Repository: ultimatehealth-admin
- Content Checker Repository: content-checker
- Multilingual Articles & Podcasts: CRUD with translation links (
translationOf), audio tagging, and playlist curation. - Enterprise Security: RS256 Asymmetric JWT signing, Redis sub-millisecond JTI blacklisting, User Token Versioning, and RBAC.
- Asynchronous Event Queues: Dual-broker Apache Kafka cluster with 12 partitions per topic for non-blocking emails and analytics.
- Glossary Autodetect: Stateless HTML plain-text extraction and medical phrase matching.
- Content Moderation & Strikes: Admin review pipeline for podcast and article approval.
- Interactive Swagger Docs: Deployed live at https://ultimatehealth.blog/api/docs.
- Users: Instant self-registration with automatic verification (
isVerified: true) and refresh token attachment. Users receive access and refresh tokens directly upon registration without needing a second email verification step, enabling immediate access to browse, publish health articles, listen to podcasts, interact with the community, or register as health professionals. - Admins & Moderators: Cannot self-register. Admin accounts are explicitly created by a Super Admin or UltimateHealth Admin. To activate their account (
isVerified: true), newly created admins must review and digitally sign the agreement from the website (/admin-agreement). Password recovery is managed via a secure multi-step verification token flow.
- Runtime: Node.js 22
- Framework: Express.js
- Database: MongoDB 6.0 + Mongoose
- Cache & Auth Memory: Redis 7 (
ioredis) - Event Streaming: Apache Kafka (Dual-broker)
- Security: RS256 RSA Key Pair + RBAC
- Gateway & Proxy: Nginx (SSL/TLS, HTTP/2, Socket.IO WebSockets)
- Storage: PocketBase + AWS S3 / Vultr Object Storage
- Containerization: Docker & Docker Compose
- Docs: Swagger (OpenAPI 3)
-
Clone the repository
git clone https://github.com/SB2318/ultimatehealth-backend.git cd ultimatehealth-backend -
Install dependencies
npm install
-
Generate RS256 Key Pair (Optional for local RSA signing)
mkdir -p keys openssl genrsa -out keys/private.pem 2048 openssl rsa -in keys/private.pem -outform PEM -pubout -out keys/public.pem
-
Environment Setup Copy
.env_sampleto.envand fill in your values:cp .env_sample .env
-
Start Stack via Docker Compose
docker compose up -d --build
Or run Node API locally:
npm start
ultimatehealth-backend/
├── config/ # Database, Redis & environment validation
├── controllers/ # Business logic (articles, podcasts, users, admin)
├── middleware/ # RS256 Auth, RBAC, rate limiting, error handling
├── models/ # Mongoose schemas (Articles, Podcast, Glossary, Users)
├── routes/ # API endpoints & OpenAPI specs
├── services/ # Token service, security, Kafka producers/consumers
├── utils/ # Circuit breaker, pocketbase utils, glossary detector
├── keys/ # RS256 RSA Private & Public Keys (Git ignored)
├── docker-compose.yml # Container orchestration (API, Mongo, Redis, Kafka, PocketBase)
├── Dockerfile # Production Node.js container
├── index.js # Express app entry point
└── README.md
We welcome contributions! This backend is open for students, developers, and open-source enthusiasts.
- Read our CONTRIBUTING.md for detailed guidelines.
- Look for issues labeled with
good-first-issue— perfect for beginners.