A full-stack road test appointment system built with Node.js, Express, EJS, and MongoDB Atlas. It provides secure, role-aware workflows for drivers, examiners, and administrators from account creation through test results and licence issuance.
Current release: v1.1.0 · View the changelog
- Create an account and securely log in.
- Change a password or recover an account with a one-time recovery code.
- Enter and update personal, licence, and vehicle information.
- See profile-completion progress and test eligibility guidance.
- View appointment dates and available appointment times.
- Book G2 and G road tests.
- Cancel or reschedule a pending appointment.
- Keep profile updates separate from appointment booking.
- View appointment history, examiner comments, and pass/fail results.
- Book a G road test after qualifying for G2.
- Access an examiner-only dashboard.
- View pending G2 or G appointments in searchable, sortable, responsive tables.
- Review driver and vehicle details.
- Add an examiner comment.
- Record pass or fail results once while preserving assessment history.
- Access admin-only pages.
- Create and review grouped appointment times from 9:00 AM to 2:00 PM.
- Prevent duplicate appointment times for the same date.
- See available, booked, completed, passed, and failed totals.
- Review driver test results.
- Generate licence-issue requests for successful drivers.
- Shared page headers, workspace introductions, status states, and driver appointment layouts.
- Responsive navigation, forms, controls, appointment cards, and staff tables.
- Visible keyboard focus, semantic landmarks, labelled controls, live status messages, and accessible contrast.
- Phone, tablet, desktop, zoom, overflow, and layout-shift checks across public and role-protected pages.
- Node.js
- Express.js
- EJS
- MongoDB Atlas
- Mongoose
- Express Session with MongoDB session storage
- Helmet, login rate limiting, and CSRF protection
- Node.js
cryptowith scrypt password hashing and AES-256-GCM licence encryption - Node.js built-in test runner
- Bootstrap
| Stage | Development completed |
|---|---|
| Assignment 1 | Express routing, EJS layouts, dashboard, login, G2, and G pages |
| Assignment 2 | MongoDB model, driver data creation, retrieval, and vehicle updates |
| Assignment 3 | MVC structure, registration, authentication, sessions, role protection, and licence encryption |
| Assignment 4 | Admin appointment creation, duplicate prevention, and driver booking |
| Group Project | Examiner workflow, filtering, comments, pass/fail results, driver result display, and admin reporting |
- Node.js 20 or newer
- npm
- A MongoDB Atlas cluster
-
Clone the repository and open the project folder:
cd DriveTest
-
Install dependencies:
npm install
-
Copy
.env.exampleto.env:Copy-Item .env.example .env -
Configure
.env:MONGODB_URI=mongodb+srv://<username>:<password>@<cluster-address>/driving_test?retryWrites=true&w=majority SESSION_SECRET=<long-random-secret> LICENSE_ENCRYPTION_KEY=<different-long-random-secret> PORT=4000
-
In MongoDB Atlas, add your current IP address under Network Access and ensure the database user has read/write permission.
-
Start the application:
npm start
-
Open http://localhost:4000.
Do not change LICENSE_ENCRYPTION_KEY after licence data has been saved, or existing encrypted licence numbers cannot be decrypted.
npm start # Start the application
npm run dev # Start with automatic restarts
npm test # Run the automated test suiteThe automated checks cover:
- Authentication, role authorization, account recovery, and password changes
- Password hashing, licence encryption, secure headers, rate limiting, and CSRF protection
- Driver validation, profile updates, booking conflicts, cancellation, and rescheduling
- Examiner result handling and administrator dashboard totals
- Shared page patterns, responsive CSS, touch targets, duplicate IDs, navigation, forms, and every EJS view
The current suite contains 42 automated tests. Final browser smoke checks also cover the public experience and all three authenticated roles.
Run the checks with:
npm testDriveTest/
|-- controllers/ Request handlers and application workflows
|-- middleware/ Authentication and role authorization
|-- models/ Mongoose schemas
|-- public/ CSS, JavaScript, and images
|-- test/ Built-in Node.js tests
|-- utils/ Password hashing and licence encryption
|-- views/ EJS pages and shared layouts
|-- .env.example Environment-variable template
|-- CHANGELOG.md Version history and release notes
|-- package.json Dependencies and npm commands
|-- server.js Express application entry point
`-- README.md
Mongoose creates these collections as application data is saved:
useraccountsappointmentsbookedtimeslotssessions
- Passwords are salted and hashed with Node.js scrypt.
- Licence numbers are encrypted with AES-256-GCM.
- Sessions are stored in MongoDB so authenticated sessions survive server restarts.
- Session cookies are HTTP-only and use
SameSite=Lax. - Login attempts are rate-limited and responses include Helmet security headers.
- State-changing requests require a session-bound CSRF token.
- Password changes require the current password; one-time recovery codes support account recovery without storing email addresses.
- Driver, examiner, and administrator routes use role-based middleware.
- Public registration always creates a driver account; staff roles must be provisioned directly by a database administrator.
.envandnode_modulesare excluded from Git.
v1.1.0— responsive design, accessibility, clearer workflows, and expanded rendering testsv1.0.0— consolidated full-stack assignment and group-project release
Stop the existing Node process or change PORT in .env to another port such as 4001.
- Confirm the Atlas URI and database credentials.
- Add your current IP address to Atlas Network Access.
- Verify the Atlas cluster is running.
- URL-encode special characters in the database password.