Skip to content

About

Event registration for a career orientation project in Dresden, in use since 2025: four languages, admin area, newsletters and reviews. SvelteKit on Cloudflare Workers, D1 and R2.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

80 Commits

Folders and files

Repository files navigation

Berufsorientierung App

Event registration for the career orientation project of Kinder- und Elternzentrum Kolibri e.V. in Dresden, which works with young people with a migration background. Participants sign up for workshops, company visits and open days; the project team runs events, registrations, newsletters and reviews from an admin area. The site has been in use since late 2025 and is available in German, English, Russian and Ukrainian.

Start page Event list
Start page with upcoming events Event list with free places

Screenshots from a local instance with invented events and participants.

Features

  • Event pages with registration deadlines, optional capacity limits and extra registration questions per event.
  • Participant accounts with profile, password reset, photo and parental consent, guardian details for minors, and self-service account deletion.
  • Admin area for events, users, registrations, newsletters, moderated reviews and an activity log, with JSON import/export of events and CSV exports of registrations and activity.
  • Event posters and QR codes for the event's Telegram and WhatsApp groups, stored in R2.
  • JWT sessions, bcrypt password hashing, CSRF checks and Cloudflare Turnstile on public forms.
  • Scheduled jobs (src/worker.ts) that delete accounts after the retention period and process registration deadlines, plus a protected HTTP cron endpoint.

Stack

Svelte 5 and SvelteKit 2, TypeScript, Tailwind CSS, Cloudflare Workers, D1 (SQLite) and R2. Zod for validation, jose for JWT, bcryptjs, qrcode and svelte-i18n. Email goes through Resend or MailChannels. Tests use Vitest.

Running it locally

You need Node.js 22.12 or later. No Cloudflare account is required for local development.

[ -e wrangler.toml ] || cp wrangler.example.toml wrangler.toml
[ -e .dev.vars ] || cp .env.example .dev.vars
npm ci
npx wrangler d1 migrations apply DB --local
npm run dev:seed
npm run dev -- --host 127.0.0.1

npm run dev:seed fills the local database with invented test data (accounts, events, registrations, reviews); it deletes all existing local rows first. Test accounts and the shared password are listed at the top of scripts/dev-seed.sql.

The first two lines create local configuration only if it doesn't exist yet, so an existing setup is never overwritten. In PowerShell use:

if (-not (Test-Path -LiteralPath wrangler.toml)) {
    Copy-Item -LiteralPath wrangler.example.toml -Destination wrangler.toml
}
if (-not (Test-Path -LiteralPath .dev.vars)) {
    Copy-Item -LiteralPath .env.example -Destination .dev.vars
}

Before the first start, replace the JWT and cron placeholders in .dev.vars with random values, for example from:

node -e "console.log(require('node:crypto').randomBytes(32).toString('hex'))"

Then open the URL that Vite prints, usually http://127.0.0.1:5173.

A few things to know about the local setup:

  • Secrets live in .dev.vars, which Wrangler passes to the app as platform.env (Cloudflare docs). A plain .env is not read. Keep .dev.vars private.
  • Configuration. wrangler.example.toml has a placeholder D1 ID and example R2 bucket names. Your working copy wrangler.toml is ignored by Git, and the dev, build and deploy commands read it. Keep it when you pull new code.
  • Database. The --local migration applies the migrations to local state in .wrangler/ and never touches a remote database (D1 local development). Schema migrations belong in Git; database exports and participant data never do.
  • Turnstile. The template uses Cloudflare's test keys, which always pass. Form submissions still call Turnstile's verification service.
  • Email is configured for Resend with an empty API key, so nothing is sent; password reset, notifications and newsletters need a real provider. There is no mock mode.
  • Uploads go to local R2 storage. The example R2_PUBLIC_URL doesn't serve them, so posters won't display without a separately configured bucket or domain.
  • First admin. A fresh database has no administrator. Register a test account, then add its user ID to the local admins table; after that, admins can promote other users in the app. Never import production users as seed data.

Configuration

Setting Purpose
DB, R2_BUCKET, ASSETS Wrangler bindings for the database, uploads and built assets
JWT_SECRET Signs login tokens; set a private random value
CRON_SECRET Protects the HTTP cron endpoint
TURNSTILE_SITE_KEY, TURNSTILE_SECRET_KEY Turnstile key pair; the local example uses test keys
EMAIL_PROVIDER, EMAIL_FROM, EMAIL_REPLY_TO Email provider and sender
RESEND_API_KEY Needed when sending through Resend
DKIM_DOMAIN, DKIM_SELECTOR, DKIM_PRIVATE_KEY Optional MailChannels signing
EMAIL_BULK_CHUNK, EMAIL_BULK_PAUSE_MS Newsletter batch size and pause
R2_PUBLIC_URL Public base URL for uploaded files

D1 is configured through the DB binding in wrangler.toml; there is no DATABASE_ID variable. The repository contains no production IDs, keys or credentials.

Checks

npm run check
npm run lint
npm test
npm run build

npm run check checks the application sources through scripts/check-src.mjs. The Vitest suite runs against an in-memory D1 mock (tests/setup.ts), so it covers application logic but not real SQLite, browser or Cloudflare behaviour. Single files can be run with npm test -- tests/unit/auth.test.ts.

Known issue: after the Vite build, scripts/inject-cron.js adds an import of ../../src/worker.ts to .svelte-kit/cloudflare/_worker.js. That path resolves to .svelte-kit/src/worker.ts, which doesn't exist, so a successful build doesn't prove that the scheduled jobs are bundled. Check this before deploying a new build.

Deployment

npm run deploy builds the app and runs wrangler deploy, which replaces the live Worker. It needs a Cloudflare account with real D1 and R2 bindings, private secrets, a verified email sender, production Turnstile keys and a public storage URL. The example configuration is for local development and must not be deployed as is.

The daily cron (0 2 * * *, UTC) in wrangler.example.toml deletes accounts whose retention period has ended. Check the retention settings before enabling it on real data. Deployment and Cloudflare setup are described in docs/development/DEPLOYMENT.md.

Project layout

  • src/routes/ pages, server loaders and API endpoints
  • src/lib/server/ authentication, database access, middleware, email and storage
  • src/worker.ts scheduled jobs
  • migrations/ D1 schema migrations
  • tests/ Vitest unit and integration tests
  • static/ translations and public assets
  • docs/ architecture, feature and database notes (mostly Russian), and the operator guide

docs/ARCHITECTURE.md is the best starting point in the code; docs/README.md indexes the rest. Some older guides describe the first deployment and may be out of date.

How it's built

Developed by Dr. Konstantin S. Shakun with AI coding agents. I defined the requirements, the data model, the privacy rules and the admin workflows, broke the work into small tasks and tested each one before release; the agents wrote most of the code.

License

The app belongs to Kinder- und Elternzentrum Kolibri e.V. Dresden. Non-commercial educational and social projects can use it with written permission; commercial use also needs permission. See LICENSE for the terms and the required attribution.

About

Event registration for a career orientation project in Dresden, in use since 2025: four languages, admin area, newsletters and reviews. SvelteKit on Cloudflare Workers, D1 and R2.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages