#Blood Bank Management System (MERN + TypeScript) A full-stack Blood Bank Management System built with the MERN stack. Tech Stack Frontend: React + Vite + TypeScript + Tailwind Backend: Node.js + Express + TypeScript Database: MongoDB (Atlas) Auth: JWT + bcrypt
#System Requirements Install:
- Node.js (LTS)
- npm (comes with Node)
Verify: node -v npm -v
#Project Structure Blood-Bank-Management-System/ β βββ frontend/ β React client (Vite) βββ backend/ β Express API (TypeScript) βββ README.md
β‘ Quick Start (Recommended)
#Open 2 terminals: Terminal 1 β Backend cd backend npm install npm run dev
Terminal 2 β Frontend cd frontend npm install npm run dev
#FRONTEND SETUP (React + Vite) *Install dependencies cd frontend npm install
#Run development server npm run dev
#Build for production npm run build
#Preview production build npm run preview
#Install additional packages (if needed) *Axios (API calls) npm install axios
First time initialization cd backend npm init -y
#Install production dependencies npm install express cors dotenv mongoose jsonwebtoken bcryptjs
#Install development dependencies
npm install -D typescript ts-node-dev
@types/node @types/express @types/cors
@types/bcryptjs @types/jsonwebtoken
#Setup TypeScript (first time) npx tsc --init
#Check config: npx tsc --showConfig
βΆ Backend Scripts *Add this inside backend/package.json "scripts": { "dev": "ts-node-dev --respawn --transpile-only src/server.ts", "build": "tsc", "start": "node dist/server.js", "clean": "rm -rf dist" }
#Run backend *Development (auto reload) npm run dev
#Production npm run build npm start
π Environment Variables
- Backend (.env)
*Create: backend/.env
Example: PORT=5000 MONGO_URI=mongodb+srv://username:password@cluster.mongodb.net/bloodbank JWT_SECRET=your_secret_key NODE_ENV=development
Frontend (.env) *Create: frontend/.env VITE_API_URL=http://localhost:5000/api
#Use in code: import.meta.env.VITE_API_URL
π§ͺ API Testing Example: #Register donor POST /api/donors
#Admin login POST /api/admin/login
π§Ή Useful Commands #Clear npm cache npm cache clean --force
Reinstall packages rm -rf node_modules package-lock.json npm install
β Features
- Donor registration
- Blood request system
- Contact form
- Admin dashboard
- JWT authentication
- Protected routes
- MongoDB storage
π¨βπ» Author *Sheren Graphic Designer & Developer