This is a NodeJS/Express-based FAQ management system with multilingual support and Redis caching for improved performance.
✅ Multilingual Support (English, Hindi, Bengali)
✅ REST API with Caching (Redis for caching)
✅ Dockerized (Easily run using Docker)
✅ Unit Testing & Linting (chai/mocha, ESlint)
FAQ_Manager/
├── Backend/
│ ├── config/
│ │ ├── mongoDB.js # MongoDB connection
│ │ └── redis.js # Redis connection
│ ├── controllers/
│ │ └── createFaq.js # FAQ CRUD operations
│ │ └── deleteFaq.js
│ │ └── getFaq.js
│ │ └── getOneFaq.js
│ ├── models/
│ │ └── faq.js # FAQ MongoDB model
│ ├── routes/
│ │ └── faqRouter.js # API routes
│ ├── middleware/
│ │ └── getId.js # Middleware to get FAQ by Id
│ ├── services/
│ │ └── translate.js # Translation of question and answer
│ ├── app.js # Express app setup
│ ├── tests/
│ │ └── faq.test.js # Unit tests
│ ├── .env # Environment variables
│ ├── Dockerfile
│ ├── eslint.config.mjs
│ ├── package-lock.json
│ └── package.json
├── .gitignore
├── .dockerignore
└── docker-compose.yml
- Node.js
- Express.js
- MongoDB
- Redis
- Docker
Before you begin, ensure you have the following installed:
git clone https://github.com/sahil19-19/FAQ_Manager.git
cd FAQ_Managernpm install
MONGO_URL="mongodb://localhost/faqdb"
PORT=3000
REDIS_URL="redis://localhost:6379"If you are not using Docker, you would need to start Redis-server and MongoDB-server in your machine
- Redis
# To start redis-server in mac/ Linux
redis-server
# For Windows users need to install WSL and install redis, and then run the above command
- MongoDB MongoDB is run as a service in Windows and doesn't need to be stated/stopped manually For linux (eg arch)
systemctl start mongodb.service
npm run dev # To run using nodemon
node app.js # To run simply
If you prefer to use Docker, run:
docker-compose up
in FAQ_Manager folder
Access the application at http://localhost:3000.
# Get FAQs in English (default)
GET /api/faqs/# Get FAQs in Hindi
GET /api/faqs/?lang=hi
# Get FAQs in Bengali
GET /api/faqs/?lang=bn
# Get FAQ in English (default)
GET /api/faqs/:id# Get FAQs in Hindi
GET /api/faqs/:id?lang=hi
# Get FAQs in Bengali
GET /api/faqs/:id?lang=bn
POST /api/faqs/
Content-Type: application/json
{
"question": "What is your name?",
"answer": "John"
}DELETE /api/faqs/:idTo run unit tests for the application, use:
npm test
To run ESlint, use:
npm run lint
To contribute please follow these steps:
-
Fork the repository and clone it locally.
-
Create a new branch for your feature:
git checkout -b new-feature
-
Commit your changes with meaningful messages:
git commit -m "feat: Add support for German translations" -
Run tests before pushing:
npm test -
Push your branch and create a Pull Request:
git push origin new-feature