CODITECT Multi-Tenant SaaS Architecture - Document Index
Complete inventory of all architecture documentation, diagrams, workflows, and supporting materials.
Last Updated: December 25, 2024 Total Documents: 25+ files Total Diagrams: 60 Total Workflows: 8
Table of Contents
- Architecture Documents
- Business Documents
- Workflow Documentation
- Diagrams
- n8n Workflow Files
- Related ADRs
- Quick Reference
Architecture Documents
Core Architecture
| Document | Description | Location |
|---|---|---|
| ADR-009: Multi-Tenant SaaS Architecture | Master architecture decision record covering data model, auth, provisioning, payments, and API design | ADR-009 |
| SDD: Software Design Document | C4 model architecture with context, container, and component diagrams | SDD |
| TDD: Technical Design Document | Detailed technical specifications, sequence diagrams, and class diagrams | TDD |
| Workflow Diagrams | 25 Mermaid diagrams covering all business processes | Workflow Diagrams |
Supporting ADRs
| ADR | Title | Key Decision |
|---|---|---|
| ADR-010 | Cloud Workstations Architecture | GCP Workstations with tier-based configurations |
| ADR-011 | Authentication Strategy | Firebase Auth + Google Identity Platform |
| ADR-012 | Data Isolation Strategy | PostgreSQL RLS with org_id tenant isolation |
| ADR-013 | Event-Driven Architecture | Google Pub/Sub for async processing |
Business Documents
| Document | Description | Location |
|---|---|---|
| CODITECT Business Plan | 8-page business plan covering market, pricing, and system architecture | Business Plan |
Key Business Sections
- Executive Summary
- Business Model (AZ1.AI as billing entity)
- Pricing Tiers ($29-$299/month + Enterprise)
- Payment-Driven Automation
- Cost Analysis & Margins
- Go-to-Market Strategy
Workflow Documentation
Narrative Guides
Detailed step-by-step documentation for each automated workflow:
| Workflow ID | Name | Description | Narrative | n8n JSON |
|---|---|---|---|---|
| WF-001 | User Registration | New user signup and org creation | Narrative | JSON |
| WF-002 | Subscription Checkout | Stripe checkout session and upgrade | Narrative | JSON |
| WF-003 | Stripe Webhook Handler | Payment event routing | Narrative | JSON |
| WF-004 | Workstation Provisioning | GCP workstation creation | Narrative | JSON |
| WF-005 | User Invitation | Team member invitations | Narrative | JSON |
| WF-006 | Auditor Access | Compliance auditor grants | Narrative | JSON |
| WF-007 | GDPR Data Request | Data access/erasure | Narrative | JSON |
| WF-008 | User Offboarding | Automated cleanup | Narrative | JSON |
| WF-009 | Email Verification | Verify email after registration | Narrative | JSON |
| WF-010 | Password Reset | Forgot password recovery | Narrative | JSON |
| WF-021 | Subscription Upgrade | Mid-cycle plan upgrade with proration | Narrative | JSON |
| WF-023 | Subscription Cancellation | Cancel with retention offer | Narrative | JSON |
| WF-024 | Payment Method Update | Update card with retry | Narrative | JSON |
| WF-025 | Failed Payment Retry | Smart retry & grace period | Narrative | JSON |
| WF-031 | Workstation Start | Start stopped workstation | Narrative | JSON |
| WF-032 | Workstation Stop | Manual workstation stop | Narrative | JSON |
| WF-037 | Workstation Deletion | Delete with final backup | Narrative | JSON |
| WF-038 | Workstation Access URL | Generate signed access URL | Narrative | JSON |
| WF-039 | Idle Detection & Auto-Stop | Auto-stop idle workstations | Narrative | JSON |
| WF-054 | GDPR Data Export | User data export (Article 15) | Narrative | JSON |
| WF-055 | Security Incident Detection | Real-time threat detection | Narrative | JSON |
| WF-066 | Incident Response | Status page & communication | Narrative | JSON |
| WF-072 | Database Backup | Daily backup with restore testing | Narrative | JSON |
Diagrams
Diagram Index
Complete index of all 60 architecture diagrams:
Location: Diagram Index
Diagram Categories
| Category | Count | Description |
|---|---|---|
| Workflow Diagrams | 25 | Business process flows |
| ADR-010 Diagrams | 4 | Cloud workstations architecture |
| ADR-011 Diagrams | 4 | Authentication flows |
| ADR-012 Diagrams | 4 | Data isolation patterns |
| ADR-013 Diagrams | 3 | Event-driven architecture |
| SDD Diagrams | 10 | C4 model architecture |
| TDD Diagrams | 10 | Technical design details |
Diagram Formats
Each diagram available in three formats:
| Format | Location | Use Case |
|---|---|---|
| Mermaid (.mmd) | architecture/diagrams/mermaid/ | Source files, version control |
| PNG (.png) | architecture/diagrams/png/ | Documentation embedding |
| SVG (.svg) | architecture/diagrams/svg/ | Scalable web/print |
Key Workflow Diagrams
| # | Diagram | File |
|---|---|---|
| 01 | Business Model Overview | PNG |
| 02 | User Registration Sequence | PNG |
| 03 | User State Machine | PNG |
| 04 | Payment Flow Sequence | PNG |
| 05 | Billing Cycle Flowchart | PNG |
| 06 | AZ1.AI to Google Payment Flow | PNG |
| 07 | Auto-Provisioning Sequence | PNG |
| 08 | Provisioning State Machine | PNG |
n8n Workflow Files
Importable JSON Workflows
Ready-to-import n8n workflow definitions:
| Workflow | File | Nodes | Trigger |
|---|---|---|---|
| WF-001: User Registration | JSON | 7 | Webhook POST |
| WF-002: Subscription Checkout | JSON | 7 | Webhook POST |
| WF-003: Stripe Webhook Handler | JSON | 11 | Webhook POST |
| WF-004: Workstation Provisioning | JSON | 10 | Pub/Sub |
| WF-005: User Invitation | JSON | 7 | Webhook POST |
| WF-006: Auditor Access | JSON | 6 | Webhook POST |
| WF-007: GDPR Data Request | JSON | 12 | Webhook POST |
| WF-008: User Offboarding | JSON | 11 | Schedule (hourly) |
n8n Credentials Required
| Credential | Type | Used By |
|---|---|---|
| CODITECT PostgreSQL | postgres | All workflows |
| GCP OAuth | googleOAuth2Api | WF-004, WF-008 |
| GCS OAuth | googleCloudStorageOAuth2Api | WF-007, WF-008 |
| GCP Pub/Sub | googleCloudPubSubOAuth2Api | WF-003, WF-004, WF-005 |
| Stripe API | stripeApi | WF-002, WF-003 |
Related ADRs
Cloud Platform ADRs
| ADR | Title | Location |
|---|---|---|
| ADR-009 | Multi-Tenant SaaS Architecture | ADR-009 |
| ADR-010 | Cloud Workstations Architecture | ADR-010 |
| ADR-011 | Authentication Strategy | ADR-011 |
| ADR-012 | Data Isolation Strategy | ADR-012 |
| ADR-013 | Event-Driven Architecture | ADR-013 |
Quick Reference
Document Relationships
CODITECT Architecture Documentation
│
├── ADR-009 (Master Architecture)
│ ├── SDD (Design Specification)
│ ├── TDD (Technical Details)
│ ├── ADR-010 (Workstations)
│ ├── ADR-011 (Authentication)
│ ├── ADR-012 (Data Isolation)
│ └── ADR-013 (Events)
│
├── Business Plan
│ └── References ADR-009 architecture
│
├── Workflow Diagrams (25)
│ └── Visual representation of all processes
│
├── n8n Workflows (8)
│ └── Executable workflow definitions
│
└── Narrative Guides (8)
└── Step-by-step documentation
Naming Conventions
| Type | Pattern | Example |
|---|---|---|
| ADRs | ADR-NNN-kebab-case | ADR-009-multi-tenant-saas-architecture |
| Workflows | WF-NNN-kebab-case | WF-001-user-registration |
| Diagrams | NN-kebab-case | 01-business-model-overview |
| Narratives | WF-NNN-kebab-case.md | WF-001-user-registration.md |
File Counts Summary
| Category | Count |
|---|---|
| ADR Documents | 5 |
| Design Documents (SDD/TDD) | 2 |
| Business Documents | 1 |
| Workflow Narratives | 8 |
| n8n JSON Workflows | 8 |
| Mermaid Diagrams | 60 |
| PNG Images | 60 |
| SVG Images | 60 |
| Total Files | ~204 |
Maintenance Notes
Keeping Documents in Sync
When making changes, update in order:
- ADR-009 (master architecture decisions)
- SDD/TDD (design documents)
- Workflow Diagrams (Mermaid sources)
- n8n Workflows (JSON files)
- Narratives (step-by-step guides)
- This Index (document inventory)
Regenerating Diagrams
# Extract and convert all diagrams
python3 scripts/extract-all-diagrams.py
# Verify all diagrams exist
ls -la docs/architecture/diagrams/png/ | wc -l # Should be 60+
Adding New Workflows
- Create n8n JSON in
workflows/n8n/WF-NNN-name.json - Create narrative in
workflows/narratives/WF-NNN-name.md - Add diagram to
architecture/CODITECT-WORKFLOW-DIAGRAMS.md - Run diagram extraction script
- Update this index
Document Version: 1.0 Created: December 25, 2024 Maintainer: CODITECT Architecture Team