Your College Complaint Management System now uses SQLite database for persistent storage instead of IndexedDB. This means all data (complaints, users, chats) is saved permanently in a SQL database file (college_complaints.db) and will persist even after browser sessions end.
- Frontend: HTML, CSS, JavaScript (unchanged user interface)
- Backend: Node.js with Express.js server
- Database: SQLite3 with permanent file storage
- Communication: REST API between frontend and backend
Navigate to your project directory and install required packages:
cd /Users/ntggamer1/Desktop/Project
npm installThis installs:
express: Web server frameworksqlite3: SQL databasecors: Cross-origin request handlingbody-parser: JSON request parsing
Run the server in the terminal:
npm startYou should see output like:
🚀 Server running on http://localhost:3001
💾 SQLite database: college_complaints.db
Open index.html in your web browser:
file:///Users/ntggamer1/Desktop/Project/index.html
The application will now communicate with the SQL database through the backend server.
- Stores student and official accounts
- Fields: id, username, password, name, email, type, student_id, registered_date
- Stores all complaints submitted by students
- Fields: id, student_id, student_name, title, category, description, status, timestamp
- Indexes on: student_id, status, category, timestamp
- Stores communication between students and officials
- Fields: id, complaint_id, sender_name, sender_id, sender_role, text, timestamp
- Indexes on: complaint_id, timestamp
| Role | Username | Password |
|---|---|---|
| Student | student1 | 1234 |
| Student | student2 | 1234 |
| Official | admin | admin123 |
✅ Data persists across sessions - All data is saved in the SQLite database file ✅ Even after closing browser - Database remains on disk ✅ Cross-browser access - Multiple browsers can access the same database (via the server)
GET /api/complaints- Get all complaintsGET /api/complaints/:id- Get single complaintGET /api/complaints/student/:studentId- Get student's complaintsGET /api/complaints/status/:status- Filter by statusGET /api/complaints/category/:category- Filter by categoryPOST /api/complaints- Create new complaintPUT /api/complaints/:id- Update complaintDELETE /api/complaints/:id- Delete complaint
GET /api/users/student/:username- Get student infoGET /api/users/students/all- Get all studentsPOST /api/users/student- Register new studentPUT /api/users/student/:username- Update student infoDELETE /api/users/student/:username- Delete student
GET /api/chats- Get all chatsGET /api/chats/complaint/:complaintId- Get chats for complaintPOST /api/chats- Send chat messageDELETE /api/chats/complaint/:complaintId- Delete complaint chats
server.js- Express backend server with SQLiteapi-client.js- Frontend API client for making HTTP requestspackage.json- Node.js dependencies
script.js- Updated to use API instead of IndexedDBindex.html- Added api-client.js script reference
database.js- No longer used (IndexedDB code) but kept in projectstyles.css- Unchangedstyles.css- Unchanged
- Make sure server is running (
npm start) - Check that port 3001 is available
- Server may not be running
- Check browser console for detailed error messages
- Database is created automatically on first server run
- Check that you have write permissions in the project directory
- The old
database.js(IndexedDB) is still in the project but not used - You can safely delete it if desired
- All API calls in
api-client.jshave error handling and logging - Server includes proper indexes for fast queries
In the terminal where the server is running, press Ctrl+C
The database file remains saved and data persists for the next session.