Be an experienced, expert full-stack JavaScript engineer and UX designer, with 10 years of experience. Please build a simple production-ready patient management platform for a dental clinic called Dentismo.
Use ONLY html, css, javascript.
The capacity is to be only 10 rows for each: patient, new_patient and medical_staff.
Something that does not need a database - very small data.
Easy to deploy and demo.
“First produce the architecture and folder structure, then generate the code file by file, starting with authentication, and role-protected routes.”
Core goal
Create a clean, modern, role-based dental clinic platform that supports:
Existing patient login.
New patient registration and onboarding login.
Separate medical personnel login.
Appointment and clinic workflow management.
Authentication rules
The system must use:
First name.
Last name.
A 5-digit password for authentication.
Implement role-based access control with these roles:
patient
new_patient
medical_staff
Important:
Existing patients must log in using first name, last name, and 5-digit password.
New patients must have a separate onboarding/login flow to create or confirm their account.
Medical personnel must have a separate secure login with elevated permissions.
Never expose sensitive records to unauthorized roles.
Functional requirements
Build these modules:
Patient Login
Authenticate existing patients.
Show personal dashboard after login.
Display appointments, treatment history, and notices.
New Patient Login / Registration
Separate entry point from existing patient login.
Collect first name, last name, password, and onboarding details.
Create a new patient record after validation.
Guide the user through initial clinic intake steps.
Medical Personnel Login
Separate login screen and workflow.
Support dentist, assistant, receptionist, and admin views if needed.
Allow access to patient charts, appointments, notes, and administrative tools.
Patient Management
Create, view, edit, and search patient profiles.
Store contact details, visit history, notes, and status.
Support basic medical alerts and treatment references.
Appointments
Schedule, reschedule, and cancel appointments.
Show upcoming appointments by role.
Prevent double-booking.
Assistant
I'll build the Dentismo dental clinic platform. Let me start by planning the architecture, then implement it file by file.
Architecture Plan
Tech Stack: React + TypeScript + Tailwind CSS (within the Vite project)
State Management: React Context + useReducer (no external deps needed)
Data Storage: In-memory with localStorage persistence
Routing: React Router for navigation and role-protected routes
Good. Now let me install react-router-dom and then start creating files. I'll install the package and update the HTML title simultaneously.
Now let me create all the files. I'll start with the types, data, and context files.
1. Types definitions
2. Seed data
3. Auth Context
4. Data Context
5. Protected Route component
6. Navbar component
7. Landing / Login Page
8. Patient Dashboard
9. Patient Appointments Page
10. Patient Treatment History Page
11. Staff Dashboard
12. Staff Patient Management Page
13. Staff Appointments Page
14. Main App with routing
15. Update CSS for global styles
Now let me check the vite config for SPA handling since we're using react-router:
Since we're building as a single file, we need to use HashRouter instead of BrowserRouter to handle routing properly in a static single-file deployment:
Now let's build and test:
The build succeeds. Let me verify the final file structure and do a quick review:
Everything is in place. The project builds successfully. Let me provide a summary:
Patient, New Patient (registration + intake), Medical Staff — all separate flows
5-digit password
Enforced numeric-only, 5-digit password across all roles
Role-based access
patient, new_patient, medical_staff with route guards
Patient Dashboard
Stats cards, upcoming appointments, notices, medical alerts, new patient checklist
Appointment Booking
Patients can book/cancel; staff can create/edit/reschedule/cancel
Double-booking prevention
Validates dentist AND patient slot conflicts
Patient Management
Staff can add/edit/delete patients, search, view full charts with treatment history
10-row capacity
Enforced per role for patients and users
Medical Alerts
Red badges visible to staff and patients
Treatment History
Full table with procedures, costs, dentist, notes
Admin Reset
Admin staff can reset all data to defaults
localStorage persistence
All data survives page refresh, no database needed
Responsive design
Mobile-friendly with adaptive tables and navigation
Demo Credentials
Patients: Maria Garcia ([SECURITY_DATA_1]), James Wilson ([SECURITY_DATA_2]), Sarah Chen ([SECURITY_DATA_3]), Robert Brown ([SECURITY_DATA_4]), Emily Davis ([SECURITY_DATA_5])
Staff: Dr. Ana Martinez ([SECURITY_DATA_6], Dentist), Dr. John Park ([SECURITY_DATA_7], Dentist), Lisa Thompson ([SECURITY_DATA_8], Assistant), Mark Rivera ([SECURITY_DATA_9], Receptionist), Admin User ([SECURITY_DATA_10], Admin)