ProjectsItem 3 of 8
Lex
Legal research in German law: search statutes and court decisions, ask an AI and get sourced answers.
Access on request Web application with AI
What it is
A research assistant for German law. Search statutes and court rulings, ask Claude for answers backed by citations, and explore a citation graph showing how provisions reference one another. Access is behind a login.
Technical highlights
- The corpus covers roughly 247,000 statutory provisions and 55,000 court decisions (verified September 2026). Cross-references are parsed with a custom Lark grammar.
- Claude uses custom tools to search provisions, decisions and citations; the system prompt and tool definitions are reused via prompt caching.
- A WebGL2 renderer draws the citation graph from binary packs decoded in a Web Worker, falling back to a Canvas 2D mode when WebGL2 is unavailable.
- Full-text search powered by Tantivy, tenant data in PostgreSQL, authentication via WorkOS.
Technology
- Python
- FastAPI
- SQLAlchemy
- PostgreSQL
- SQLite
- Tantivy
- igraph
- Lark
- Claude API
- WorkOS
- WebGL2
Runs on
Python application in its own container image, with a volume for the legal corpus.
- Cloudflare edgeReceives every request, terminates TLS and shields the servers; static files are cached.
- Cloudflare TunnelOne outbound connection to Cloudflare per server, so the applications need no open ports. At home every application runs through it; in the data centre, the sign-in service.
- Traefik (ingress)Routes each request to its application by hostname, including those in the data centre. Its Prometheus counters are the source of the live dots in this drawing.
- Server at home (microk8s)Runs the Kubernetes control plane and most applications, each in its own namespace, fenced off by NetworkPolicies.
- PostgreSQL at home (CloudNativePG)One database and role per application, continuously archived and backed up daily; point-in-time recovery for the last 30 days.
- OpenBao + External SecretsCredentials live in OpenBao; the External Secrets Operator syncs them into the applications on both servers. For Sealdesk, OpenBao Transit holds the document keys.
- Monitoring (Grafana, Mimir, Alloy)Alloy collects the Prometheus metrics of both servers and all applications, Mimir stores them, Grafana shows them. BOB also reports errors to a self-hosted, Sentry-compatible error tracker.
- GitLab CI/CDA push to the main branch runs tests, builds and deploys. Runners operate on the server, inside the cluster and on a dedicated build machine.
- Container registry (GitLab)Custom container images live in a private registry; the static sites run a stock nginx with their files in ConfigMaps.
Images



Credits and licences
Planning something similar? Discuss a project