A lightweight full-stack ticket tracking application built for the Lodwar Services Mid-Level Full-Stack Developer take-home assessment.
The application provides a REST API and a web interface for creating, viewing, and managing support tickets.
Live Demo: Mini Ticket Tracker
Frontend
- React
- TypeScript
- Vite
Backend
- Node.js
- Express
- TypeScript
- Drizzle ORM
- Zod for request validation
Database
- PostgreSQL (hosted on Neon)
Testing
- Node.js built-in test runner
- Supertest for API integration tests
mini-ticket-tracker/
├── client/ # React frontend
│ ├── src/
│ │ ├── components/ # Dashboard and UI components
│ │ ├── services/ticketApi.ts # API requests
│ │ ├── types/ticket.ts # Frontend ticket types
│ │ └── App.tsx # Main application
│ ├── package.json
│ └── vite.config.ts
│
├── server/ # Express backend
│ ├── src/
│ │ ├── db/
│ │ │ ├── index.ts # PostgreSQL connection and Drizzle instance
│ │ │ └── schema.ts # Drizzle database table definitions
│ │ ├── models/
│ │ │ └── ticket.ts # Types inferred from the Drizzle schema
│ │ ├── schemas/
│ │ │ └── ticketSchema.ts # Zod request validation schemas
│ │ ├── routes/
│ │ │ └── ticketRoute.ts # Ticket API route definitions
│ │ ├── controllers/
│ │ │ └── ticketController.ts # HTTP request and response handling
│ │ ├── services/
│ │ │ └── ticketService.ts # Ticket operations and database queries
│ │ ├── middleware/
│ │ │ └── validate.ts # Reusable request body validation
│ │ ├── app.ts # Express configuration and route registration
│ │ └── server.ts # HTTP server entry point
│ │
│ ├── drizzle/ # Database migration files
│ ├── tests/ # API integration tests
│ ├── drizzle.config.ts # Drizzle Kit configuration
│ ├── tsconfig.json # TypeScript compiler configuration
│ ├── package.json # Backend dependencies and scripts
│ └── .env.example # Example environment configuration
│
├── .gitignore
└── README.md
The backend follows a layered structure to separate HTTP handling, validation, application logic, and database access.
- Routes: Map HTTP methods and URL paths to controllers and middleware.
- Middleware: Handles reusable request processing, including request body validation.
- Controllers: Validate incoming parameters where required, invoke services, and return HTTP responses.
- Services: Implement ticket operations and execute database queries through Drizzle ORM.
- Schemas: Define request validation rules using Zod.
- Database: PostgreSQL stores ticket records, while Drizzle defines the schema and provides type-safe database operations.
The Express application is exported separately from the HTTP server entry point. This allows the API to be tested with Supertest without starting a separate listening server.
Each ticket contains the following fields:
| Field | Description |
|---|---|
id |
Automatically generated primary key |
title |
Required ticket title, up to 200 characters |
description |
Optional ticket description |
status |
open, in_progress, or closed |
priority |
low, medium, or high |
created_at |
Database timestamp generated when the ticket is created |
New tickets default to open status and medium priority unless other valid values are provided.
The database uses indexes to support ticket listing and status-filtering query patterns.
- Node.js and npm
- PostgreSQL
- Git
git clone <repository-url>
cd mini-ticket-trackerReplace <repository-url> with the actual repository URL.
Create a PostgreSQL database named ticket_tracker:
CREATE DATABASE ticket_tracker;Navigate to the server directory and install dependencies:
cd server
npm installCreate a .env file using .env.example as a reference.
Example configuration:
PORT=3000
DATABASE_URL=postgresql://postgres:YOUR_PASSWORD@localhost:5432/ticket_tracker
CLIENT_URL=http://localhost:5173Replace the database credentials with your local PostgreSQL configuration.
Do not commit your .env file to version control.
From the server directory:
npm run db:migrateThis applies the existing migration files to the configured database.
When the database schema changes during development, generate a migration using:
npm run db:generateReview the generated migration before applying it.
From the server directory:
npm run devThe API runs at http://localhost:3000 by default.
A health-check endpoint is available at:
GET /healthExpected response:
{
"status": "ok"
}Open a second terminal:
cd client
npm install
npm run devVite displays the local URL where the frontend is available.
The application is deployed using Vercel, Render, and Neon.
Frontend: https://mini-ticket-tracker.vercel.app/
Backend: Hosted on Render.
Database: PostgreSQL hosted on Neon.
All ticket endpoints are prefixed with /tickets.
POST /tickets
Creates a new ticket.
Example request:
{
"title": "Unable to log in",
"description": "The user receives an authentication error.",
"priority": "high"
}The status and priority fields are optional. If omitted, the database defaults are applied.
Success response: 201 Created
The response contains the created ticket, including its generated ID and creation timestamp.
GET /tickets
Returns a paginated list of tickets, ordered by creation time with the newest tickets first.
Supported query parameters:
| Parameter | Description | Default |
|---|---|---|
status |
Filter by open, in_progress, or closed |
No filter |
page |
Page number, starting at 1 | 1 |
limit |
Number of tickets per page, from 1 to 100 | 10 |
Example requests:
GET /tickets
GET /tickets?status=open
GET /tickets?page=2&limit=5
GET /tickets?status=in_progress&page=1&limit=10Example response:
{
"data": [
{
"id": 1,
"title": "Unable to log in",
"description": "The user receives an authentication error.",
"status": "open",
"priority": "high",
"createdAt": "2026-10-11T09:00:00.000Z"
}
],
"pagination": {
"page": 1,
"limit": 10,
"total": 1,
"totalPages": 1
}
}The example data is illustrative. The actual response depends on the database contents.
Invalid status values and invalid pagination parameters return 400 Bad Request.
PATCH /tickets/:id
Updates a ticket's status, priority, or both.
Example request:
PATCH /tickets/1
Content-Type: application/json{
"status": "in_progress",
"priority": "high"
}Only status and priority can be updated through this endpoint.
Possible responses:
200 OK— ticket updated successfully.400 Bad Request— invalid ticket ID, invalid field values, empty body, or unsupported fields.404 Not Found— ticket does not exist.
GET /tickets/stats
Returns ticket counts grouped by status.
Example response:
{
"open": 8,
"in_progress": 3,
"closed": 2
}All three statuses are included, even when a status has no tickets.
Interactive API documentation is available through Postman:
View Mini Ticket Tracker API Documentation
The documentation provides a reference for the available endpoints, request parameters, request bodies, and expected responses.
The backend uses Node.js's built-in test runner and Supertest for integration testing.
Run the tests from the server directory:
npm testThe current suite has 27 passing tests.
Test coverage includes:
- Ticket creation and successful responses.
- Request validation and invalid input.
- Listing tickets and status filtering.
- Pagination behaviour and parameter validation.
- Updating ticket status and priority.
- Handling nonexistent tickets and invalid IDs.
- Ticket statistics grouped by status.
The tests exercise the Express application and PostgreSQL database. They create test records and clean them up after the test suite completes.
Run the tests against a dedicated development or test database, never a production database.
-
Drizzle ORM: Chosen for its TypeScript support and SQL-like query building, providing type safety without hiding too much of the underlying SQL.
-
Zod Validation: Used to validate incoming request data at the API boundary, ensuring invalid inputs are rejected before reaching the database.
-
Layered Architecture: Separating routes, controllers, services, and database access improves maintainability and testability, with a small amount of additional structure.
-
Database Indexing: Indexes support common filtering and sorting operations, trading additional storage and write overhead for improved query performance.
-
Pagination: Offset-based pagination keeps the API simple and supports page navigation. Cursor-based pagination could be considered as the dataset grows and deep pagination becomes less efficient.
-
Database-Side Aggregation: Ticket statistics are calculated in PostgreSQL rather than fetching all tickets into the application, reducing data transfer and application-side processing.
- Expand test coverage for edge cases and concurrent requests.
- Evaluate query performance as the dataset grows.
- Add configurable sorting and consider cursor-based pagination if needed.
- Introduce structured logging and monitoring for production observability.