This repository contains the backend system for UKHSC, built using TypeScript.
This backend system is designed to handle the core functionalities of UKHSC, utilizing modern web technologies to ensure efficient and scalable operations.
- Node.js: Backend server environment.
- TypeScript: Ensures type safety and better maintainability.
- Prisma: Database ORM for type-safe database access.
- Hono: Web framework for building API endpoints.
- Zod: Type-safe schema validation.
To get started with the UKHSC System Backend, follow these steps:
- Clone the Repository: Clone this project to your local machine.
git clone https://github.com/ukhsc/ukhsc-system-backend.git
- Install Dependencies: Navigate to the project directory and install the necessary dependencies with
pnpm.pnpm install
- Setup Environment Variables: Create a
.envfile in the root directory and add the required environment variables. - Run Migrations: Apply database migrations.
pnpm run migrate
- Seed the Database: Seed the database with initial data.
pnpm run seed
- Start the Development Server: Start the local development server.
pnpm run dev
The project is organized as follows:
- src/index.ts: Main router definition.
- src/endpoints/: Each API endpoint has its own file in this directory.
- prisma/: Contains Prisma schema and migration files.
- scripts/: Contains utility scripts.
The architecture of the UKHSC System Backend is designed to be modular and scalable. Key components include:
- API Gateway: Manages incoming requests and routes them to appropriate services.
- Service Layer: Contains the business logic and interacts with the database via Prisma.
- Database: A relational database managed by Prisma for data persistence.
- Validation Layer: Uses Zod for schema validation to ensure data integrity and type safety.
To start a local instance of the API for development:
- Run Development Server: Start the local server.
pnpm dev
- Access API: Open
http://localhost:8787/in your browser to access the API.
Run the test suite using the following command:
pnpm testContributions are welcome! Please fork the repository and submit pull requests.
For more information, visit the project homepage.