A RESTful backend service for managing online learning sessions and tracking course performance. Built with Node.js, TypeScript, Express, and TypeORM.
CourseTrack provides role-based access for admins and standard users. Admins can create courses and view analytics across all sessions, users, and courses. Users can start, update, and end their own learning sessions, log module results, and view personal performance stats.
- Runtime: Node.js
- Language: TypeScript
- Framework: Express
- ORM: TypeORM
- Database: PostgreSQL
- Testing: Jest
- Containerisation: Docker & Docker Compose
- Node.js
- Docker & Docker Compose
# Clone the repository
git clone https://github.com/JakeHornerMan/CourseTrack.git
# Install dependencies
npm install
# Start the database and application
docker-compose up
# Run tests
npm testA Postman collection is included in the repo for testing all endpoints. Import CourseTrack.postman_collection.json into Postman to get started.
| Method | Endpoint | Description |
|---|---|---|
| POST | /auth/register |
Register a new user with a role (admin or user) |
| POST | /auth/login |
Log in and receive a JWT token for authorised requests |
Register — POST /auth/register
{
"username": "jakehorner",
"email": "jake@example.com",
"password": "securePassword123",
"role": "admin"
}Login — POST /auth/login
{
"username": "jakehorner",
"password": "securePassword123"
}Returns a JWT token to be used as a Bearer Token in subsequent requests.
All admin endpoints require an authenticated user with the admin role.
| Method | Endpoint | Description |
|---|---|---|
| GET | /stats/sessions/:sessionId |
Get all data for a specific session |
| GET | /stats/courses/:courseId |
Get aggregated stats for a course (modules studied, total duration, scores) |
| GET | /stats/courses/:courseId/sessions/:sessionId |
Get stats for a specific session within a course |
Example Response — GET /stats/courses/:courseId
{
"moduleAmount": {
"totalModulesStudied": 5,
"moduleNames": ["Module 1", "Module 2", "Module 3"]
},
"sessionTime": {
"totalDuration": "2 hours 30 minutes",
"timeInMinutes": 150
},
"scores": {
"totalSessionPoints": 397,
"overallAverageScore": 39.7
}
}All user endpoints require an authenticated user. Data is scoped to the logged-in user.
| Method | Endpoint | Description |
|---|---|---|
| POST | /session/startSession |
Start a new learning session for a course |
| PUT | /session/updateSession |
Update a session with module results (adaptive and quiz scores) |
| POST | /session/endSession |
End an active learning session |
Start Session — POST /session/startSession
{
"courseIdentifier": "9e263811-0cfb-45f0-a0f9-c155c916dfed",
"topic": "Geometry"
}{
"message": "Session started successfully",
"sessionId": "d0a99f23-c8f0-4fc3-9d99-665618d545ae"
}Update Session — PUT /session/updateSession
{
"sessionId": "d0a99f23-c8f0-4fc3-9d99-665618d545ae",
"moduleStats": [
{
"moduleName": "Module 1",
"adaptive": { "answers": ["A", "B"], "isCompleted": false, "score": 10 },
"quiz": { "answers": ["A", "B"], "isCompleted": false, "score": 20 }
},
{
"moduleName": "Module 2",
"quiz": { "answers": ["A", "B"], "isCompleted": false, "score": 10 }
},
{
"moduleName": "Module 3",
"adaptive": { "answers": ["A", "B"], "isCompleted": false, "score": 40 },
"quiz": { "answers": ["A", "B"], "isCompleted": false, "score": 2 }
}
]
}End Session — POST /session/endSession
{
"sessionId": "d0a99f23-c8f0-4fc3-9d99-665618d545ae"
}| Method | Endpoint | Description |
|---|---|---|
| GET | /stats/user/sessions |
Get all sessions for the logged-in user |
| GET | /stats/courses/:courseId |
Get course stats scoped to the logged-in user |
| GET | /stats/user/courses/:courseId/sessions/:sessionId |
Get stats for a specific session within a course for the logged-in user |
Stats responses follow the same format as the admin endpoints, scoped to the authenticated user's data.
src/
├── auth/ # Authentication and authorisation (JWT, role guards)
├── courses/ # Course creation and management
├── sessions/ # Session lifecycle (start, update, end)
├── stats/ # Aggregated stats for courses, sessions, and users
├── modules/ # Module result tracking (adaptive, quiz)
└── config/ # Database and application configuration
This project is licensed under the Unlicense — see the LICENSE file for details.