# govpf/mes-demarches architecture

> Architecture diagram of the GitHub repository govpf/mes-demarches, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/govpf/mes-demarches
- Repository: https://github.com/govpf/mes-demarches

## Overview

Mes-Démarches.gov.pf is a French-Polynesia-adapted government procedures platform. Applicants submit dossiers through configured procedures; administrators define forms and routing, and instructeurs process submitted dossiers. The tree and README establish these product areas, but the sampled controllers do not expose their calls, so workflow links are marked unverified. The graph also preserves the GraphQL/API surface and the sampled rich-text editor modules; their runtime wiring is not fully shown.

Main entry points: [`app/javascript/controllers/lazy/tiptap_controller.ts`](https://github.com/govpf/mes-demarches/blob/devpf/app/javascript/controllers/lazy/tiptap_controller.ts) (Editor interaction), [`app/controllers/administrateurs/procedures_controller.rb`](https://github.com/govpf/mes-demarches/blob/devpf/app/controllers/administrateurs/procedures_controller.rb) (Procedure setup), [`app/controllers/users/dossiers_controller.rb`](https://github.com/govpf/mes-demarches/blob/devpf/app/controllers/users/dossiers_controller.rb) (Dossier submission), [`app/javascript/shared/tiptap/editor.ts`](https://github.com/govpf/mes-demarches/blob/devpf/app/javascript/shared/tiptap/editor.ts) (Editor factory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_applicants["Applicant dossiers"]
  node_applicant_dossiers["Dossier submission"]
  node_dossier_data[("Dossier records")]
end

subgraph group_configuration["Procedure configuration"]
  node_procedure_admin["Procedure setup"]
  node_form_fields["Form fields"]
  node_routing_rules["Routing rules<br/>[routing_engine.rb]"]
end

subgraph group_instruction["Dossier instruction"]
  node_dossier_review["Dossier review"]
  node_expert_reviews["Expert opinions<br/>[avis_controller.rb]"]
end

subgraph group_interfaces["API interfaces"]
  node_public_api["Public API"]
  node_versioned_api["Versioned API"]
  node_api_v2["API v2 dossiers"]
  node_graphql_queries["GraphQL queries<br/>[query_type.rb]"]
  node_stored_queries["Stored queries<br/>[stored_query.rb]"]
end

subgraph group_editor["Rich-text editor"]
  node_editor_controller["Editor interaction"]
  node_editor_actions["Formatting actions<br/>[actions.ts]"]
  node_editor_factory["Editor factory<br/>[editor.ts]"]
  node_editor_tags["Tag suggestions<br/>[tags.ts]"]
  node_stimulus_base["Controller base"]
  node_stimulus_loader["Controller loader<br/>[stimulus-loader.ts]"]
  node_manager_entry["Manager entrypoint<br/>[manager.ts]"]
end

node_applicant(("Applicant"))
node_instructeur(("Instructeur"))

node_applicant -.->|"submits dossier"| node_applicant_dossiers
node_applicant_dossiers -.->|"persists dossier"| node_dossier_data
node_procedure_admin -.->|"configures fields"| node_form_fields
node_procedure_admin -.->|"configures routing"| node_routing_rules
node_instructeur -.->|"reviews dossier"| node_dossier_review
node_expert_reviews -.->|"supports review"| node_dossier_review
node_editor_controller -->|"extends"| node_stimulus_base
node_editor_controller -->|"creates editor"| node_editor_factory
node_editor_controller -->|"dispatches actions"| node_editor_actions
node_editor_factory -->|"creates suggestions"| node_editor_tags
node_manager_entry -->|"registers controllers"| node_stimulus_loader

click node_applicant_dossiers "https://github.com/govpf/mes-demarches/blob/devpf/app/controllers/users/dossiers_controller.rb"
click node_dossier_data "https://github.com/govpf/mes-demarches/blob/devpf/app/controllers/users/dossiers_controller.rb"
click node_procedure_admin "https://github.com/govpf/mes-demarches/blob/devpf/app/controllers/administrateurs/procedures_controller.rb"
click node_form_fields "https://github.com/govpf/mes-demarches/blob/devpf/app/controllers/administrateurs/types_de_champ_controller.rb"
click node_routing_rules "https://github.com/govpf/mes-demarches/blob/devpf/app/models/routing_engine.rb"
click node_dossier_review "https://github.com/govpf/mes-demarches/blob/devpf/app/controllers/instructeurs/dossiers_controller.rb"
click node_expert_reviews "https://github.com/govpf/mes-demarches/blob/devpf/app/controllers/experts/avis_controller.rb"
click node_public_api "https://github.com/govpf/mes-demarches/blob/devpf/app/controllers/api/public/v1/dossiers_controller.rb"
click node_versioned_api "https://github.com/govpf/mes-demarches/blob/devpf/app/controllers/api/v1/dossiers_controller.rb"
click node_api_v2 "https://github.com/govpf/mes-demarches/blob/devpf/app/controllers/api/v2/dossiers_controller.rb"
click node_graphql_queries "https://github.com/govpf/mes-demarches/blob/devpf/app/graphql/types/query_type.rb"
click node_stored_queries "https://github.com/govpf/mes-demarches/blob/devpf/app/graphql/api/v2/stored_query.rb"
click node_editor_controller "https://github.com/govpf/mes-demarches/blob/devpf/app/javascript/controllers/lazy/tiptap_controller.ts"
click node_editor_actions "https://github.com/govpf/mes-demarches/blob/devpf/app/javascript/shared/tiptap/actions.ts"
click node_editor_factory "https://github.com/govpf/mes-demarches/blob/devpf/app/javascript/shared/tiptap/editor.ts"
click node_editor_tags "https://github.com/govpf/mes-demarches/blob/devpf/app/javascript/shared/tiptap/tags.ts"
click node_stimulus_base "https://github.com/govpf/mes-demarches/blob/devpf/app/javascript/controllers/application_controller.ts"
click node_stimulus_loader "https://github.com/govpf/mes-demarches/blob/devpf/app/javascript/shared/stimulus-loader.ts"
click node_manager_entry "https://github.com/govpf/mes-demarches/blob/devpf/app/javascript/entrypoints/manager.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_applicant_dossiers,node_dossier_data toneBlue
class node_procedure_admin,node_form_fields,node_routing_rules toneAmber
class node_dossier_review,node_expert_reviews toneMint
class node_public_api,node_versioned_api,node_api_v2,node_graphql_queries,node_stored_queries toneRose
class node_editor_controller,node_editor_actions,node_editor_factory,node_editor_tags,node_stimulus_base,node_stimulus_loader,node_manager_entry,node_applicant,node_instructeur toneIndigo
```

## Components

### Applicant dossiers

- [Dossier submission](https://github.com/govpf/mes-demarches/blob/devpf/app/controllers/users/dossiers_controller.rb): `app/controllers/users/dossiers_controller.rb`
- [Dossier records](https://github.com/govpf/mes-demarches/blob/devpf/app/controllers/users/dossiers_controller.rb): `app/controllers/users/dossiers_controller.rb`

### Procedure configuration

- [Procedure setup](https://github.com/govpf/mes-demarches/blob/devpf/app/controllers/administrateurs/procedures_controller.rb): `app/controllers/administrateurs/procedures_controller.rb`
- [Form fields](https://github.com/govpf/mes-demarches/blob/devpf/app/controllers/administrateurs/types_de_champ_controller.rb): `app/controllers/administrateurs/types_de_champ_controller.rb`
- [Routing rules](https://github.com/govpf/mes-demarches/blob/devpf/app/models/routing_engine.rb): `app/models/routing_engine.rb`

### Dossier instruction

- [Dossier review](https://github.com/govpf/mes-demarches/blob/devpf/app/controllers/instructeurs/dossiers_controller.rb): `app/controllers/instructeurs/dossiers_controller.rb`
- [Expert opinions](https://github.com/govpf/mes-demarches/blob/devpf/app/controllers/experts/avis_controller.rb): `app/controllers/experts/avis_controller.rb`

### API interfaces

- [Public API](https://github.com/govpf/mes-demarches/blob/devpf/app/controllers/api/public/v1/dossiers_controller.rb): `app/controllers/api/public/v1/dossiers_controller.rb`
- [Versioned API](https://github.com/govpf/mes-demarches/blob/devpf/app/controllers/api/v1/dossiers_controller.rb): `app/controllers/api/v1/dossiers_controller.rb`
- [API v2 dossiers](https://github.com/govpf/mes-demarches/blob/devpf/app/controllers/api/v2/dossiers_controller.rb): `app/controllers/api/v2/dossiers_controller.rb`
- [GraphQL queries](https://github.com/govpf/mes-demarches/blob/devpf/app/graphql/types/query_type.rb): `app/graphql/types/query_type.rb`
- [Stored queries](https://github.com/govpf/mes-demarches/blob/devpf/app/graphql/api/v2/stored_query.rb): `app/graphql/api/v2/stored_query.rb`

### Rich-text editor

- [Editor interaction](https://github.com/govpf/mes-demarches/blob/devpf/app/javascript/controllers/lazy/tiptap_controller.ts): `app/javascript/controllers/lazy/tiptap_controller.ts`
- [Formatting actions](https://github.com/govpf/mes-demarches/blob/devpf/app/javascript/shared/tiptap/actions.ts): `app/javascript/shared/tiptap/actions.ts`
- [Editor factory](https://github.com/govpf/mes-demarches/blob/devpf/app/javascript/shared/tiptap/editor.ts): `app/javascript/shared/tiptap/editor.ts`
- [Tag suggestions](https://github.com/govpf/mes-demarches/blob/devpf/app/javascript/shared/tiptap/tags.ts): `app/javascript/shared/tiptap/tags.ts`
- [Controller base](https://github.com/govpf/mes-demarches/blob/devpf/app/javascript/controllers/application_controller.ts): `app/javascript/controllers/application_controller.ts`
- [Controller loader](https://github.com/govpf/mes-demarches/blob/devpf/app/javascript/shared/stimulus-loader.ts): `app/javascript/shared/stimulus-loader.ts`
- [Manager entrypoint](https://github.com/govpf/mes-demarches/blob/devpf/app/javascript/entrypoints/manager.ts): `app/javascript/entrypoints/manager.ts`

### Other components

- **Applicant**
- **Instructeur**

## Connections

- Applicant → Dossier submission: submits dossier
- Dossier submission → Dossier records: persists dossier (evidence: `app/controllers/users/dossiers_controller.rb`)
- Procedure setup → Form fields: configures fields
- Procedure setup → Routing rules: configures routing
- Instructeur → Dossier review: reviews dossier
- Expert opinions → Dossier review: supports review
- Editor interaction → Controller base: extends (evidence: `app/javascript/controllers/lazy/tiptap_controller.ts`)
- Editor interaction → Editor factory: creates editor (evidence: `app/javascript/controllers/lazy/tiptap_controller.ts`)
- Editor interaction → Formatting actions: dispatches actions (evidence: `app/javascript/controllers/lazy/tiptap_controller.ts`)
- Editor factory → Tag suggestions: creates suggestions (evidence: `app/javascript/shared/tiptap/editor.ts`)
- Manager entrypoint → Controller loader: registers controllers (evidence: `app/javascript/entrypoints/manager.ts`)
