Skip to content

Repository files navigation

Complaint Management System

A mini full-stack Complaint Management System that allows users to submit and track complaints while providing administrators with tools to manage, update, and monitor complaint progress.

Tech Stack

Component Technology
Frontend HTML, CSS, Vanilla JavaScript
Backend Node.js, Express.js
Database SQLite
Authentication JWT with HTTP-only Cookies
Password Security bcrypt

Vanilla JavaScript means pure/plain JavaScript without using a frontend framework or library such as React, Angular, or Vue.


Features

User Features

  • Submit a new complaint
  • Automatically generate a unique tracking ID
  • Track a complaint using the tracking ID
  • View complaint details
  • View complaint status and priority
  • View assigned department
  • View complaint history timeline

Admin Features

  • Secure administrator login
  • JWT-based authentication using HTTP-only cookies
  • View all submitted complaints
  • Search complaints
  • Filter complaints by:
    • Status
    • Category
    • Priority
  • View complete complaint details
  • Update complaint status
  • Update complaint priority
  • Assign complaints to departments
  • Add internal notes
  • Add resolution notes
  • Maintain complaint history
  • Dashboard statistics for complaint monitoring

Project Screenshots

Home Page

Home Page

Submit Complaint

Submit Complaint

Track Complaint

Track Complaint

Admin Login

Admin Login

Admin Dashboard

Admin Dashboard

Complaint Detail

Complaint Detail


Project Structure

Complaint-Management-System/
│
├── backend/
│   ├── db/
│   │   ├── db.js
│   │   └── seed.js
│   │
│   ├── middleware/
│   │   └── auth.js
│   │
│   ├── routes/
│   │   ├── admin.js
│   │   ├── auth.js
│   │   └── complaints.js
│   │
│   ├── .env.example
│   ├── package.json
│   ├── package-lock.json
│   └── server.js
│
├── frontend/
│   ├── assets/
│   │   ├── css/
│   │   │   └── styles.css
│   │   │
│   │   └── js/
│   │       ├── admin_complaint_detail.js
│   │       ├── admin_dashboard.js
│   │       ├── admin_login.js
│   │       ├── common.js
│   │       ├── complaint_submit.js
│   │       └── track.js
│   │
│   ├── pages/
│   │   ├── admin_complaint_detail.html
│   │   ├── admin_dashboard.html
│   │   ├── admin_login.html
│   │   ├── complaint_submit.html
│   │   └── track.html
│   │
│   └── index.html
│
├── .gitignore
├── README.md
├── start_all.bat
└── start_backend.bat

Installation

1. Clone the Repository

git clone https://github.com/hashim212-cs/Complaint-Management-System.git

2. Open the Project

cd Complaint-Management-System

3. Go to the Backend Folder

cd backend

4. Install Dependencies

npm install

5. Configure Environment Variables

Create a .env file inside the backend folder using .env.example as a reference.

Example:

PORT=3000
JWT_SECRET=your_secure_jwt_secret_here
DB_PATH=db/cms.sqlite

Use a strong and private value for JWT_SECRET in a real deployment.

6. Initialize the Database

npm run seed

This creates the SQLite database and adds the default administrator account.

7. Start the Application

For normal mode:

npm start

For development mode with automatic restart:

npm run dev

8. Open in Browser

http://localhost:3000

Default Admin Credentials

Field Value
Username admin
Password admin123

These are default demo credentials created by the database seed script. Change them before using the application in a production environment.


NPM Scripts

Command Purpose
npm start Starts the Node.js server
npm run dev Starts the server using Nodemon
npm run seed Creates/initializes the database and default admin

Main API Endpoints

Method Endpoint Purpose
POST /api/complaints Submit a new complaint
GET /api/complaints/:trackingId Track a complaint
POST /api/auth/login Administrator login
GET /api/admin/complaints Get complaints for admin
GET /api/admin/complaints/:id Get complaint details
PATCH /api/admin/complaints/:id Update a complaint
GET /api/health Check server health

Database

The project uses SQLite, a lightweight relational SQL database.

The database contains three main tables:

  • complaints
  • complaint_history
  • admins

The actual SQLite database file is excluded from GitHub through .gitignore and can be recreated using:

npm run seed

Authentication & Security

The application includes:

  • Password hashing using bcrypt
  • Authentication using JSON Web Tokens (JWT)
  • JWT stored inside an HTTP-only cookie
  • Protected administrator routes
  • Environment variable support for sensitive configuration

This project is designed primarily as an educational/full-stack project. Additional security hardening should be applied before production deployment.


Windows Quick Start

Windows users can use:

start_backend.bat

to start the backend or:

start_all.bat

to start the application and open it in the browser.


How the System Works

User
  ↓
HTML + CSS + Vanilla JavaScript
  ↓
Express.js API
  ↓
Node.js Backend
  ↓
SQLite Database

Complaint Workflow

Submit Complaint
      ↓
Generate Tracking ID
      ↓
Store in SQLite
      ↓
Admin Reviews Complaint
      ↓
Update Status / Priority / Department
      ↓
Create History Record
      ↓
User Tracks Complaint Progress

Project Type

Mini Full-Stack Web Application

This project demonstrates the integration of:

  • Frontend development
  • Backend development
  • REST API development
  • Database management
  • Authentication
  • CRUD operations
  • Complaint tracking
  • Administrative management

Future Improvements

Possible future enhancements include:

  • User accounts and registration
  • Email notifications
  • Password change functionality
  • Role-based access control
  • File/image attachments with complaints
  • Advanced analytics dashboard
  • Pagination
  • Cloud database integration
  • Production deployment

License

This project is currently provided for educational and portfolio purposes.

About

A mini full-stack Complaint Management System built with HTML, CSS, Vanilla JavaScript, Node.js, Express.js, and SQLite.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Contributors

Languages