Add foundational documentation templates to support product design and architecture planning, including ADR, archetypes, LLM systems, dev setup, and shared modules.

This commit is contained in:
olekhondera
2025-12-12 02:31:03 +02:00
parent 5053235e95
commit c905cbb725
26 changed files with 759 additions and 65 deletions

View File

@@ -12,22 +12,22 @@
---
## 1. Role of Backend
- Own business logic for ingestion, processing/classification (rules + embeddings + LLM fallback), approvals, reporting, billing, and audit.
- Own business logic for integrations, AI capability (chat/generation/pipelines/automation), optional human feedback loops, reporting, billing, and audit.
- Integrate safely with external providers (OAuth2/webhooks, payment provider, LLM provider) and expose consistent APIs + events.
- Enforce security: tenant isolation, RBAC, webhook verification, event/audit logging.
- Enforce security appropriate to your archetype (single or multitenant), webhook verification, and event/audit logging.
## 2. Main Domain Areas
- **Auth & Tenants:** authentication/authorization, roles, tenant-scoped access.
- **Integrations:** external providers via OAuth2/webhooks; connection health.
- **Records:** normalized feeds, statuses (ingested, processed, needs_approval, approved, failed), `reasoning_trace` JSONB.
- **Rules & Processing:** rules engine, embeddings similarity, LLM fallback; logging with `source_agent`.
- **Approvals:** human-in-the-loop decisions, overrides, optional rule creation; audit trail.
- **Reports & Exports:** dashboards/summaries with export history.
- **Billing:** provider-hosted subscriptions, tenant-scoped access control, webhooks.
- **Events:** `/api/events` feed for downstream agents and internal observability.
- **Auth & Tenancy (optional):** users, roles, tenant isolation if needed.
- **Integrations / Ingestion (optional):** OAuth2/webhooks/files; connection health.
- **Core AI Module:** chat, generation, classification, RAG, or agentic automation.
- **Processing Pipeline (optional):** staged evaluation (rules/embeddings/LLM); `reasoning_trace` JSONB if used.
- **Human Feedback Loop (optional):** approvals/edits/ratings/escalations; audit trail.
- **Reporting & Exports (optional):** dashboards/summaries with history.
- **Billing (optional):** provider-hosted subscriptions/usage, webhooks.
- **Events / Audit:** `/api/events` feed for observability and downstream agents.
## 3. Integrations
- **External data providers:** OAuth2 + webhooks; signatures/verification; idempotent writes via workers.
- **Payment provider:** subscriptions, checkout/portal; webhooks for lifecycle events.
- **LLM provider:** OpenAI API via single helper; configurable model.
- **LLM provider:** chosen LLM API via a single helper; configurable model/params.
- **Queues:** BullMQ (Redis) for ingestion/categorization/notifications.