Skip to content

rudrakumar07/product

Repository files navigation

Healthcare Login (Express + SQLite)

Secure, minimal role-based auth with three dashboards (patient/doctor/officer), Tailwind UI, and SQLite persistence.

Features

  • Security: bcrypt, sessions (SQLite store), CSRF, Helmet (with CSP), rate limiting, input validation (Zod)
  • Views: EJS-driven pages, Tailwind-based dashboard (white/blue), fixed sidebar
  • Roles: patient, doctor, officer; protected dashboards with role guards
  • Patient: live vitals/telemetry, organ cards, appointments (create/delay/cancel), organ orders list
  • Doctor: list of assigned patients (patients link to doctors via users.assigned_doctor_id)
  • Signup: patient signup with optional doctor selection; login page branded “Biomorph”

Prerequisites

  • Node.js 20.x recommended (package.json engines >=20)
  • npm

If you’re on a different Node version and see native module errors (better-sqlite3), switch to Node 20 or rebuild modules (see Troubleshooting).

Setup

  1. Install dependencies

  2. Create env

  • Copy .env.example to .env and customize values (especially SESSION_SECRET).
  1. Build CSS
  • Tailwind is compiled locally into public/styles.css.
  1. Run DB migrations and seed data
  • Creates/updates tables and inserts sample users/data.
  1. Start the server
  • Dev mode starts the Express server.

VS Code tasks

  • Build CSS: runs Tailwind build
  • npm: migrate: runs DB migrations
  • npm: seed: seeds the database
  • npm: dev: starts the server in dev mode (background)

Credentials

Scripts

  • npm run migrate
  • npm run seed
  • npm run build:css
  • npm run dev
  • npm start (production)

Data model (key tables)

  • users: id, name, email, role, password_hash, assigned_doctor_id
  • organs: patient organ data (+ image/details)
  • organ_orders: orders with status and timestamps
  • appointments: scheduled appointments with doctor link

Troubleshooting

  • better-sqlite3 binary mismatch
    • Symptom: ERR_DLOPEN_FAILED mentioning NODE_MODULE_VERSION mismatch
    • Fix A (recommended): use Node 20
      • With nvm: nvm install 20 && nvm use 20
      • Then run: npm install
    • Fix B: rebuild native module for your current Node
      • npm rebuild better-sqlite3
  • CSP blocks inline scripts
    • All scripts are served from /public and whitelisted via Helmet. Avoid adding inline JS.

Environment

Copy .env.example to .env and set SESSION_SECRET. PORT defaults to 3000.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors