Explainer Deck is a highly responsive and resource-efficient Retrieval-Augmented Generation (RAG) platform designed to analyze long-form documents such as technical manuals, research papers, reports, and financial statements.
The platform retrieves relevant information from indexed documents and generates precise, context-grounded answers while minimizing hallucinations.
Powered by a Node.js/TypeScript backend, the application leverages the low-latency inference capabilities of the Groq Cloud API to deliver fast and context-aware responses to user queries.
The project is designed to run alongside other applications, such as EduMind, within a shared cloud environment such as an AWS EC2 instance.
Nginx acts as the reverse proxy and handles path-based routing, while PM2 manages the Explainer Deck backend process.
[ Public Web Traffic: Port 80 ]
│
▼
┌─────────────────┐
│ Nginx Proxy │
└────────┬────────┘
│
┌──────────────┴──────────────┐
│ │
▼ / ▼ /explainer/
┌──────────────┐ ┌─────────────────────────┐
│ EduMind │ │ Explainer Deck │
│ (Python App) │ │ (Node.js/TypeScript) │
│ Port 8000 │ │ Port 5001 │
└──────────────┘ └────────────┬────────────┘
│
▼
[ Managed by PM2 ]
[ Executed via tsx ]
│
▼
┌─────────────────────────┐
│ apps/backend/src/... │
└────────────┬────────────┘
│
┌──────────────────┴──────────────────┐
│ │
▼ ▼
┌───────────────────────┐ ┌───────────────────────┐
│ Vector Store / DB │ │ Groq Cloud API │
│ (Document Embeddings) │ │ (Fast LLM Inference) │
└───────────────────────┘ └───────────────────────┘
Nginx acts as the main ingress router and reverse proxy for applications running on the server.
The routing structure is:
/ → EduMind (Port 8000)
/explainer/ → Explainer Deck (Port 5001)
This architecture allows multiple applications to run on the same AWS EC2 instance while remaining accessible through separate URL paths.
PM2 is used as the production process manager for the Explainer Deck backend.
It provides:
- 24/7 background process execution
- Automatic application restart after crashes
- Process monitoring
- Log management
- Server reboot persistence
The backend is executed directly using tsx.
This avoids requiring a separate TypeScript compilation step during application startup and provides a lightweight development and deployment workflow.
In the current deployment environment, using tsx with PM2 helped significantly reduce the observed memory footprint compared with the previous execution setup.
RAG-Project/
│
├── apps/
│ └── backend/
│ ├── src/
│ │ ├── index.ts
│ │ └── ...
│ │
│ ├── .env
│ └── package.json
│
├── package.json
└── README.md
The exact project structure may vary depending on additional frontend, shared package, or infrastructure components.
Before running the application, make sure the following tools are installed:
- Node.js v18 or higher
- npm
- PM2
- tsx
- Nginx (for production reverse-proxy deployment)
Install PM2 globally:
npm install -g pm2Install tsx globally:
npm install -g tsxCreate an .env file inside the backend directory:
apps/backend/.env
Example configuration:
PORT=5001
GROQ_API_KEY=your_secret_groq_api_token
# Add database configuration here
# DATABASE_URL=your_database_url
# Add vector database configuration here
# VECTOR_DB_API_KEY=your_vector_database_key
# Add embedding provider configuration here
# EMBEDDING_API_KEY=your_embedding_api_key
⚠️ Never commit your.envfile or API keys to GitHub.
Add .env to your .gitignore file:
.env
node_modules/
dist/Navigate to the project root:
cd /home/ubuntu/RAG-ProjectStart the Explainer Deck backend using PM2 and tsx:
PORT=5001 pm2 start tsx --name "explainer-deck" -- apps/backend/src/index.tsCheck whether the application is running:
pm2 statusSave the PM2 process configuration:
pm2 saveTo configure PM2 to automatically start applications after a server reboot:
pm2 startupRun the command generated by PM2, then save the process list again:
pm2 savepm2 statusThis displays:
- Application status
- Process ID
- CPU usage
- Memory usage
- Restart count
- Uptime
View live logs for Explainer Deck:
pm2 logs explainer-deckView recent log lines:
pm2 logs explainer-deck --lines 100pm2 restart explainer-deckpm2 stop explainer-deckpm2 delete explainer-deckThe production environment uses Nginx to route incoming requests between applications.
Example routing configuration:
server {
listen 80;
server_name _;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /explainer/ {
proxy_pass http://127.0.0.1:5001/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}After modifying the Nginx configuration, test it:
sudo nginx -tIf the configuration is valid, reload Nginx:
sudo systemctl reload nginxCheck Nginx status:
sudo systemctl status nginxThe basic RAG request flow is:
User
│
▼
Explainer Deck Interface
│
▼
Nginx Reverse Proxy
│
▼
Node.js / TypeScript Backend
│
▼
User Query Processing
│
▼
Vector Store Search
│
▼
Relevant Document Chunks
│
▼
Context Construction
│
▼
Groq Cloud API
│
▼
Context-Grounded Response
│
▼
User
- 📄 Long-form document analysis
- 🔍 Semantic document retrieval
- 🧠 Retrieval-Augmented Generation (RAG)
- 💬 Context-aware question answering
- ⚡ Low-latency LLM inference using Groq
- 🧩 Semantic document chunking
- 📚 Context-grounded answer generation
- 🏷️ Document metadata tracking
- 🔎 Relevant context retrieval
- 🚀 Lightweight TypeScript execution using
tsx - 🔄 Production process management using PM2
- 🌐 Nginx path-based reverse proxy routing
- ☁️ Cloud deployment support
- 🖥️ Multi-application deployment architecture
Explainer Deck is designed for:
- Research analysts
- Students and researchers
- Technical developers
- Financial analysts
- Information workers
- Professionals working with large document collections
The platform is particularly useful when users need to quickly retrieve and understand information contained within large or complex documents.
For production deployments:
- Never expose API keys in source code.
- Keep
.envfiles outside version control. - Restrict unnecessary EC2 inbound ports.
- Expose applications through Nginx instead of directly exposing backend ports.
- Configure HTTPS using SSL/TLS.
- Regularly update Node.js dependencies.
- Monitor PM2 logs for unexpected errors.
- Rotate API credentials periodically.
| Component | Technology |
|---|---|
| Backend | Node.js / TypeScript |
| TypeScript Runtime | tsx |
| AI Inference | Groq Cloud API |
| Architecture | Retrieval-Augmented Generation (RAG) |
| Document Retrieval | Vector Store |
| Process Manager | PM2 |
| Reverse Proxy | Nginx |
| Cloud Infrastructure | AWS EC2 |
| Explainer Deck Port | 5001 |
| EduMind Port | 8000 |
Potential future enhancements include:
- Multi-document conversational sessions
- Advanced document citation support
- Source-level answer references
- Streaming AI responses
- User authentication
- Conversation history
- Document management dashboard
- Improved embedding and reranking pipelines
- Hybrid semantic and keyword search
- HTTPS/SSL production configuration
- Docker-based deployment
- CI/CD deployment pipeline
- Horizontal scaling support
The goal of Explainer Deck is to provide a fast, scalable, and resource-efficient platform for extracting meaningful insights from complex documents.
By combining semantic document retrieval with high-speed LLM inference, the system aims to provide reliable, context-grounded responses while minimizing hallucinations and reducing the time required to manually search through large documents.
This project is intended for educational, research, and development purposes.
Abhishek Pandey
Developer and AI enthusiast focused on building practical AI-powered applications, Retrieval-Augmented Generation systems, and scalable cloud-deployed software solutions.