This repository contains the common Express.js API for the backends of our Coding Club's websites , backed by PostgreSQL (via Prisma) and Supabase storage. Weβre using Bun as our runtime.
/
βββ prisma/ # Prisma schema and migration files
β βββ schema.prisma
β βββ .env # your DATABASE_URL, etc.
β βββ migrations/ # autoβgenerated by `bun prisma migrate`
β
βββ src/
β βββ config/ # environment/configuration loaders
β β βββ index.ts # loads process.env and exports typed config
β β
β βββ db/ # database client initialization
β β βββ client.ts # `export const prisma = new PrismaClient()`
β β
β βββ routes/ # Express route definitions
β β βββ index.ts # main router that mounts subβrouters
β β βββ members.ts
β β βββ projects.ts
β β βββ achievements.ts
β β βββ topics.ts
β β βββ questions.ts
β β βββ interviews.ts
β β βββ progress.ts
β β
β βββ controllers/ # controllers: take req β call services β send res
β β βββ member.controller.ts
β β βββ project.controller.ts
β β βββ achievement.controller.ts
β β βββ topic.controller.ts
β β βββ question.controller.ts
β β βββ interview.controller.ts
β β βββ progress.controller.ts
β β
β βββ services/ # business logic / Prisma queries
β β βββ member.service.ts
β β βββ project.service.ts
β β βββ achievement.service.ts
β β βββ topic.service.ts
β β βββ question.service.ts
β β βββ interview.service.ts
β β βββ progress.service.ts
β β
β βββ utils/ # shared helpers (e.g. error wrappers, validators)
β β βββ apiError.ts
β β
β βββ app.ts # configure Express app, mount routes, error handler
β βββ server.ts # start HTTP server (calls `app.listen`)
β
βββ tests/ # integration and unit tests (Jest or Mocha)
β βββ members.test.ts
β βββ ...
β
βββ .env.example # template for environment variables
βββ package.json
βββ tsconfig.json # TypeScript configuration
- Install Bun on your machine.
git clone https://github.com/your-org/coding-club-api.git
cd coding-club-apibun install- Copy
.env.exampleto.env - Update
.envwith your Supabase/PostgreSQL connection URL and any other variables:
bun prisma migrate dev --name init
bun prisma generatebun run dev- By default, the server listens on
http://localhost:3000 app.tssets up your Express instance;server.tsstarts the HTTP listener
bun test| Command | Description |
|---|---|
bun run dev |
Start the dev server with hot reloading |
bun prisma migrate dev --name |
Apply migrations in development |
bun prisma generate |
Generate Prisma client |
bun test |
Run tests (Jest or Mocha) |
- Fork the repo
- Create your feature branch (
git checkout -b feature/XYZ) - Commit your changes (
git commit -m "feat: add XYZ") - Push to the branch (
git push origin feature/XYZ) - Open a Pull Request
GNU General Public License v3.0
Happy coding!