A multilingual FAQ management system built with Node.js, Express, MongoDB, and Redis.
- RESTful API for FAQ management
- Multi-language support with automatic translation
- Redis caching for improved performance
- MongoDB for data persistence
- Swagger API documentation
- Docker support
- Comprehensive test coverage
- Loading indicators for create, update, and delete operations
- Improved frontend performance with React.memo and staleTime
- Form validation for question and answer fields
- Node.js 18 or higher
- MongoDB
- Redis
- Google Cloud Translation API credentials
- Clone the repository:
git clone <repository-url>
cd faq-system
- Install dependencies:
npm install
- Create a
.env
file in the root directory:
PORT=3000
MONGODB_URI=mongodb://localhost:27017/faq-system
REDIS_URL=redis://localhost:6379
GOOGLE_PROJECT_ID=your-project-id
GOOGLE_TRANSLATE_API_KEY=your-api-key
npm run dev
npm run build
npm start
docker-compose up
Once the application is running, visit http://localhost:3000/api-docs
for the Swagger documentation.
GET /api/faqs
- Get all FAQs (supports language parameter)POST /api/faqs
- Create a new FAQ- Request body:
{ "question": "string", "answer": "string" }
- Request body:
PUT /api/faqs/:id
- Update an FAQ- Request body:
{ "question": "string", "answer": "string" }
- Request body:
DELETE /api/faqs/:id
- Delete an FAQ
Get FAQs in English (default):
curl http://localhost:3000/api/faqs
Get FAQs in Hindi:
curl http://localhost:3000/api/faqs?lang=hi
Create a new FAQ:
curl -X POST http://localhost:3000/api/faqs \
-H "Content-Type: application/json" \
-d '{"question":"What is this?","answer":"This is a FAQ system."}'
Run the test suite:
npm test
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'feat: Add amazing feature'
)- Use the following format for commit messages:
type: message
feat
: A new featurefix
: A bug fixdocs
: Documentation changesstyle
: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)refactor
: A code change that neither adds a feature nor fixes a bugperf
: A code change that improves performancetest
: Adding missing tests or correcting existing testsbuild
: Changes that affect the build system or external dependenciesci
: Changes to our CI configuration files and scriptschore
: Other changes that don't modify src or test files
- Use the following format for commit messages:
- Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.