PCProvider ComplianceGod-source direction
Architecture correction · whole-case first

The closest God source is Legalise—used as a blueprint, not a production dependency.

It is the first repository in this research that starts from the same fundamental unit Harrison needs: one governed client matter containing documents, selected-source AI work, citations, human sign-off, audit and a verifiable export. Its self-hosted stack also matches the VPS requirement.

The original recommendation answered the wrong question.

Supabase is removed from the recommendation. Harrison needs a VPS-owned application with direct control of PostgreSQL, object storage, networking, backups, retention and model egress. The repository search must begin with the complete AI onboarding case—not isolated database, document or workflow libraries.

God-source verdictb1rdmania/legalise is the closest whole-system reference. It is an MIT-licensed evaluation release with low adoption and explicit production gaps. Use its product loop, architecture, threat model, audit design, sign-off and export verifier as a blueprint. Do not put live client data into it unchanged.

Why Legalise is the closest match

Legalise is matter-first and chat-led. A user creates a matter, uploads documents, asks an assistant to work against selected sources, runs governed skills, reviews the output, records a named sign-off and exports the matter with documents, source anchors, outputs, decisions and audit evidence.

  1. 1
    Matter as authority

    Isolation, ownership, retrieval, model posture, skills and audit are scoped to one matter—not a conversation.

  2. 2
    Documents and source anchors

    Originals, extracted bodies, versions and citations are server-known. The model cannot invent the source record.

  3. 3
    Governed AI and skills

    One model gateway controls providers. Imported skills are pinned to Git SHAs, inspected and granted matter-level capabilities.

  4. 4
    Named review and sign-off

    AI output stays draft. A reviewer signs, signs with observations or rejects the exact content hash.

  5. 5
    Audit and portable proof

    Consequential actions enter an append-only, per-matter hash chain. Exports contain a standalone Python verifier.

Postgres + pgvectorMinIORedisGotenbergFastAPIReactOllama/API modelsDocker Compose

Translate the legal matter into Harrison’s application case

Legalise primitiveProvider Compliance equivalentRequired extension
MatterProvider-registration applicationEntity, categories, service scope, Commission lifecycle
Parties and factsApplicant, responsible people, roles and backstoryQualifications, screening, suitability and approved org structure
Matter documentsClient evidence, plans, policies, master-pack files and formsCategory, edition, requirement, expiry and sensitivity metadata
Assistant + skillsIntake, org-chart, plans, policies, form-answer and gap-analysis agentsStage gates, typed outputs and category-scoped tools
Source anchorsClaim → evidence → regulatory requirementExact form question, authority version and applicability
Sign-offConsultant review, client confirmation and authorised declarationSeparate actor roles and transition permissions
Matter exportReview pack, clean pack and submission evidence setDOCX/XLSX/PDF generation, manifest and Commission receipts
Audit chainCase event and approval historyTenant boundary, external anchoring and business-event vocabulary
The product directionCreate provider case → run adaptive onboarding → structure people/categories/backstory → classify evidence → run governed application skills → draft with citations → route consultant/client gaps → approve exact revisions → generate master/application pack → export verifiable submission set → preserve Commission lifecycle.

Run the complete product on the VPS

The core is a normal self-hosted application, not a managed backend product. PostgreSQL owns case state, full-text search, embeddings and audit. MinIO or encrypted mounted storage owns original and generated files. Redis or Valkey handles queues. Gotenberg and LibreOffice handle deterministic conversion. FastAPI exposes the domain API. React provides separate consultant and client workspaces. A single model gateway routes to local Ollama or approved API providers and records every call.

Authority

PostgreSQL 16 + pgvector

Cases, people, claims, evidence, gaps, decisions, versions, approvals, full-text retrieval and append-only events.

Files

MinIO or encrypted volume

Unlimited within the VPS/storage budget, with hashes, versions, malware checks and rehearsed backup.

Workers

Redis/Valkey + Python

Extraction, generation, validation, notifications and resumable bounded jobs.

Document service

Gotenberg + LibreOffice

Office/PDF conversion behind pinned jobs and output manifests.

Application

FastAPI + React

One owned codebase for case semantics, consultant work and the client portal.

Models

Audited model gateway

Local models first where useful; optional external models through explicit case posture and egress controls.

What Legalise does not solve

Evaluation release, not production software.The repo explicitly says not to use it for live client matters. Its low adoption is a risk signal, not a reason to ignore the architecture.
  • One deployment is one workspace; there is no organisation/team multi-tenancy, SSO, SAML or SCIM.
  • Matter isolation is enforced in application queries rather than PostgreSQL row-level security.
  • Some role gates are dormant by default and must be made real.
  • Monitoring, alerts, incident runbooks, backup/restore operations and external audit anchoring are incomplete.
  • The editor, model layer and workspace remain evaluation quality.
  • The domain is legal matters, so almost every business object and workflow stage needs replacement.

These limitations turn directly into the Provider Compliance fork/spike checklist: tenant isolation, team/client roles, retention, backup/restore, monitoring, authority versioning, document fixtures and real-case evaluation.

Supplementary repositories by use case

These are sidecars or worker primitives. None becomes the case database.

Use caseRepositoryVerdict
AI workflow and RAG authoringDifyOptional sidecar; expose bounded tools only
External integrations and notificationsn8nOptional; never case authority
Mixed-document extractionDoclingAdd when narrow parsers fail fixtures
Scanned PDF OCROCRmyPDFFixture-triggered worker
DOCX/XLSX/PDF mechanicspython-docx · openpyxl · pypdfAdopt as bounded workers
Office/PDF conversionGotenbergAdopt service primitive
PII detectionPresidioDefence-in-depth after recall tests
Model traces and evalsLangfuseAdd when trace volume warrants it
E-signingDocumensoAdd only for a proven signature flow
Regulatory page monitoringchangedetection.ioObservation feed; human promotes authority
Rules, relationship auth, SSOOPA · OpenFGA · KeycloakDeferred until direct controls fail

NocoBase is an interesting self-hosted AI/no-code business-system reference, but approval and advanced AI/workflow features are commercial and client-delivery rights depend on paid editions. Directus is a strong Postgres/files/permissions substrate, but it still requires the whole domain product around it. Neither replaces the owned case system.

The first build direction

  1. 1
    Spike the God source with synthetic data

    Run Legalise only to experience its matter, document, skill, sign-off, audit and export loop. Do not ingest Harrison’s live files.

  2. 2
    Write the translation map

    For every Legalise object, screen and event, decide reuse, replace or remove for provider registration.

  3. 3
    Build one owned vertical slice

    Adaptive intake → evidence upload → cited draft → gap route → named approval → generated pack → verifiable export.

  4. 4
    Prove two cases

    One successful and one incomplete case must pass source/version, tenant, approval, document and restore checks.

  5. 5
    Add sidecars only on evidence

    Dify, n8n, Docling, Langfuse, OPA and other tools enter only when the vertical slice produces a measured gap.