This is the backend API for the AFCON Challenge project. It is built using Bun, Elysia, Prisma, and PostgreSQL.
Clone the repo:
git clone https://github.com/afcon-challenge/backend
You need to have Docker installed.
Note
You'll need to change the domain in the Caddyfile to your domain name.
Then you can run the following commands:
cp .env.example .env # To create a .env file
docker compose up -d # To get everything up and running
docker compose exec api bunx prisma migrate deploy # Run the database migration
Also, check useful commands in production.
You need to have Bun installed.
cp .env.example .env # To create a .env file
bun i # To install dependencies
bun start # To start the server
bun dev # To start the development server
Check logs in real-time:
docker compose logs -f
Check logs of some service, api for example:
docker compose logs api -f
Rebuild:
docker compose up --build -d
Connect to the database using psql (mydb
is the database used by the api):
docker compose exec db psql -U judge0 -d mydb
Execute some SQL statement without connection:
docker compose exec db psql -U judge0 -d mydb -c 'SELECT username, verdict, "createdAt" FROM "Submission" ORDER BY "createdAt" DESC;'