* wip(programmes): the programme schema; the theme matcher moves into the app Work in progress on a branch with no pull request yet. The theme matcher (keywords and compounds of an organisation's themes) moves from scripts/lib into src/lib/domain so public programmes are matched by the same rule as foundations; the script re-exports it. The programme schema follows the investor register: every fact with its page, date and verbatim sentence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmtMwPqoAJ2pHxdSn3t * feat(programmes): public funding programmes beside foundations and investors Seven federal, cantonal and EU programmes, read on 2026-12-01 from the operators' own pages: Innosuisse (three instruments), the EIC Accelerator via Euresearch, the federal media-literacy grants (Jugend und Medien), and the canton of Zurich's integration projects and charitable fund. Every fact carries the page, the day and the sentence it rests on; every sentence was checked against the downloaded page. What a page does not say is named with the reason; six programmes looked for and not entered are listed with why. - Table fundraising_programmes (migration 0023), import script (dry run unless --write), and a re-check script that reads every cited page again and fails when a quoted sentence is gone. - Workspace page: open programmes first, then those whose own words hit the organisation's themes, by the same keyword rule as the register screen (moved to src/lib/domain/theme-match.ts). A programme that asks for an organisation is marked for one that has no legal entity yet; programmes are now one of the kinds the legal-standing notice names. - A grant Vorhaben links to the programmes as well as the foundations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmtMwPqoAJ2pHxdSn3t * feat(programmes): the seven programmes load with the deploy Migration 0024 inserts the rows of data/programmes/seed-2026-12-01.json, so the register is filled when this goes live and nobody runs an import by hand. A test keeps the migration identical to the sourced data file; ON CONFLICT DO NOTHING never puts a row back to this first reading once a later re-check has updated it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmtMwPqoAJ2pHxdSn3t --------- Co-authored-by: Claude <noreply@anthropic.com>
Hirnli — Fundraising Intelligence Platform
Turn thousands of Swiss foundations into a focused, actionable pipeline, then generate a tailored Gesuch for each one in seconds.
Hirnli helps mission-driven organizations find the right foundation funders, build per-foundation fit narratives, and ship professional German-language applications (Gesuche) that stand out from the templated norm. Multi-tenant by design — one deployment serves each organization's branded site on its own host.
Architecture & Conventions · Scripts Reference · Onboarding a New Org
The funnel
Counts as the live tenant site shows them on 2026-10-02
(pipeline-methodik);
pnpm run audit prints the current figures from the database.
Swiss universe (Zefix) ~16,900
↓
In the register (imported) 1,683 — 1,675 with a fit score
↓ researched
Actionable (P1–P3) 233 — P1=20, P2=78, P3=135
↓ assembled
Gesuch pages 212
Contact data and websites are never guessed: automated enrichment is forbidden after the 2026-04-07 incident where guessed URLs were 54% wrong. See the data-integrity rules in AGENTS.md.
The product
- INGEST — Zefix register + ESA + Fundraiso + StiftungSchweiz feeds, deduped into one Foundation entity per legal Stiftung. DB-write SSOT, Zod-validated.
- TRIAGE — Groq-hosted LLM scores every active row from raw Zefix text
alone, producing a
fitScore(0–10) +priority(P1–P4). - RESEARCH — Operator-driven deep research for promising candidates pulls websites, grant ranges, deadlines, past grantees, contact channels.
- PRESENT — Each foundation gets a public-feeling detail page that doubles as a relationship tool: fit analysis, trust badge, sources, recherche links.
- GENERATE — Per-foundation × per-Schwerpunkt × per-template Gesuch composer produces: 4-page Gesuch PDF, one-pager concept note, shareable HMAC landing page, pitch deck (8-slide A4 landscape), and 2-page impact report — all from one Foundation entry + ORG_PROFILE config.
Engineering at a glance
| Signal | Value |
|---|---|
| Tests | Vitest — pnpm test |
| Type safety | 0 errors, 0 any, 0 @ts-ignore in src/ |
| Lint | 0 errors (ESLint flat config) |
| CI | pnpm run verify (format + lint + umlaut lint + typecheck + tests) + build on every push (GitHub Actions) |
| Design tokens | All in globals.css (@theme inline) — zero hex literals in components |
| Dark mode | Fully wired via next-themes + semantic two-tier token system |
| Security | Accounts via Better Auth; tools and data routes for members of the organisation only, rate-limited; HMAC share tokens; security headers on every response |
| Multi-tenant | Per-request tenant resolution (Host header → org_domains row); per-org analysis in fundraising_foundation_assessments; tenant identity in org_profiles |
| Deploy | Self-hosted on Hetzner (Caddy + Next.js standalone output) — docs/DEPLOYMENT.md |
Every page that ships data shows a click-to-inspect "where did this number come
from" modal. Every metric traces back to a NUMBERS_REGISTRY entry with source,
formula, and confidence level. No black boxes.
Tech stack
- Next.js 16 App Router · TypeScript strict
- PostgreSQL (self-hosted,
node-postgresdriver) · Drizzle ORM — schema is SSOT - Zod 4 — types derived via
z.infer<>, never defined separately - Tailwind v4 — design tokens via
@theme inlineinglobals.css @bitbaum/chartkitfor every chart ·@react-pdf/rendererfor PDFs- Groq (Llama 3.x) — LLM triage + rewrite (configurable, rate-limit aware)
- Hetzner — self-hosted behind Caddy, Next.js
standaloneserver output
Quick start
pnpm install
pnpm run dev # http://localhost:3000 (foundation data reads live from the DB)
pnpm test # Vitest suite
pnpm run audit # live pipeline + Gesuch funnel report
pnpm run build # production build (no DB access needed)
An organisation's tools and data are in its workspace, /o/<slug>/… on the platform's
host, for signed-in members of that organisation
(src/lib/auth/require.ts, docs/PRODUCT.md).
One sign-in covers every organisation a person belongs to. An organisation's own host
serves its public pages only, and only if it is public. There is no shared password.
Repository structure
src/
├── app/ # Next.js App Router (route groups: (tenant), (platform), (share), /o)
├── components/ # UI: layout, foundation, fundraising, gesuch, charts, ui
├── lib/
│ ├── schemas/ # Zod — SSOT for every type
│ ├── config/ # Foundations, stories, metrics, numbers, themes (org-specific)
│ ├── db/ # Drizzle schema + migrations + Postgres client
│ ├── domain/ # Pure business logic (scoring, composing, filtering)
│ ├── pdf/ # @react-pdf/renderer templates (Gesuch, pitch deck, impact)
│ └── utils/ # Format, errors, share-token, a11y, slug
└── hooks/ # useFinancialData, useFoundationFilters, useGesuchOverrides
scripts/ # pipeline + ops scripts (ingest, triage, research, audit)
docs/ # KNOWLEDGE_ARCHITECTURE, DATABASE_SETUP, design guides
org-context/ # New-org onboarding inputs (per-tenant)
public/documents/ # Source documents (anonymised) — SSOT for displayed numbers
Project status
| Phase | Status | What it means |
|---|---|---|
| 1 — Revamp-IT MVP | ✅ Shipped | Dashboards, foundation list, Gesuch workflow, pipeline kanban |
| 2 — Document generation | ✅ Shipped | Gesuch PDF (4-page), one-pager, share landing, pitch deck (8-slide), impact report |
| 3 — Multi-tenant (Hirnli) | 🚧 In progress | One deployment serves multiple tenant hosts (Host → tenant resolution); accounts via @bitbaum/accountkit (email+password, passkeys, second factor) with Better Auth's organisation plugin with org-scoped routing at /o/<slug>/; org content migrating from ORG-SPECIFIC files to DB rows. |
The architecture is multi-tenant-by-construction: the foundation registry layer (universal Swiss-foundation facts) is independent from the analysis layer (one org's fit scores and research notes), so adding a tenant means rewriting analysis + branding, not re-doing the registry.
Documentation
AGENTS.md— full product vision, scoring model, schema, data flow, conventionsscripts/README.md— pipeline tools and their pnpm aliasesorg-context/_template/README.md— multi-tenant onboarding checklistdocs/KNOWLEDGE_ARCHITECTURE.md— 3-tier SSOT governancedocs/DEPLOYMENT.md— self-hosted Hetzner deploy procedure, env, crons, migrationsdocs/DATABASE_SETUP.md— PostgreSQL + Drizzle local-dev setupdocs/REWRITE-PLAN.md— what a measured audit found, the target shape and the order of the rewriteROADMAP.mdandCHANGELOG.md— the public records; the site renders them at/roadmapand/changelogdocs/FUNDERS.md— how "funder" generalises from foundation to investor, lender and donor; the investor register; why there is no marketplacepublic/documents/README.md— anonymised source document library
License
MIT — see LICENSE.