TorbatYar/docs/progress.md
Mortezakoohjani 064d67f099 Ship CRM Core Platform (phases 6.0–6.3) with docs and prod deploy.
Add the Sales CRM service through collaboration, sync architecture/registry docs, expose crm.torbatyar.ir, and include a production deploy script.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-24 20:32:00 +03:30

8.2 KiB
Raw Blame History

Progress

Completed work only. Future → roadmap.md. Next milestone → next-steps.md.

Phase 1 — Core Platform

Infrastructure & structure

  • Full project structure with mandatory backend/ / frontend/ separation
  • Shared library backend/shared-lib
  • Architecture section: Frontend & Backend Separation

Core service

  • Config, database, cache, logging, base security
  • Models, APIs, Entitlement, Celery, Outbox
  • Tests and documentation

Frontend

  • Independent Next.js, API client, white-label theme baseline

Phase 2 — Identity & Access + SSO

  • shared/auth/jwt.py, shared/auth/roles.py, Identity events in shared/events.py
  • Identity service + identity_access_db
  • Keycloak realm/clients/theme import
  • Core API protection (AUTH_REQUIRED, role deps)
  • Frontend SSO flow (/login, /auth/callback, /dashboard)
  • Compose services Identity + Frontend; Postgres init for identity DB

Phase 3 — OTP Login + Tenant Management

  • Core users + OTP request/verify + Payamak
  • Local JWT (HS256) for OTP users
  • Admin tenant CRUD + owner filtering
  • Frontend admin OTP/tenant UI (later aligned to central SSO)
  • test_otp_auth.py

Phase 4 — Tenant Onboarding & Workspace Activation

Brief alias: sometimes called “Phase 3” externally — see phase-numbering decision.

  • Core tenant_memberships, tenant lifecycle, branding columns, domain primary/verification fields
  • users.current_tenant_id, FREE/STARTER plan seed, onboarding APIs
  • UserService / MembershipService / OnboardingService / TenantContextService
  • Frontend onboarding wizard, tenant dashboard, tenant switcher
  • test_onboarding.py + regression suite
  • JIT Core user from Keycloak JWT (UserService.resolve_current)
  • Automatic tenant subdomain SSL (Celery → SSH → provision_ssl.py)
  • Reverse proxy (Nginx) + base TLS + tenant SSL automation

Intentionally incomplete after Phase 4 (tracked in roadmap, not claimed done)

Payment gateway · real DNS/TXT custom-domain verify · legacy POST /admin/tenants auto membership/plan · first business module


Phase D — Documentation Architecture Consolidation

  • Target docs/ tree (architecture, adr, development, reference, deployment, templates, phases, decisions)
  • Moved canonical docs with git history where possible
  • Deprecated stubs for old paths
  • ADR system initialized (ADR-001 … ADR-010)
  • Project principles, coding standards, testing/branching/release strategies
  • Module registry + provider registry + glossary
  • Deployment runbooks (production, SSL, monitoring, backup, restore, DR)
  • Roadmap / next-steps separation from progress
  • Phase area docs for Accounting, CRM, Restaurant, Marketplace, Automation, AI, Future
  • Cross-links updated in root and package READMEs

Phase 5.15.11 — Accounting Module

  • Phases 5.15.6: Foundation through Sales Integration (see prior entry)
  • Phase 5.7: Purchase & Inventory accounting, InventoryValuationEngine
  • Phase 5.8: Fixed Assets, DepreciationEngine, asset lifecycle
  • Phase 5.9: HCM/Payroll, PayrollEngine, payroll accounting
  • Phase 5.10: Financial Reporting Engine, dashboards, export framework
  • Phase 5.11: Compliance, Audit Framework, Governance, SoD
  • Alembic migration 0002_phases_57_511
  • 21 tests passing

Accounting Enterprise Frontend (in SuperApp) baseline

  • Design system tokens (light/dark) + DS components (components/ds)
  • TanStack Query providers, Sonner toasts, ColorMode
  • Typed accounting-api client (JWT + X-Tenant-ID, no mocks)
  • Accounting shell + routes: dashboard, COA, fiscal, currencies, cost centers, projects, ledger, setup, suppliers
  • Vouchers list/create/detail with validate/post/reverse/cancel + draft edit (ADR-010)
  • Foundation masters: edit/archive drawers, fiscal year/period actions, COA template import wizard
  • Setup checklist + completion scoreboard on dashboard
  • Treasury, customers, assets, payroll, reports, audit, settings pages (real APIs)
  • Catalog tile available → /accounting
  • Frontend docs under docs/frontend/

Remaining: Phase 5.12 AI UI blocked on AI provider; optional richer PDF export file delivery.


Phase 6.0 — CRM Service Foundation

  • backend/services/crm service scaffold (API / services / repositories / models)
  • Base aggregates: Lead, Contact, Organization, Opportunity, Pipeline, PipelineStage, SalesActivity, Quote
  • Publish-only event contracts (crm.lead.*, crm.opportunity.*, …)
  • CRM APIs only (/api/v1/leads|contacts|organizations|pipelines|opportunities|activities|quotes)
  • Platform provider contracts only (Automation, Customer360, Notification, Analytics, AI, Communication, Helpdesk)
  • Permissions crm.* trees; tenant isolation via X-Tenant-ID
  • Alembic 0001_initial + crm_db wiring (compose port 8003)
  • Architecture / dependency / repository / migration / API / permission / tenant / docs tests
  • Docs: crm-phase-6-0.md, module registry, phase area README

Phase 6.1 — Enterprise CRM Core Business Entities

  • Expanded Lead / Contact / Organization (numbers, multi-contact, soft delete, audit actors)
  • Lookups: lead_sources, lead_statuses, contact_types, organization_types, organization_industries
  • Lead assignments, tag engine, reusable addresses, custom fields + values
  • Versioned notes, attachment file-storage references (no binary), CRM audit log
  • Services / repositories / validators / permissions / events for Phase 6.1
  • Alembic 0002_phase_61_entities
  • API coverage under /api/v1 for entities + lookups
  • Tests: model, repository, service, API, permission, migration, validation, audit, tenant, docs
  • Docs: crm-phase-6-1.md

Phase 6.2 — Enterprise Sales Process Engine

  • Opportunity engine (number, title, revenue, probability, priority, close dates, soft delete, actors)
  • Unlimited pipelines + pipeline stages (start/won/lost/closed flags, required fields, exit validation)
  • Stage history, opportunity products (product_ref only), contact roles, competitors
  • Sales playbooks (versioned) + steps + assignments + completion tracking
  • Win/loss categories, reasons, immutable opportunity_win_loss snapshot
  • Rule-based forecasts (pipeline / weighted / committed; monthly/quarterly/annual)
  • Sales goals + targets with achievement %
  • Sales process definitions + sales_audit trail
  • Services / validators / events / permissions (crm.pipelines|playbooks|forecasts|goals|targets.*)
  • Alembic 0003_phase_62_sales_engine; version 0.6.2.0
  • API coverage for sales engine under /api/v1
  • Tests: pipeline, stage, playbook, forecast, win/loss, business rules, migration, permission, tenant, docs
  • Docs: crm-phase-6-2.md

Phase 6.3 — Enterprise Sales Collaboration Platform

  • Expanded sales activities (types, priority, CRM entity links, participants, reminders)
  • Tasks + checklists + completion tracking
  • Meetings + attendees + finish/outcome
  • Call logs (opportunity-linked) + call outcomes
  • Email threads/messages metadata only (no delivery)
  • Immutable sales timeline + timeline event links
  • Threaded/versioned comments, mentions, bookmarks, favorites
  • Sales team roles/members/assignments + notification preferences
  • Collaboration audit; events crm.task|meeting|call|timeline|comment|mention.*
  • Permissions crm.tasks|meetings|calls|timeline|comments|mentions|team.*
  • Alembic 0004_phase_63_collaboration; version 0.6.3.0
  • Tests + docs: crm-phase-6-3.md

CRM Core Platform

  • Phases 6.06.3 complete (Foundation, Master Data, Sales Engine, Collaboration)