No description
  • TypeScript 55.5%
  • Go 32.1%
  • CSS 10.7%
  • Go Template 1.1%
  • Dockerfile 0.4%
  • Other 0.2%
Find a file
Jonas Leder 7ffa2ffe5b
All checks were successful
ci / build-1 (push) Successful in 1m25s
ci / frontend-docker (push) Successful in 0s
ci / build (push) Successful in 2m22s
ci / backend-docker (push) Successful in 0s
ci / build-2 (push) Successful in 33s
ci / chart (push) Successful in 0s
CI: port GitLab pipeline to Forgejo Actions
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-18 09:26:49 +01:00
.forgejo/workflows CI: port GitLab pipeline to Forgejo Actions 2026-11-18 09:26:49 +01:00
backend R_PE limit for cables above 1.5 mm2 (new formula); class III test voltage back to 500 V 2026-11-12 16:59:05 +01:00
deploy/helm/timetracker Backend NetworkPolicy: open on its port like the frontend 2026-11-05 21:52:27 +01:00
frontend Clone device: prefill add-device form from detail page 2026-11-15 12:37:40 +01:00
.gitignore Generate swagger API docs and ignore build output 2026-11-02 20:21:31 +01:00
README.md Heating power limits, touch current 0.5 mA, class III 250 V, VDE 0701 label for repair tests, PDF follows EN 50699 order 2026-11-12 16:51:28 +01:00

Elektropruefung

Tracks electrical devices and their DIN EN 50699 (VDE 0702) test cycles. Multi-tenant, multi-site.

  • backend/: Go, Gin, GORM (SQLite, MySQL, Postgres), gormigrate, swaggo, OIDC or local login, PDF reports.
  • frontend/: React + Vite PWA. Works on phone and desktop, dark and light mode, offline entry with upload on reconnect.

Backend

cd backend
cp .env.example .env          # adjust
go run . create-tenant --name "Firma"
go run . create-user --username admin --password '<8+ chars>' --admin --tenant 1 --role admin
go run . serve                # API on :8080, Swagger at /api/v1/swagger/index.html
go test ./...

Commands: serve (default), migrate, create-tenant --name, create-user --username --password [--admin] [--tenant --role].

Regenerate the API docs after changing handler annotations:

cd backend && go run github.com/swaggo/swag/cmd/swag@v1.16.6 init -g api/server.go -o docs --parseDependency --parseInternal

Frontend

cd frontend
corepack enable    # pnpm version comes from the packageManager field
pnpm install
pnpm dev           # UI only, no API proxy
pnpm build         # production build in dist/

The frontend makes no proxy. In production the ingress sends /api to the backend and / to the frontend on one host. Local pnpm dev has no API, so run the backend behind a same-host reverse proxy, or test on a cluster.

Concepts

  • Tenant owns sites, devices and tests. A user has a role per tenant: admin, tester (writes devices and tests), viewer.
  • Site has a type (office, workshop, construction site, ...). Picking the type fills in the interval.
  • Interval resolves as: device override, then site interval. Site intervals come from the tenant override for the type, else the built-in default.
  • Result is computed on the server from the measurements. Missing required measurements fail the test.
  • Status: failed (last test failed), expired, due_soon (within 30 days), ok, untested, retired.
  • Retiring a device (Ausmusterung) takes it out of the due lists and blocks new tests; its test records stay. It can be reactivated.
  • Export: the device list downloads as CSV (semicolon, UTF-8 with BOM for Excel) with the same filters as the list.
  • Members: admins list members, change roles and remove them. Nobody can change their own role or remove themselves, so a tenant keeps an admin.
  • Registration: with REGISTRATION_ENABLED=true, anyone can create a local account on the login page. Each new account gets its own tenant and is its admin.
  • Offline: GET responses are cached in IndexedDB. Writes that fail on the network go to an outbox and are sent when online. Tests carry a clientId, so a resend is idempotent.
  • Languages: German and English. The UI picks the browser language on first visit; users switch in the top bar. Dictionaries live in frontend/src/i18n/ (en.ts is the source, de.ts must have the same keys). API errors are translated by their message; PDF reports take ?lang=de|en.
  • Updates of the PWA are never applied silently; the user is asked.

Before production use

  • The VDE limits (backend/vde/vde.go) follow DIN EN 50699 (VDE 0702:2021); tests of type "after repair" use the same limits and are labelled DIN EN 50678 (VDE 0701). Heating power (class I, from 3.5 kW) relaxes R_ISO and leakage limits. Default site intervals are DGUV V3 guide values: verify them against the company risk assessment.
  • Login and registration have no rate limiting yet. Put the API behind the ingress rate limit or add one.