This repository contains the server-side code for Technika 25. The server is built using Fastify and TypeScript.
POST /accommodation/book: Book new accommodation slots.GET /accommodation/status: Get your accommodation booking status.GET /accommodation/qr: Return the TiQR checksum for the user's accommodation booking.
POST /alumni/register: Make a new registration as an alumni.GET /alumni/status: Get your alumni registration status.GET /alumni/qr: Return the TiQR checksum for the user's alumni booking.
-
POST /delegate/create: Create a new room for group delegate registration. -
POST /delegate/join: Join a group delegate room with the room code. -
DELETE /delegate/leave: Leave the delegate room you are a part of. -
DELETE /delegate/delete: Delete the delegate room you created. -
GET /delegate/status/user: Get your delegate registration status (per user). -
GET /delegate/status/room/:roomId: Get the status of a delegate room by it's room ID.Note: You must be a part of the room to access this endpoint.
-
POST /delegate/register/self: Register a delegate booking for yourself (individual). -
POST /delegate/register/group: Register tickets for all members in your delegate room (group owner exclusive). -
GET /delegate/qr: Return the TiQR checksum for the user's delegate booking.
Note: These are the old endpoints for how we managed delegate bookings previously which is now heavily changed, thus all these endpoints are deprecated but still kept as a part of codebase for legacy support.
-
POST /delegate/book-self: Book delegate tickets for yourself. -
POST /delegate/book-group: Book delegate tickets for a bunch of people. -
GET /delegate/status-self: Get your delegate booking registration status. -
GET /delegate/status-group: Get your delegate group booking registration status. -
DELETE /delegate/group-reset: Reset your group delegate members list.
POST /event/book: Book tickets for any event.GET /event/status/:eventId: Get your booking status for a specific event.GET /events/registered: Get a list of all the event you initiated a registration for. May it be pending or confirmed.GET /event/qr/:eventId: Return the TiQR checksum for the user's event booking.
POST /merch/order: Create a new merch order (a user can create multiple orders).GET /merch/orders: Get all merch orders for the user.GET /merch/status/:id: Get payment status for a specific merch order.
POST /webhook: Webhook endpoint for our payment provider to notify us about the payment status changes.
Note: These endpoints are exclusively for testing purposes and shouldn't be used in production under any circumstances as they are not well written will security in mind.
POST /book/:uid: Book any ticket if you have a ticket ID.GET /book/:uid/status: Get the booking status for the ticket ID you booked for.
Note: These endpoints require you to have a secret header while making a request.
POST /booking: Proxy endpoint to create booking directly via the payment provider.GET /booking/:uid: If you have the booking UID, this endpoint can be used to fetch it's details.
URL: /ws
It's a websocket endpoint which was previously planned to update the client real time for any changes made to the booking status. However, it never made it to production and now it's out of the scope of this project, thus deprecated.
- Fastify: A fast and low-overhead web framework for Node.js.
- TypeScript: A strongly typed programming language that builds on JavaScript.
- Install
Node.js,pnpmandNodemonif you haven't already. - Run
pnpm install - Make a copy of
.env.exampleand rename it to.env. Fill in the required environment variables. - Create a Firebase service account and download the JSON key file. Save it as
serviceAccountKey.jsonin the root directory. - Open two terminal tabs.
- In first tab, run
pnpm run watch:tsto watch for TypeScript changes. - In second tab, run
pnpm run watch:startto start the server in development mode.
- Base URL:
http://localhost:3000 - WebSocket URL:
ws://localhost:3000/ws
The main goal of this project apart from providing backend services for Technika 25 is to learn API development in depth with fastify, get my hands dirty with firebase. Along with this, I also reviewed more of Typescript and better type safety with Zod and error management with Sentry. Summing up with a better understanding of how to structure a backend project.
