Official API for Throwdown, in other words this single repository makes the business run. https://api.throwdown.live/openapi
  • TypeScript 99.9%
  • Dockerfile 0.1%
Find a file
Mikkel ALMONTE--RINGAUD 490e7d37e4
All checks were successful
Deploy / deploy (push) Successful in 17s
chore: linter
2026-04-12 15:57:02 +02:00
.forgejo/workflows perf(ci): build and replace instead of down 2026-03-12 15:31:31 +01:00
.vscode chore(vscode): add i18n configuration 2026-03-31 19:06:16 +02:00
.yaak chore: update documentation 2026-04-10 18:56:59 +02:00
scripts feat: wip planning 2026-04-12 15:56:53 +02:00
src chore: linter 2026-04-12 15:57:02 +02:00
.env.example chore: remove useless env var 2026-03-27 09:22:42 +01:00
.gitignore chore: easy switch between dev and prod 2026-03-27 09:33:10 +01:00
bun.lock feat: add locale to user type 2026-03-27 00:33:09 +01:00
compose.yaml chore: update exposed port 2026-03-11 21:57:08 +01:00
Dockerfile chore: hello docker 2026-03-11 21:46:46 +01:00
drizzle.config.ts refactor: consolidate drizzle into a single configuration file 2026-04-07 19:54:52 +02:00
package.json refactor: consolidate drizzle into a single configuration file 2026-04-07 19:54:52 +02:00
README.md refactor: consolidate drizzle into a single configuration file 2026-04-07 19:54:52 +02:00
tsconfig.json refactor: consolidate drizzle into a single configuration file 2026-04-07 19:54:52 +02:00

API

Contribute?

Let's start with cloning the repository and install dependencies with Bun.

bun install

You have a few variables to setup, cp .env.example .env.dev and fill them.

bun dev

You can also store the production variables in .env.prod and use the following command to run with those variables.

bun dev:prod

Forwarding Stripe

You have to set the STRIPE_WEBHOOK_KEY variable in order to process payments locally.

You'll need the Stripe CLI in order to do this, the following commands are how you setup the forward.

stripe login
stripe listen --events payment_intent.succeeded --forward-to http://localhost:3000/throwdown/pay/receive

Production

CI/CD

We use a Forgejo workflow to automatically update and run the API in our production VPS with Docker. You can find more information about it in the deploy.yml workflow.

PRIVATE_KEY variable was generated using the following commands.

ssh-keygen -t ed25519 -f ~/.ssh/deploy -N ""
cat ~/.ssh/deploy.pub >> ~/.ssh/authorized_keys
base64 -w 0 ~/.ssh/deploy # put this in `PRIVATE_KEY` variable!

Stripe

Webhook Name Events URL
Throwdown.PayReceive payment_intent.succeeded https://api.throwdown.live/throwdown/pay/receive

Caddy

We're running the API behind a Cloudflare proxy to use the IP Geolocation feature.

api.throwdown.live {
	reverse_proxy 127.0.0.1:6000 {
    header_up X-Forwarded-For {remote_host}
  }
}

Migrations

Anytime an update is done in the database schema, migrations should be generated with the following command.

bun migration:gen

When you think you're done and the migration looks good, you can apply them to either development or production database.

bun migration:push
bun migration:push:prod # uses .env.prod