This repository contains the code-base to the LIVE leaderboard for ACM@Amrita Winter of Code (season 1).
- The application is written in Next.js on top of TypeScript. The framework was chosen as it happened to be the most comfortable one at the disposal of the developers at that time of writing.
- We use a PostgreSQL database hosted on NeonDB for quick setup and serverless hosting. The database automatically scaled down to an IDLE or sleep state with 5 minutes of inactivity. This allows us to save up on our bills.
- Interestingly, you can run a 0.25vCPU Neon Serverless Postgres instance for every month, absolutely free of cost. (191 hours)
- In order to interact with the database, we have written our schema in Prisma which is an ORM that integrates easily with SQL and manages connection pooling by itself. It also allows us to write type-safe queries without the fear of common vulnerabilites like SQL-injection.
Note
This repository does not have any POST/ endpoint and only serves the
leaderboard and the individual profile. Data mutations in the database take
place through separate functions which are deployed on Cloudflare Workers.
That repository has been kept private for security reasons.
- Fork and clone your fork of the repository
- Use
pnpmto install all thenode_modules - Provision a PostgreSQL database, either from Docker or Neon.
- Setup the
.envfile by copying the.env.exampleand populating the required credentials. - Run the project with
pnpm dev
Tip
Do setup the NODE_ENVIRONMENT variable to Development so that the database
seeding can take place from prisma/seed.ts. You can add further records into
the seeds for testing purposes but do not commit it upstream.
- Write descriptive git commit messages.
- Write descriptions in pull requests for quicker merging.
For any queries, please reach out to us at our socials or through email.