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!