Tech Stack & Setup
This page describes the technology stack and setup instructions for the Gami API.
Technology Stack
| Component | Technology |
|---|---|
| Runtime | Node.js (TypeScript) |
| Framework | Fastify |
| Database | PostgreSQL |
| ORM | Prisma |
| Validation | Zod |
| Documentation | Swagger / OpenAPI |
| Containerization | Docker & Docker Compose |
Prerequisites
- Node.js v18+
- Docker & Docker Compose
Environment Variables
Create a .env file in the root directory:
env
DATABASE_URL="postgresql://user:password@localhost:5432/gamibot?schema=public"Installation
Docker (Recommended)
Start both the API and PostgreSQL database:
bash
docker-compose up -d --buildThe API will be available at http://localhost:3000.
Local Development
Install Dependencies:
bashnpm installRun Migrations:
bashnpx prisma generate npx prisma migrate devStart Server:
bashnpm run dev
Testing
The project uses Vitest for integration testing:
bash
npm testTest Suites
| Suite | Coverage |
|---|---|
| XP Tests | XP awarded correctly based on quiz scores |
| Topic Tests | Topic progress calculated accurately |
| Badge Tests | All badges awarded when conditions are met |
| Stats Tests | User statistics aggregation and initialization |
Next Steps
- API Reference - Authentication and endpoints
- Gami API Overview - Features overview