How rajgm/backend-superteam_vietnam_ai works
Project type and purpose
• From the file tree and README we see this is a Node.js-based backend service (“backend-Superteam_Vietnam_AI”) that:
• Exposes HTTP endpoints via Express (index.js + routes/)
• Integrates with Firebase (lib/firebaseConfig.js, lib/firebaseUtil.js) for data storage
• Talks to Telegram (lib/telegram.js) and processes tweets (lib/processTweet.js)
• Has a dedicated “LLM” folder with its own Dockerfile, suggesting a separate microservice for large-language-model calls
• Is containerized via Docker and docker-compose
File structure
• Top-level files:
• Dockerfile + docker-compose.yml → container orchestration
• index.js → Express-based API server entrypoint
• .env.example → environment configuration
• README.md → minimal project title
• folders:
• routes/ (chat.js, draft_tweet.js, upload.js) → Express route handlers
• lib/ (firebaseConfig.js, firebaseUtil.js, helperFunction.js, processTweet.js, query.js, telegram.js) → core business logic & external integrations
• LLM/ (Dockerfile, startup.sh) → standalone LLM microservice
• docs/ → documentation artifacts
• test.js, test.json → local test harness
Key architectural insights from README and structure
• No built-in frontend; this is pure backend/microservices
• Heavy reliance on Firebase as primary DB / storage
• External APIs: Telegram Bot API, Twitter API, (likely) OpenAI or similar inside the LLM service
• Two major containers/services:
1) API Service
2) LLM Worker Service
Main components & their interactions
a. Clients/Entry Points
• Telegram users (via Bot)
• Potential HTTP clients (e.g., web UI or Postman for draft_tweet/upload)
b. API Service (Express)
• Routes: /chat, /draft_tweet, /upload
• Reads WRITE/READ from Firebase (Firestore or Realtime DB)
• Calls LLM microservice over HTTP (or gRPC) for heavy NLP tasks
• Uses lib/telegram.js to relay responses back to users
c. LLM Service
• Runs in its own container (LLM/Dockerfile + startup.sh)
• Hosts model calls (OpenAI or local model)
• Responds to API Service requests
d. Firebase
• Data storage (user sessions, drafts, uploaded files)
• Could include both Firestore and Cloud Storage
e. External APIs
• Telegram Bot API
• Twitter API
Architectural patterns & design principles
• Microservice decomposition (API vs. LLM worker)
• 12-factor app: env vars, config, stateless services
• Single responsibility per module (routes for routing, lib for logic)
• Containerization via Docker + Docker-Compose for local orchestration