Aller au contenu principal

AAperture — Application Cleanup Map

Living pilot doc for iterative cleanup. Update after each wave MR.

Related audits (do not duplicate): TECH_DEBT_AUDIT.md (racine du dépôt), DB_CLEANUP_AUDIT.md, BACKEND_STRUCTURE_IMPROVEMENT_PLAN.md, CLIENT_LEGACY_DECOMMISSION_CHECKLIST.md, QUEUE_SYSTEM.md, ACCOUNTING_EXPORT_GUIDE.md, MOBILE_APP_DEVELOPMENT.md.

Mental model​

flowchart TB
subgraph clients [Clients]
Web[React frontend studio]
Mobile[aaperture-mobile sibling]
Portal[Client portal]
Public[Public site booking galleries]
end

subgraph nest [Nest monorepo]
API["API RUN_MODE=api"]
Worker["Worker RUN_MODE=worker"]
MobileRoutes["backend/src/mobile routes"]
end

PG[(PostgreSQL)]
Redis[(Redis BullMQ cache)]
R2[(Cloudflare R2)]
Py[python-service FastAPI]
Qdrant[(Qdrant)]

Web --> API
Mobile --> MobileRoutes
Mobile --> API
Portal --> API
Public --> API
API --> PG
API --> Redis
API --> R2
Worker --> Redis
Worker --> PG
Worker --> R2
Worker --> Py
Py --> Qdrant
API -.->|Socket.IO app + /agent| Web
API -.->|/agent| Mobile
SurfaceRoleLocation
Studio CRM (FE)Auth, contacts, sessions, docs, pipeline, Iris, searchfrontend/
Backend studioCRM REST + Iris + Doublons/Discordbackend/src/ hors mobile/
Backend mobile routesNative contract onlybackend/src/mobile/**, OpenAPI paths/mobile/
Portal client/portalfrontend + client-* backend
PublicBooking, galleries, lead formspages/public*, booking, public-site
App nativeSecond Frame clientSibling ../aaperture-mobile (hors monorepo)
WorkerBackground jobsWorkerModule + workers/ + queue/processors/
PythonPDF/docx/xlsx, embeddings, Qdrantpython-service/

Rule: In this monorepo, “mobile” means backend routes for the sibling app. Do not treat RN as a package under aaperture.

Keep map — Frontend web vs Backend mobile​

Frontend web — keep​

DomainNotes
Core CRMDashboard, contacts, sessions, pipeline, calendar
DocsQuotes, invoices, contracts
Iris / searchAgent overlay + Cmd+K (no recommendations block)
Insights / analyticsCharts; CREATE_TASK navigates deepLink
Orgs / socialOrganizations, Friends, Messages
Doublons + Discord shareFE deleted (web); BE + Discord kept for mobile port
SettingsTemplates, providers, workflows, lead forms, rates, export (SMS hidden)
AccountProfile, company, connections, subscription; Gmail freeze
Other FE clientsPortal /portal/*, public booking / galleries

Backend mobile routes — keep (native contract)​

ZoneRoutes
Auth devicePOST /mobile/auth/login, /mobile/auth/google
PushPOST/DELETE /mobile/push-tokens (+ mobile-push worker)
Sync CRMPOST /mobile/sync
Community façade/mobile/me, map, /mobile/network*, messages

Shared APIs (web + native): /agent, CRM REST, Friends domain (via /mobile/network), notifications.

Absent from mobile contract (MVP): progression (deleted), Gmail, dense editors, SMS (hidden on web). Doublons/Discord product UI removed on web; BE kept for mobile port backlog.

Friends​

  • KEEP web + BE + /mobile/network.
  • Port UX to sibling aaperture-mobile (Second Frame / circles) — tracked in mobile docs, not deleted here.

Domain inventory (post cleanup)​

Domain / folderDecisionNotes
agent/ (Iris)keepPrimary conversational AI
insights/keepRule-engine; CREATE_TASK → navigate
billing/ + billing/exports/keepIssuance + accounting CSV (export-first)
export/keepCRM list exports
external-billing/ (Pennylane)deletedCode removed; DB drop 0270/0274
file-objects/keepDocuments / exports / artifacts
crm-entity-files/keepSession/contact CRM files on file_objects
session-files/ / contact-files/controllers onlyHTTP routes; logic in CrmEntityFilesService
Legacy session_files / contact_files tablesdropped0272
file_objects.shared_with_clientdropped0273
outbox/ Nest moduledeletedTable outbox_events dropped (0276)
queue/processors/* routerskeepSole @Processor for email/AI
progression/deletedGamification removed (tables → later DB wave)
recommendations/deletedCmd+K doublon of Insights
Search ai-actions* / ai-chat / orphan conversation.servicedeletedSuperseded by Iris
CSRF scaffolddeletedUnused module/guard
Portal ClientQuoteExternalBillingdeletedZombie empty payload removed
sms-templates BEdeletedRemoved entirely (Vague E) — templates, sending (Twilio/Vonage), workflow AUTOMATIC_SMS/SEND_SMS, notification_sms client preference, dead contact "SMS" tab
Gmail pluginfreeze (scope à part)Later dedicated MR — not part of this cleanup wave
Doublons + Discordkeep BEWeb FE hard-deleted; BE + Discord kept for mobile port
galleries.service F001doneFacade now ~1.5k LOC; owner library CRUD → GalleriesLibraryService, client/public portal + selections → GalleriesSelectionsService, shared detail/ownership helpers → GalleriesDetailService
GalleryEditorSlideshowTab F002partialExport window, timeline layout, patch queue, and Konva cover/ending-persist state extracted into gallery-editor-slideshow/ hooks; handleSaveDraft/handleQueueSlideshowRender orchestration left inline (needs test coverage before extracting)

Completed waves (this branch)​

Files SoT​

  • Parameterized FE createEntityFilesClient
  • Dual-write then cutover to file_objects
  • Liquibase 0271–0273
  • CrmEntityFilesService + module collapse

Billing export-first​

  • Hard-delete Pennylane sync stack
  • Accounting CSV UI + ACCOUNTING_EXPORT_GUIDE.md
  • Liquibase drop external billing (0270 on main / 0274 on this line)

Queues / stubs​

  • Sole @Processor routers; export:build; removed addExportJob
  • Delete Nest outbox/, KittySection, prediction stub, deprecated export wrappers

Vague A — dead product + hygiene (2026-07-24)​

  • Delete search ai-actions / ai-chat / orphan conversation.service
  • Delete CSRF scaffold + unused ClientAccessMoodboardsService
  • Hard-remove progression (FE + BE + OpenAPI; DB tables later)
  • Delete recommendations module + Cmd+K block
  • Insights CREATE_TASK → navigate(deepLink)
  • Hide SMS UI (nav, contact tab, workflow create options)
  • Hard-delete Doublons web FE (/duplicates pages, client, components, dashboard widget); BE + Discord kept for mobile port
  • Remove portal external_billing zombie
  • Keep-map FE vs BE-mobile documented here

Vague C — Proposal deleted (FE/BE + DB)​

  • Hard-remove Proposal product (builder, public /proposal, upsells panel, email new-proposal, settings defaults, routes, OpenAPI paths/schemas, E2E)
  • FE + BE code deleted on chore/remove-proposal-product
  • DB: Liquibase 0277 drops proposal_* tables, user_settings.proposal_default_*, email_new-proposal, quote_revisions, ADDON quote lines / columns, and user_rates addon flags
  • KEEP: sessions day-planner client proposals (sessions.*.dayPlanner i18n + planning proposal APIs) — not the commercial Proposal product
  • KEEP: contacts marketing copy where “proposal” means quote / commercial offer
  • KEEP: session user_rate_id (session ↔ rate link; unrelated to Proposal add-ons)
  • FREEZE: R2 prefixes proposal-covers/ / proposal-defaults/ (writes denied; GC done on aaperture-dev 2026-09-06, see backend/scripts/gc-proposal-r2-objects.ts)
  • Quotes CRM flow verified post-removal (list/create/edit/view/send/session tab)

Vague E — SMS hard-delete (2026-09-06)​

  • Backend: sms-templates module, communication/sms.service.ts (Twilio/Vonage), all AUTOMATIC_SMS/SEND_SMS/sms_template_id branches in workflow DTOs/services deleted
  • Frontend: SMS templates page, hook, workflow builder SMS branches, i18n deleted
  • OpenAPI schema (workflows.yaml) cleaned; regenerated types both sides
  • Fixed pre-existing gap surfaced by the cleanup: SEND_SESSION_INFO_INVITE/SEND_SURVEY_INVITE were missing from the OpenAPI schema and from workflow-crud.service.ts's read path — survey invite tasks lost their type/template id on reload; now fixed
  • Two unrelated dead/inert "sms" surfaces found during verification, removed too: never-built contact page "SMS" tab (ContactTabSection), and notification_sms client-portal preference (declarative only, never sent a real SMS)
  • Liquibase 0279 (drop user_sms_templates), 0280 (drop SEND_SMS from workflow_task_actions CHECK), 0281 (drop client_preferences.notification_sms)
  • KEEP: default_sms_pack — already gone, it lived on professional_type_profiles, dropped whole in Vague D (0278)

Vague D — orphan schema drop (2026-09-05)​

  • Live inventory: professional_type_profiles (seed-only), organization_settings (0), gdpr_processing_activities (0)
  • Liquibase 0278 drops the three tables; Kysely types removed
  • KEEP: professional_types, GDPR consent/request/export/deletion tables, Insights insight_settings
  • Galleries F002 remaining orchestration extract (needs test coverage)
  • R2 GC for proposal-covers/ / proposal-defaults/ — done on aaperture-dev (2026-09-06); re-run against staging/prod separately if needed

Progression DB drop (post Vague A) (2026-07-24)​

  • Liquibase 0275 drop progression family tables
  • Remove progression table types from database.types.ts
  • Session view honors ?action=upload-files|create-checklist|create-occurrence

Deferred trio cleanup (2026-07-24)​

  • Liquibase 0276 drop outbox_events + remove Kysely types
  • Portal /client Phase 4 residuals (dead DTOs, PayPal portal defaults, checklist closed)
  • Galleries F001 slice 1 — GalleriesSlideshowOwnerService + facade
  • Galleries F001 slice 2 — GalleriesZipDownloadService, GalleriesAssetsService, share lifecycle folded into GalleriesShareService
  • Galleries F001 slice 3 (final) — GalleriesLibraryService (owner CRUD), GalleriesSelectionsService (client/public portal + selections), GalleriesDetailService (shared detail/ownership helpers); facade ~8.5k → ~1.5k LOC
  • Galleries F002 (partial) — extracted useSlideshowExportWindow, useSlideshowTimelineLayoutState, useSlideshowEditorPatchQueue, useTimelineGraphicKonvaPersist hooks from GalleryEditorSlideshowTab.tsx
  • Gmail plugin unchanged — separate FREEZE scope for later

Remaining / deferred​

ItemNotes
Friends UX portMVP done on aaperture-mobile (Circles accept/reject/add/remove)
Doublons → mobileWeb FE deleted; BE /duplicates + Discord kept — port in aaperture-mobile
SMS providerDeleted (Vague E, 2026-09-06) — Twilio/Vonage service, templates, workflow tasks, DB (0279-0281), OpenAPI, i18n; see Vague E above
Gmail pluginFREEZE — inbox UI + /gmail redirected; page/BE code kept for dedicated MR — GMAIL_PLUGIN_IMPLEMENTATION_PLAN.md
Galleries F002 (remaining)handleSaveDraft / handleQueueSlideshowRender orchestration still inline in GalleryEditorSlideshowTab.tsx (~4.2k LOC); extracting further needs UI/integration test coverage first
outbox_eventsDropped (0276)
Portal /client Phase 4Done — CLIENT_LEGACY_DECOMMISSION_CHECKLIST.md
Notion / PayPal on /connectionsProduct call — not Vague B
Cmd+K generate-actionProduct call vs Iris-only

Vague B — hide leftovers (2026-08-21)​

  • Hide Gmail inbox plugin card on GoogleSettingsPage; /gmail → redirect /settings/google
  • Hard-hide SMS FE routes (/settings/data/sms-templates*) → redirect email templates; skip e2e
  • Remove Sessions list overflow → /contacts/duplicates (wrong surface)
  • Sweep orphan Pennylane / admin external-billing / sidebar smsTemplates i18n
  • Keep CRM merge /contacts/duplicates (contacts list + dashboard)

Liquibase on this line​

IdPurpose
0271shared_with_client + backfill from legacy
0272Drop session_files / contact_files + views
0273Drop file_objects.shared_with_client
0274Drop external billing tables + settings flag
0275Drop progression / gamification tables
0276Drop outbox_events
0277Drop Proposal product tables + settings columns + email_new-proposal + ADDON quote/user_rates rollback
0278Drop orphan professional_type_profiles / organization_settings / gdpr_processing_activities
0279Drop user_sms_templates (SMS templates hard-delete)
0280Drop SEND_SMS from workflow_task_actions.action_type CHECK
0281Drop client_preferences.notification_sms

Merge note: main may already have 0270 for billing drop; keep a single drop changeset in changelog.

Before / after​

AreaBeforeAfter
CRM filesDual tables + dead EntityFilesServicefile_objects + CrmEntityFilesService
Session shareOrphan /share APIRemoved
Billing syncPennylane in productAccounting CSV export
Email/AI queuesCompeting @ProcessorsRouters + injectable handlers
Scheduled exportJob name export (rejected)export:build
ProgressionXP / badges / navDeleted
RecommendationsCmd+K blockDeleted (Insights remains)
Portal quote billingEmpty external_billingRemoved
SMSVisible settings / contact tabDeleted FE/BE + DB 0279-0281 (Vague E)
DoublonsSidebar + dashboard widgetWeb FE deleted; BE + Discord kept for mobile port
outbox_eventsOrphan table after Nest module deleteDropped (0276)
Legacy /client pagesResidual DTOs + dead PayPal URLsPhase 4 closed; /client?returnUrl= bridge kept
Galleries god-file~8.5k LOC single serviceF001 done — facade ~1.5k + subdomain services; F002 partial (~4.2k FE tab)
Commercial ProposalBuilder + /proposal + ADDON upsellsDeleted FE/BE + DB 0277; day-planner proposals KEEP; R2 GC done on dev + prod
Orphan schema bagsProfiles / org settings JSON / GDPR Art.30 registerDropped 0278 (unused at runtime)