- TypeScript 66.4%
- Astro 19.6%
- JavaScript 10.2%
- SCSS 3.3%
- Dockerfile 0.5%
bitborg-web
The public web portal for bitborg (a Swedish, self-hosted Forgejo git service). Served at
https://www.bitborg.se; the Forgejo app itself lives at https://git.bitborg.se.
It provides:
- Marketing + legal pages — landing, Terms of Service, Privacy Policy, plus the signed-in
account panel, checkout and the withdrawal form. Swedish by
default at
/, English under/en/, with a manual language switcher. The browser'sAccept-Languageis not used. - Open sign-up — creates a participant account (a way to take part in others' projects;
hosting comes with the paid account) by creating a user in Keycloak; the Forgejo
account is created on first OIDC login (Forgejo's own public registration stays disabled).
Gated by a self-hosted proof-of-work captcha and a
SIGNUPS_OPENkill switch (ADR 0029). - Transactional email — sign-up welcome, sent via Sweego's HTTP
API in the recipient's language. Every message is From
no-reply@email.bitborg.se(fixed insrc/lib/email.ts); content lives insrc/i18n/emails.ts. SetSWEEGO_API_KEYto enable; unset, the handlers degrade gracefully and send nothing.
Built with Astro (Node adapter, server output) + TypeScript + Drizzle (PostgreSQL).
Deployed as a container by bitborg-infra behind Caddy.
Why Astro (not SvelteKit/Next): content-first site with a few server actions, FOSS, and not tied to a single hosting vendor. See ADR 0010 and 0011 in bitborg-docs.
Develop
Local SSL is necessary for running the local development server.
We suggest using mkcert for this.
cp .env.example .env # fill DATABASE_URL, KEYCLOAK_*, OIDC_*
mkcert -install # Install CA trust
mkcert localhost # Generate certificate files
pnpm install
pnpm dev # https://localhost:4321
Useful scripts: pnpm check (astro/type check), pnpm build (standalone server into
dist/), pnpm db:generate / pnpm db:migrate (Drizzle).
Testing
pnpm test runs the Vitest unit suite. pnpm test:e2e runs the Playwright end-to-end suite
(src/test/e2e/) against a built copy of the site on chromium, webkit and mobile-safari;
add E2E_FULL_MATRIX=true to also run firefox. pnpm test:e2e:ui opens Playwright's UI mode;
pnpm test:e2e:report opens the last HTML report.
Layout
| Path | Purpose |
|---|---|
src/pages/ |
sv pages at /, English under /en/; api/ server endpoints |
src/layouts/Base.astro, Legal.astro |
shared shell; Legal wraps Markdown pages |
src/i18n/ui.ts |
UI string dictionaries (sv/en) + useTranslations helper |
src/content/{sv,en}/ |
long-form ToS/privacy copy (Markdown, per language) |
src/lib/keycloak.ts |
Keycloak admin API client (user provisioning) |
src/lib/email.ts, src/i18n/emails.ts |
Sweego email sender + localized email content (sv/en) |
scripts/migrate.mjs, drizzle/ |
runtime migrator + generated SQL migrations |
src/lib/db.ts, src/db/schema.ts |
Drizzle client + schema (invite_codes, signups, checkout_consents, withdrawal_requests, renewal_reminders) |
Configuration
Main environment variables (see .env.example): PUBLIC_SITE_URL, PUBLIC_GIT_APP_URL, DATABASE_URL,
SIGNUPS_OPEN, PAYMENTS_ENABLED, BILLING_API_URL, BILLING_API_TOKEN (billing service; an
unset URL hides the withdrawal section), BILLING_SELL_COUNTRIES, CAP_SECRET, SWEEGO_API_KEY
(email; blank disables sending), EMAIL_FROM_ADDRESS, OIDC_ISSUER, OIDC_CLIENT_ID,
OIDC_CLIENT_SECRET, OIDC_REDIRECT_URI, PUBLIC_AUTH_URL, SESSION_SECRET, KEYCLOAK_URL,
KEYCLOAK_REALM, KEYCLOAK_ADMIN_CLIENT_ID, KEYCLOAK_ADMIN_CLIENT_SECRET, SITE_NAME, HOST
and PORT. Secrets are never committed; in production they come from podman secrets
via bitborg-infra.