w# Project Documentation
This folder hosts the project documentation. Files here are Markdown (.md) unless otherwise noted.
- architecture.md: System architecture, components, data flows, multi-tenancy, RLS
- frontend-architecture.md: UI structure, shared components, patterns (TanStack Query, ServerDataGrid, PageHeader)
- api-reference.md: REST endpoints, authentication, master data, OPEX/CAPEX, contracts, reporting
- page-and-feature-overview.md: Complete page map, permissions, frontend/backend integration
New to the project?
- Read planning/product-vision.md - High-level vision and goals
- Read planning/v1-plan.md - Current implementation status and V1 scope
- Follow setup/dev-setup.md - Set up your local environment
- Review setup/contributing.md - Contribution guidelines
Published to: doc.kanap.net
End-user documentation built with MkDocs. This folder is deployed automatically and should not contain any internal/technical content.
docs/en/: English documentation (source files)docs/fr/: French documentation (future)mkdocs.yml: MkDocs configuration_process/: Documentation generation templates and inventory (not published)
To build locally:
cd doc/help
pip install mkdocs-material
mkdocs serve # Preview at http://localhost:8000To generate/update a page: Use /doc-page <route> for a single page, /doc-batch <category> for bulk generation, or /doc-check for staleness detection. Commands are defined in .claude/commands/doc-*.md; there is also a Codex skill at .codex/skills/user-manual-maintainer/.
- technical-design.md: Architecture decisions, feature flags, tenant resolution, error contract, behavioral differences
- operations-internals.md: Distribution model, maintenance strategy, support policy
User-facing on-premise guides are in /help/docs/en/on-premise/ (published to doc.kanap.net).
- dev-setup.md: Local development setup (Docker, subdomain testing, environment variables)
- contributing.md: Contribution process, code guidelines, documentation standards
- testing-strategy.md: Testing approach and QA criteria
- runbook.md: Operational procedures, monitoring, incident response
- prod-deploy.md: Production deployment guide
- qa-deploy.md: QA environment deployment guide
- turnstile-setup.md: Cloudflare Turnstile setup for public forms
- connection-pool-troubleshooting-guide.md: Database connection pool troubleshooting
Patterns (features/patterns/)
- workspace-patterns.md: ⭐ Comprehensive workspace implementation guide (RLS, tenant deletion, lifecycle, editor patterns)
- backend-patterns.md: ⭐ Backend patterns & abstractions (BaseDeleteService, TenancyManager, service decomposition, DTOs)
- csv-import-export.md: CSV workflows, validation, templates
Workspaces (features/workspaces/)
- spend-workspace.md: OPEX-specific workspace details
- contracts-workspace.md: Contracts-specific workspace details
- applications-portfolio.md: Applications & Services workspace implementation
- interfaces-specifications.md: Interfaces workspace specification
- connections-workspace.md: Infrastructure connections workspace
- locations-workspace.md: Locations workspace details
- portfolio-specification.md: Portfolio management workspaces (requests, projects)
- spend-module-maintenance.md: OPEX module maintenance and architecture
Components (features/components/)
- column-customization-guide.md: ServerDataGrid column chooser and persistence
- reporting-guidelines.md: Report structure, charts, exports
- interface-map-visualization.md: Interface Map D3 visualization
- connection-map.md: Infrastructure Connection Map controls and behavior
- server-clusters.md: Server cluster management
- dark-mode-implementation.md: Theme architecture, AG Grid integration, print/export normalization
- user-documentation-system.md: User documentation generation system
Master Data (features/master-data/)
- accounts-and-chart-of-accounts.md: Accounts + CoA model, Platform Admin templates
- business-processes-master-data.md: Business processes catalog
- currency-management.md: Tenant currency settings, exchange rates
- it-ops-settings.md: IT Landscape settings and catalogs
- operations-dashboard.md: Operations dashboard specification
- database-indexes.md: Performance indexes, monitoring, troubleshooting (consolidated guide with quick start)
- product-vision.md: Purpose, personas, outcomes, guiding principles
- v1-plan.md: V1 scope, timeline, implementation status, acceptance criteria (consolidated V1 spec + implementation plan)
- requirements.md: Functional requirements and constraints
- roadmap.md: Near-term milestones and backlog themes
- evaluation.md: Quality criteria and metrics
- security.md: Threat model, controls, authentication/authorization
- README.md: ADR index
- 0000-template.md: ADR template
- 0001-allocation-model-and-metrics.md: Allocation methods and company metrics
- 0002-multitenancy-storage.md: Single-DB multitenancy with RLS
- frontend-page-checklist.md: Checklist for new pages
- checkbox-set-filter-pattern.md: Closed-choice checkbox filter pattern (AG Grid Community)
- status-column-filtering-pattern.md: Default status filtering patterns
- status-scope-pattern.md: Status scope filtering pattern
- ui-forms.md: UI form patterns and conventions
Sample CSV files for import/export:
accounts.csv,companies.csv,departments.csv,suppliers.csv,users.csvspend_items.csv,spend_versions.csv,spend_amounts_*.csv,spend_allocations.csvcapex.csv,opex.csv,contracts.csv
archive/fixes/: Historical fix documentation (connection pool fix, RBAC multi-role fix, etc.)archive/implementation-steps/: Completed implementation step guides (01-20)archive/planning/completed-2025/: Completed implementation plans from 2025 (Entra SSO, IT Ops, Interfaces, Applications Portfolio, CoA, Locations, Files/S3, RBAC, Cloudflare, Marketing, Application Versions)
Legacy location for user documentation. Content has been migrated to /help/docs/en/. This folder will be removed in a future cleanup.
- Single-DB approach: Shared PostgreSQL with Row-Level Security (RLS)
- Tenant isolation:
tenant_idon all tables, RLS policies enforce per-request context - Per-request binding:
TenantInitGuardsetsapp.current_tenantfrom subdomain - Platform admin: Separate host for tenant management (
PLATFORM_ADMIN_HOST) - On-premise (single-tenant):
DEPLOYMENT_MODE=single-tenantbypasses subdomain routing, disables billing/platform-admin, auto-provisions tenant on first boot
See: architecture.md (Multitenancy section), on-premise/technical-design.md (on-prem design), features/patterns/workspace-patterns.md (RLS requirements)
- Route-driven editing:
/module/items/:id/:tab(not modals) - Explicit Save/Reset: Dirty guards prevent data loss
- Prev/Next navigation: Preserves list context (sort, filters, search)
- Deep linking: Grid cells open specific tabs/years
See: features/patterns/workspace-patterns.md ⭐
disabled_atas source of truth: Past date = disabled, NULL/future = enabled- Derived status: Backend computes
statusenum fromdisabled_at - Historical queries: Period-aware filtering includes items active during timeframe
- Frontend:
StatusLifecycleFieldcomponent handles toggle + date picker
See: features/patterns/workspace-patterns.md (Lifecycle Management section)
Six allocation methods for cost distribution:
- Auto:
default,headcount,it_users,turnover(computed from metrics) - Manual:
manual_company,manual_department(explicit percentages, auto-recalculated)
See: adr/0001-allocation-model-and-metrics.md
Shared abstractions for consistency and maintainability:
- BaseDeleteService: Consolidated delete logic with cascade relations, storage cleanup, audit logging
- TenancyManager: Request-scoped tenant context and transaction management
- Service Decomposition: Large services split into focused sub-services using facade pattern
- Type Safety: Zod DTOs, typed decorators (
@Tenant()), response types
See: features/patterns/backend-patterns.md ⭐
Shared hooks and components for consistency:
- useModuleNavigation: Generic navigation hook replacing module-specific hooks
- useVirtualRows: Virtual scrolling for large lists
- WorkspaceLayout: Reusable workspace page layout with tabs
- EnumEditor: Generic settings editor with virtual scrolling
- Read features/patterns/workspace-patterns.md ⭐
- Add
tenant_id+ RLS policies to tables - Update tenant deletion script (
admin-tenants.service.ts) - Implement shell + editors following patterns
- Run RLS self-test (
npm run test:rls) - Run CSV smoke test if applicable
- Add
tenant_id uuid NOT NULLcolumn - Create RLS policies (USING + WITH CHECK)
- Add composite indexes (
tenant_idleading) - Update tenant deletion purge order
- Use request-scoped EntityManager in services
- Run RLS self-test
- Check database/database-indexes.md for index guidance
- See operations/connection-pool-troubleshooting-guide.md
- Check operations/runbook.md for monitoring procedures
- Template: Use template.md for new documents
- Metadata: Include Purpose, Audience, Status (draft/current/archived/deprecated), Owner, Last Updated
- Related Documentation: Add links to related docs at the top of each document
- Cross-References: Use
**See:** [doc-name.md](path/to/doc.md)instead of duplicating content - Conciseness: Keep docs focused; link to authoritative sources for details
- Diagrams: Prefer diagrams-as-code (Mermaid) embedded in Markdown
- Code references: Use
file_path:line_numberpattern for linking to code
- Quarterly Review: Review
/planning/directory each quarter for completed implementation plans to archive - Archive Location: Completed plans go to
/archive/planning/completed-YYYY/ - Status Updates: Mark implementation plans as "Status: IMPLEMENTED (YYYY-MM-DD)" when complete
- Avoid Duplication: Maintain single source of truth; use cross-references instead of copying content
- Link Maintenance: When moving files, update all cross-references in README.md and related docs
✅ Multi-tenancy (RLS, tenant provisioning, subdomain routing)
✅ OPEX & CAPEX modules (workspaces, budgets, allocations, tasks)
✅ Contracts (CRUD, OPEX linking, attachments, tasks)
✅ Master data (companies, departments, suppliers, accounts, analytics, contacts)
✅ Reporting (Top 10, Delta, Budget Trend (OPEX/CAPEX), Budget Column Comparison, Consolidation, Chargeback)
✅ RBAC (roles, permissions, seat licensing)
✅ Budget Operations (freeze, copy columns, copy allocations, reset)
✅ Platform Admin (tenant management, freeze/delete, plan updates)
✅ CSV import/export (all entities)
✅ Lifecycle management (disabled_at source of truth)
✅ Connection pool optimization
✅ Database indexes (90-95% performance improvement)
✅ Email notifications (event-driven + scheduled weekly review digest)
✅ User settings (profile editing, notification preferences)
✅ Rate limiting (app-level throttling on auth and public endpoints)
✅ On-premise deployment (single-tenant mode, feature flags, first-boot provisioning, CI matrix)
None - V1+ features complete
- Repository: (Add your Git repo URL)
- Issue Tracker: (Add your issue tracker URL)
- CI/CD: (Add your CI/CD dashboard URL)
- QA Environment:
qa.kanap.net - Production:
kanap.net
- Architecture questions: See architecture.md or features/patterns/workspace-patterns.md
- Backend patterns: See features/patterns/backend-patterns.md
- Setup issues: See setup/dev-setup.md
- Operational issues: See operations/runbook.md or operations/connection-pool-troubleshooting-guide.md
- Feature guidance: Check relevant file in
/featuressubdirectories (patterns, workspaces, components, master-data)
- Relative links: Use relative paths for internal docs (e.g.,
[file](setup/dev-setup.md)) - Code blocks: Use appropriate language tags for syntax highlighting
- Callouts: Use emoji prefixes for emphasis (
⚠️ Warning, ✅ Complete, ⭐ Important) - Sections: Use
---for horizontal separators between major sections - Tables: Use tables for structured data (checklists, comparisons, status)
Last Updated: 2026-02-15 Document Owner: Engineering Team