SimAid is a full-stack web application that gamifies first aid learning through scenario-based simulations.
Users progress through levels, earn badges, and unlock certificates for mastering key emergency response skills.
- React 18 with functional components and hooks
- Custom Hooks Architecture for modular logic (
useAuth,useLevels,useUserLevels, etc.) - React Router for page navigation
- CSS Modules / Custom Styles (
/styles/) - Responsive design, accessible and mobile-friendly
- Node.js + Express.js
- MySQL 8+ database with
mysql2/promiseconnection pool - Domain-driven structure with:
- Entities
- Repositories
- Services
- Controllers
- JWT Authentication (
access token) - Bcrypt password hashing
- Role-based Access Control (RBAC) via
isAdminmiddleware - Validation Layer using
express-validator - Centralized Error Handling
| Category | Description |
|---|---|
| ๐ฎ Scenarios & Steps | Interactive multi-step training scenarios with MCQ-style questions and feedback |
| ๐ง Levels | Structured progression system with increasing difficulty |
| ๐ Badges | Earn badges when you complete levels with perfect scores |
| ๐งพ Certificates | Generate printable/shareable PDF certificate on completion |
| ๐ค User System | Registration, login, JWT sessions, role-based access |
| ๐พ Progress Tracking | Saves attempts, tracks scores, and unlocks next levels automatically |
SimAid is a full-stack web application that gamifies first aid learning through scenario-based simulations.
Users progress through levels, earn badges, and unlock certificates for mastering key emergency response skills.
- React 18 with functional components and hooks
- Custom Hooks Architecture for modular logic (
useAuth,useLevels,useUserLevels, etc.) - React Router for page navigation
- CSS Modules / Custom Styles (
/styles/) - Responsive design, accessible and mobile-friendly
- Node.js + Express.js
- MySQL 8+ database with
mysql2/promiseconnection pool - Domain-driven structure with:
- Entities
- Repositories
- Services
- Controllers
- JWT Authentication (
access token) - Bcrypt password hashing
- Role-based Access Control (RBAC) via
isAdminmiddleware - Validation Layer using
express-validator - Centralized Error Handling
| Category | Description |
|---|---|
| ๐ฎ Scenarios & Steps | Interactive multi-step training scenarios with MCQ-style questions and feedback |
| ๐ง Levels | Structured progression system with increasing difficulty |
| ๐ Badges | Earn badges when you complete levels with perfect scores |
| ๐งพ Certificates | Generate printable/shareable PDF certificate on completion |
| ๐ค User System | Registration, login, JWT sessions, role-based access |
| ๐พ Progress Tracking | Saves attempts, tracks scores, and unlocks next levels automatically |
simaid/
โโโ backend/
โ โโโ src/
โ โ โโโ config/ # Database connection + health check
โ โ โโโ controllers/ # Route controllers (Express)
โ โ โโโ domain/
โ โ โ โโโ entities/ # Data models
โ โ โ โโโ repositories/# Database queries
โ โ โ โโโ dto/ # DTOs for clean data transfer
โ โ โโโ middlewares/ # Auth / Error handling
โ โ โโโ routes/ # RESTful routes
โ โ โโโ services/ # Business logic
โ โ โโโ utils/ # Helpers (JWT, bcrypt, feedback, etc.)
โ โ โโโ app.js # Express app setup
โ โ โโโ server.js # Entry point
โ โโโ package.json
โ
โโโ frontend/
โ โโโ src/
โ โ โโโ components/ # Reusable UI components
โ โ โโโ hooks/ # Custom React hooks
โ โ โโโ pages/ # Page-level components (Home, Level, Profile)
โ โ โโโ services/ # API services
โ โ โโโ styles/ # CSS styles
โ โ โโโ app.jsx
โ โโโ package.json
โ
โโโ .env.example # Environment variable template
โโโ README.md
โโโ package.json # Root project config (optional)
Create a .env file inside the backend directory:
PORT=4000 DB_HOST=localhost DB_USER=root DB_PASS=yourpassword DB_NAME=simaid JWT_SECRET=supersecretkey JWT_EXPIRES_IN=7d ## Setup & Installation: git clone https://github.com/yourusername/simaid.git cd simaid ## Install dependencies: # Backend cd backend npm install #Frontend cd ../frontend npm install ## Set up database CREATE DATABASE simaid; Then import your schema file: ## Run the app: ## Backend: cd backend npm run dev It will start at http://localhost:4000 ## Frontend: cd ../frontend npm run dev Accessible at http://localhost:5173 # API Endpoints: | Method | Endpoint | Description | | ------ | ------------------------------- | ------------------------- | | `POST` | `/api/users/register` | Register new user | | `POST` | `/api/users/login` | Login user | | `GET` | `/api/levels` | Fetch all levels | | `GET` | `/api/scenarios/level/:levelId` | Get scenarios by level | | `POST` | `/api/attempts` | Save or update best score | | `GET` | `/api/user-levels` | Get user level progress | | `POST` | `/api/user-badges` | Assign badge to user | ## Development Notes Each repository handles a single SQL responsibility. Service layer encapsulates business logic. Controllers manage route I/O and responses. React hooks keep frontend logic modular and reusable. Fully written in ESM syntax (import/export). ## Future Enhancements: ๐งฉ Add leaderboard for top performers ๐ Real-time notifications (WebSocket) ๐ Multi-language support ๐ฑ PWA mode for offline training ## Credits Author: Reine Rahim Email: [email protected] Organization: plus Framework: Node.js + React + MySQL