Skip to content

sahil19-19/FAQ_Manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FAQ_Manager: MERN Stack Multilingual FAQ Manager

🚀 Overview

This is a NodeJS/Express-based FAQ management system with multilingual support and Redis caching for improved performance.

Key Features

Multilingual Support (English, Hindi, Bengali)
REST API with Caching (Redis for caching)
Dockerized (Easily run using Docker)
Unit Testing & Linting (chai/mocha, ESlint)


🔎 Directory Structure

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

📌 Technologies Used

  • Node.js
  • Express.js
  • MongoDB
  • Redis
  • Docker

📌 Prerequisites

Before you begin, ensure you have the following installed:

📌 Installation Steps

1️⃣ Clone the Repository

git clone https://github.com/sahil19-19/FAQ_Manager.git
cd FAQ_Manager

2️⃣ Install Dependencies

npm install

3️⃣ Create .env file:

MONGO_URL="mongodb://localhost/faqdb"
PORT=3000
REDIS_URL="redis://localhost:6379"

4️⃣ Start MongoDB and Redis (Optional)

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

5️⃣ Start the server

npm run dev  # To run using nodemon

node app.js  # To run simply

6️⃣ Running Using Docker

If you prefer to use Docker, run:

docker-compose up 

in FAQ_Manager folder

📌 API Usage Examples

Access the application at http://localhost:3000.

Get all FAQs

# Get FAQs in English (default)
GET /api/faqs/

getFaqsen

# Get FAQs in Hindi
GET /api/faqs/?lang=hi

getFaqshi

# Get FAQs in Bengali
GET /api/faqs/?lang=bn

getFaqsbn

Get a single FAQ

# Get FAQ in English (default)
GET /api/faqs/:id

getOneen

# Get FAQs in Hindi
GET /api/faqs/:id?lang=hi

getOnehi

# Get FAQs in Bengali
GET /api/faqs/:id?lang=bn

getOnebn

Create FAQ

POST /api/faqs/
Content-Type: application/json

{
  "question": "What is your name?",
  "answer": "John"
}

getFaq

Delete FAQ

DELETE /api/faqs/:id

delFaq

📌 Testing and Linting

To run unit tests for the application, use:

npm test

To run ESlint, use:

npm run lint

📌 Contribution Guidelines

To contribute please follow these steps:

  1. Fork the repository and clone it locally.

  2. Create a new branch for your feature:

    git checkout -b new-feature
  3. Commit your changes with meaningful messages:

    git commit -m "feat: Add support for German translations"
  4. Run tests before pushing:

    npm test
  5. Push your branch and create a Pull Request:

    git push origin new-feature

About

NodeJS, ExpressJS and MongoDB based FAQ manager with multilingual support

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors