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
| Surface | Role | Location |
|---|---|---|
| Studio CRM (FE) | Auth, contacts, sessions, docs, pipeline, Iris, search | frontend/ |
| Backend studio | CRM REST + Iris + Doublons/Discord | backend/src/ hors mobile/ |
| Backend mobile routes | Native contract only | backend/src/mobile/**, OpenAPI paths/mobile/ |
| Portal client | /portal | frontend + client-* backend |
| Public | Booking, galleries, lead forms | pages/public*, booking, public-site |
| App native | Second Frame client | Sibling ../aaperture-mobile (hors monorepo) |
| Worker | Background jobs | WorkerModule + workers/ + queue/processors/ |
| Python | PDF/docx/xlsx, embeddings, Qdrant | python-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
| Domain | Notes |
|---|---|
| Core CRM | Dashboard, contacts, sessions, pipeline, calendar |
| Docs | Quotes, invoices, contracts |
| Iris / search | Agent overlay + Cmd+K (no recommendations block) |
| Insights / analytics | Charts; CREATE_TASK navigates deepLink |
| Orgs / social | Organizations, Friends, Messages |
| Doublons + Discord share | FE deleted (web); BE + Discord kept for mobile port |
| Settings | Templates, providers, workflows, lead forms, rates, export (SMS hidden) |
| Account | Profile, company, connections, subscription; Gmail freeze |
| Other FE clients | Portal /portal/*, public booking / galleries |
Backend mobile routes — keep (native contract)
| Zone | Routes |
|---|---|
| Auth device | POST /mobile/auth/login, /mobile/auth/google |
| Push | POST/DELETE /mobile/push-tokens (+ mobile-push worker) |
| Sync CRM | POST /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 / folder | Decision | Notes |
|---|---|---|
agent/ (Iris) | keep | Primary conversational AI |
insights/ | keep | Rule-engine; CREATE_TASK → navigate |
billing/ + billing/exports/ | keep | Issuance + accounting CSV (export-first) |
export/ | keep | CRM list exports |
external-billing/ (Pennylane) | deleted | Code removed; DB drop 0270/0274 |
file-objects/ | keep | Documents / exports / artifacts |
crm-entity-files/ | keep | Session/contact CRM files on file_objects |
session-files/ / contact-files/ | controllers only | HTTP routes; logic in CrmEntityFilesService |
Legacy session_files / contact_files tables | dropped | 0272 |
file_objects.shared_with_client | dropped | 0273 |
outbox/ Nest module | deleted | Table outbox_events dropped (0276) |
queue/processors/* routers | keep | Sole @Processor for email/AI |
progression/ | deleted | Gamification removed (tables → later DB wave) |
recommendations/ | deleted | Cmd+K doublon of Insights |
Search ai-actions* / ai-chat / orphan conversation.service | deleted | Superseded by Iris |
| CSRF scaffold | deleted | Unused module/guard |
Portal ClientQuoteExternalBilling | deleted | Zombie empty payload removed |
sms-templates BE | deleted | Removed entirely (Vague E) — templates, sending (Twilio/Vonage), workflow AUTOMATIC_SMS/SEND_SMS, notification_sms client preference, dead contact "SMS" tab |
| Gmail plugin | freeze (scope à part) | Later dedicated MR — not part of this cleanup wave |
| Doublons + Discord | keep BE | Web FE hard-deleted; BE + Discord kept for mobile port |
galleries.service F001 | done | Facade now ~1.5k LOC; owner library CRUD → GalleriesLibraryService, client/public portal + selections → GalleriesSelectionsService, shared detail/ownership helpers → GalleriesDetailService |
GalleryEditorSlideshowTab F002 | partial | Export 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 (
0270on main /0274on this line)
Queues / stubs
- Sole
@Processorrouters;export:build; removedaddExportJob - 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 (
/duplicatespages, client, components, dashboard widget); BE + Discord kept for mobile port - Remove portal
external_billingzombie - Keep-map FE vs BE-mobile documented here
Vague C — Proposal deleted (FE/BE + DB)
- Hard-remove Proposal product (builder, public
/proposal, upsells panel, emailnew-proposal, settings defaults, routes, OpenAPI paths/schemas, E2E) - FE + BE code deleted on
chore/remove-proposal-product - DB: Liquibase
0277dropsproposal_*tables,user_settings.proposal_default_*,email_new-proposal,quote_revisions, ADDON quote lines / columns, anduser_ratesaddon flags - KEEP: sessions day-planner client proposals (
sessions.*.dayPlanneri18n + 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 onaaperture-dev2026-09-06, seebackend/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-templatesmodule,communication/sms.service.ts(Twilio/Vonage), allAUTOMATIC_SMS/SEND_SMS/sms_template_idbranches 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_INVITEwere missing from the OpenAPI schema and fromworkflow-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), andnotification_smsclient-portal preference (declarative only, never sent a real SMS) - Liquibase
0279(dropuser_sms_templates),0280(dropSEND_SMSfromworkflow_task_actionsCHECK),0281(dropclient_preferences.notification_sms) - KEEP:
default_sms_pack— already gone, it lived onprofessional_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
0278drops the three tables; Kysely types removed - KEEP:
professional_types, GDPR consent/request/export/deletion tables, Insightsinsight_settings - Galleries F002 remaining orchestration extract (needs test coverage)
- R2 GC for
proposal-covers//proposal-defaults/— done onaaperture-dev(2026-09-06); re-run against staging/prod separately if needed
Progression DB drop (post Vague A) (2026-07-24)
- Liquibase
0275drop progression family tables - Remove progression table types from
database.types.ts
Insights deep-links (2026-07-24)
- Session view honors
?action=upload-files|create-checklist|create-occurrence
Deferred trio cleanup (2026-07-24)
- Liquibase
0276dropoutbox_events+ remove Kysely types - Portal
/clientPhase 4 residuals (dead DTOs, PayPal portal defaults, checklist closed) - Galleries F001 slice 1 —
GalleriesSlideshowOwnerService+ facade - Galleries F001 slice 2 —
GalleriesZipDownloadService,GalleriesAssetsService, share lifecycle folded intoGalleriesShareService - 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,useTimelineGraphicKonvaPersisthooks fromGalleryEditorSlideshowTab.tsx - Gmail plugin unchanged — separate FREEZE scope for later
Remaining / deferred
| Item | Notes |
|---|---|
| Friends UX port | MVP done on aaperture-mobile (Circles accept/reject/add/remove) |
| Doublons → mobile | Web FE deleted; BE /duplicates + Discord kept — port in aaperture-mobile |
| SMS provider | Deleted (Vague E, 2026-09-06) — Twilio/Vonage service, templates, workflow tasks, DB (0279-0281), OpenAPI, i18n; see Vague E above |
| Gmail plugin | FREEZE — 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_events | Dropped (0276) |
Portal /client Phase 4 | Done — CLIENT_LEGACY_DECOMMISSION_CHECKLIST.md |
Notion / PayPal on /connections | Product call — not Vague B |
Cmd+K generate-action | Product 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
smsTemplatesi18n - Keep CRM merge
/contacts/duplicates(contacts list + dashboard)
Liquibase on this line
| Id | Purpose |
|---|---|
0271 | shared_with_client + backfill from legacy |
0272 | Drop session_files / contact_files + views |
0273 | Drop file_objects.shared_with_client |
0274 | Drop external billing tables + settings flag |
0275 | Drop progression / gamification tables |
0276 | Drop outbox_events |
0277 | Drop Proposal product tables + settings columns + email_new-proposal + ADDON quote/user_rates rollback |
0278 | Drop orphan professional_type_profiles / organization_settings / gdpr_processing_activities |
0279 | Drop user_sms_templates (SMS templates hard-delete) |
0280 | Drop SEND_SMS from workflow_task_actions.action_type CHECK |
0281 | Drop client_preferences.notification_sms |
Merge note: main may already have 0270 for billing drop; keep a single drop changeset in changelog.
Before / after
| Area | Before | After |
|---|---|---|
| CRM files | Dual tables + dead EntityFilesService | file_objects + CrmEntityFilesService |
| Session share | Orphan /share API | Removed |
| Billing sync | Pennylane in product | Accounting CSV export |
| Email/AI queues | Competing @Processors | Routers + injectable handlers |
| Scheduled export | Job name export (rejected) | export:build |
| Progression | XP / badges / nav | Deleted |
| Recommendations | Cmd+K block | Deleted (Insights remains) |
| Portal quote billing | Empty external_billing | Removed |
| SMS | Visible settings / contact tab | Deleted FE/BE + DB 0279-0281 (Vague E) |
| Doublons | Sidebar + dashboard widget | Web FE deleted; BE + Discord kept for mobile port |
outbox_events | Orphan table after Nest module delete | Dropped (0276) |
Legacy /client pages | Residual DTOs + dead PayPal URLs | Phase 4 closed; /client?returnUrl= bridge kept |
| Galleries god-file | ~8.5k LOC single service | F001 done — facade ~1.5k + subdomain services; F002 partial (~4.2k FE tab) |
| Commercial Proposal | Builder + /proposal + ADDON upsells | Deleted FE/BE + DB 0277; day-planner proposals KEEP; R2 GC done on dev + prod |
| Orphan schema bags | Profiles / org settings JSON / GDPR Art.30 register | Dropped 0278 (unused at runtime) |