A backend system for managing FAQs with multi-language support, automated translations, and Redis caching. Built with Next.js, MongoDB, and Redis.
Features
- Multi-language FAQ Support: Store and retrieve FAQs in English, Hindi, Bengali, and more.
- WYSIWYG Editor: Rich text formatting for answers using Quill.js.
- Redis Caching: Improve performance with cached FAQ responses.
- Automated Translations: Integrates with Google Translate API for seamless translations.
- RESTful API: CRUD operations for FAQs with language selection.
- Admin Panel: User-friendly interface for managing FAQs (React-based).
- Docker Support: Easy deployment with Docker and Docker Compose.
- Unit Tests: Test coverage for models and API endpoints.
- Node.js 18+
- MongoDB (local or cloud)
- Redis (local or cloud)
-
Clone the repository:
git clone https://github.com/Taurus1601/cms-faq.git cd faq-management-system -
Install dependencies:
npm install
-
Set up environment variables: Create a
.envfile in the root directory:MONGODB_URI=mongodb://localhost:27017/faqdb REDIS_URL=redis://localhost:6379
-
Start Redis:
brew services start redis # macOS brew service start mongodb-community@8.0 -
Run the application:
npm run dev
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/faqs?lang=en |
Get FAQs in a specific language |
| POST | /api/faqs |
Create a new FAQ (auto-translates) |
| PUT | /api/faqs?id=:id |
Update an FAQ by ID |
| DELETE | /api/faqs?id=:id |
Delete an FAQ by ID |
id is mongodb object_id generated automatically
:id are automatically selected when update or delete is clicked
curl http://localhost:3000/api/faqs?lang=hi###FAQ List
The system uses google-translate-api-x for automated translations. To enable this: Free and open source
https://github.com/AidanWelch/google-translate-api#readme
-
FAQs are cached for 1 hour (adjust TTL in code).
-
Cache is invalidated automatically when FAQs are added/updated/deleted.
To check cached data:
redis-cli get faqs:enRun unit tests with:
npm run cypress:open
file : admin.cy.js- Fork the repository.
- Create a feature branch:
git checkout -b feat/your-feature. - Commit changes:
git commit -m "feat: your feature". - Push to the branch:
git push origin feat/your-feature. - Open a pull request.
