Project Forensa - Forensic-Medicine-Database


Team


Team Logo

Forensic Medicine Database System (FMDBS)

CO 2050 โ€” Database System Module Project
Computer Engineering | Faculty of Engineering | University of Peradeniya

Designed and engineered by Tira-miss-u


A comprehensive, scalable, and secure system for managing forensic medicine records, including Clinical Cases, Autopsy Cases, Specimen Logs, and Dispatch Reports. Built to modernize legacy MS Access databases into a normalized, RBAC-protected web application.

๐Ÿš€ Tech Stack

๐Ÿ› ๏ธ Features

๐Ÿ“ Project Structure

Forensic-Medicine-Database/
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ config/       # DB Pool & Environment configs
โ”‚   โ”‚   โ”œโ”€โ”€ controllers/  # Core business logic handling
โ”‚   โ”‚   โ”œโ”€โ”€ db/           # Migrations, Seeds, and Scripts
โ”‚   โ”‚   โ”œโ”€โ”€ middleware/   # Auth, RBAC, Validation, Error Handling
โ”‚   โ”‚   โ”œโ”€โ”€ routes/       # Express route definitions
โ”‚   โ”‚   โ””โ”€โ”€ utils/        # Error mapping and async wrappers
โ”‚   โ”œโ”€โ”€ tests/            # Jest Suites (Integration, Adversarial)
โ”‚   โ””โ”€โ”€ server.js         # Entry point
โ”œโ”€โ”€ src/                  # Frontend Vite Source code (Vanilla JS)
โ”œโ”€โ”€ index.html            # Main UI Template
โ””โ”€โ”€ package.json

โš™๏ธ Installation & Setup

  1. Clone the repository:
    git clone https://github.com/imaadh-ifthi/Forensic-Medicine-Database.git
    cd Forensic-Medicine-Database
    
  2. Setup Frontend:
    npm install
    npm run dev
    
  3. Setup Backend:
    cd backend
    npm install
    
  4. Environment Variables: Create a .env file in the backend/ directory:
    NODE_ENV=development
    PORT=3000
    DB_USER=postgres
    DB_PASSWORD=yourpassword
    DB_HOST=127.0.0.1
    DB_PORT=5433
    DB_NAME=fmdbs
    JWT_SECRET=super_secret_jwt_signature_key_2026
    JWT_EXPIRES_IN=24h
    
  5. Start PostgreSQL Container (if using Docker):
    docker-compose up -d
    
  6. Run Database Migrations & Seeds: Navigate to backend/ and execute the migration script to build the 3NF schemas and populate realistic test data:
    node src/db/migrate.js
    
  7. Run the API:
    npm run dev
    

๐Ÿงช Testing

The backend contains a rigorous, adversarial Jest suite covering Auth Bypass attempts, Data Integrity failures, Concurrency/Race condition handling, and complete Integration workflows.

To run the test suite:

cd backend
npm test

๐Ÿง‘โ€โš•๏ธ Dummy Accounts (Seed Data)

After running the seed script, you can log in using the following test accounts:

๐Ÿ“ License