diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 83d6e1b..51d62d2 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -1,7 +1,8 @@ -# Architecture FlowDeck — Document Complet v3.0 +# Architecture FlowDeck — Document Complet v4.0 -> **Version:** 3.0 · **Date:** 2026-07-14 · **Auteur:** Hermes-Deepin +> **Version:** 4.0 · **Date:** 2026-07-20 · **Auteur:** Hermes-Deepin > **Cible:** Clone Notion intégré à Gitea/GitHub — multi-comptes, multi-intégrations +> **Version déployée:** v4.0.x (production : https://flowdeck.dracodev.net) --- @@ -47,34 +48,31 @@ FlowDeck est un **clone de Notion** intégré à Gitea. Il recrée l'expérience │ │ │ ┌─────────────────────────────────────────────────────────┐ │ │ │ Templates Jinja2 (SSR) │ │ -│ │ ├─ dashboard.html — Projets + sidebar │ │ -│ │ ├─ board.html — Kanban (wrapper) │ │ -│ │ ├─ board_fragment.html— Cartes Kanban │ │ -│ │ ├─ table_view.html — Vue table │ │ -│ │ ├─ calendar_view.html — Vue calendrier (v1.6) │ │ -│ │ ├─ timeline_view.html — Vue Gantt (v1.6) │ │ -│ │ ├─ gallery_view.html — Vue galerie (v1.6) │ │ -│ │ ├─ list_view.html — Vue liste (v1.6) │ │ -│ │ ├─ status_overview.html — Donut SVG │ │ -│ │ ├─ team_load.html — Barres stacked │ │ -│ │ ├─ detailed_board.html— Board détaillé │ │ -│ │ ├─ card_detail.html — Modale détail carte │ │ -│ │ ├─ card.html — Carte individuelle │ │ -│ │ ├─ page_editor.html — Éditeur de blocs │ │ -│ │ ├─ my_tasks.html — Dashboard unifié (v1.9) │ │ -│ │ ├─ library.html — Bibliothèque de pages │ │ -│ │ ├─ trash.html — Corbeille │ │ -│ │ ├─ accounts.html — Gestion comptes │ │ -│ │ ├─ notes.html — Notes Markdown │ │ -│ │ └─ base.html — Layout commun │ │ +│ │ ├─ base.html — Layout Notion commun (sidebar) │ │ +│ │ ├─ _header.html — Topbar + breadcrumbs │ │ +│ │ ├─ _workspace_tree_macro.html — Macro arbre sidebar │ │ +│ │ ├─ landing.html — Landing page non-auth │ │ +│ │ ├─ workspaces.html — Page Workspaces (locale/Gitea) │ │ +│ │ ├─ library.html — Bibliothèque multi-onglets │ │ +│ │ ├─ local_workspace.html — Workspace local (explorer) │ │ +│ │ ├─ page_editor.html — Éditeur de blocs │ │ +│ │ ├─ trash.html — Corbeille (local only) │ │ +│ │ ├─ settings.html — Settings / My Account / Admin │ │ +│ │ ├─ accounts.html — Gestion comptes admin │ │ +│ │ ├─ board.html — Kanban (wrapper) │ │ +│ │ ├─ board_fragment.html — Cartes Kanban │ │ +│ │ ├─ table_view.html — Vue table │ │ +│ │ ├─ login.html — Login/Register (local + OAuth) │ │ +│ │ ├─ public_page.html — Page publiée (/p/slug) │ │ +│ │ └─ (legacy: dashboard, detailed_board, card_detail, etc.) │ │ │ └─────────────────────────────────────────────────────────┘ │ │ │ │ ┌─────────────────────────────────────────────────────────┐ │ -│ │ JavaScript (CDN, pas de build step) │ │ -│ │ ├─ HTMX 1.9 — AJAX sans JS │ │ +│ │ JavaScript (servi localement, pas de CDN externe) │ │ │ │ ├─ Alpine.js 3.14 — Interactivité légère │ │ +│ │ ├─ HTMX 1.9 — AJAX sans JS (legacy) │ │ │ │ ├─ SortableJS 1.15 — Drag & drop │ │ -│ │ └─ highlight.js — Syntax highlighting (v2.0) │ │ +│ │ └─ Prism.js — Syntax highlighting │ │ │ └─────────────────────────────────────────────────────────┘ │ │ │ │ ┌─────────────────────────────────────────────────────────┐ │ @@ -95,17 +93,27 @@ FlowDeck est un **clone de Notion** intégré à Gitea. Il recrée l'expérience │ │ │ ┌─────────────────────────────────────────────────────────┐ │ │ │ ROUTERS │ │ -│ │ ├─ dashboard.py — / Dashboard │ │ -│ │ ├─ board.py — /board/{o}/{r} Board + vues │ │ -│ │ │ — /board/api/... APIs board │ │ -│ │ ├─ api.py — /api/... CRUD + sync │ │ -│ │ ├─ notes.py — /notes/{o}/{r} Notes │ │ -│ │ ├─ auth.py — /auth/... OAuth2 │ │ -│ │ ├─ webhooks.py — /webhooks/... Gitea hooks │ │ -│ │ ├─ my_tasks.py — /my-tasks (v1.9) │ │ -│ │ ├─ pages.py — /pages/... Pages CRUD │ │ -│ │ ├─ collections.py — /db/... Collections │ │ -│ │ └─ editor.py — /api/editor/... Block editor │ │ +│ │ ├─ main.py — FastAPI app, lifespan, CORS, 404 │ │ +│ │ ├─ dashboard.py — /, /workspaces, /library, /help │ │ +│ │ │ — /trash, /settings, /accounts │ │ +│ │ │ — /p/{slug} (pages publiques) │ │ +│ │ │ — _sidebar_data() — données sidebar │ │ +│ │ ├─ board.py — /board/{o}/{r} Board + vues │ │ +│ │ │ — /board/api/pages CRUD pages │ │ +│ │ │ — /board/api/trash Trash │ │ +│ │ ├─ api.py — /api/... CRUD + sync │ │ +│ │ ├─ auth.py — /auth/... OAuth2 + local │ │ +│ │ ├─ local_workspace.py— /api/local-workspace CRUD + upload │ │ +│ │ ├─ my_tasks.py — /my-tasks Dashboard │ │ +│ │ ├─ library.py — /api/library/* API bibliothèque│ │ +│ │ ├─ pages.py — /pages/... Pages CRUD │ │ +│ │ ├─ collections.py — /db/... Collections │ │ +│ │ ├─ editor.py — /api/editor/... Block editor │ │ +│ │ ├─ private.py — /api/private/* Section privée │ │ +│ │ ├─ public_api.py — /api/public/* Public API │ │ +│ │ ├─ workspace.py — Workspaces API + Gitea projets │ │ +│ │ ├─ webhooks.py — /webhooks/... Gitea hooks │ │ +│ │ └─ admin.py — /api/admin/* Admin users │ │ │ └─────────────────────────────────────────────────────────┘ │ │ │ │ ┌─────────────────────────────────────────────────────────┐ │ @@ -138,6 +146,11 @@ FlowDeck est un **clone de Notion** intégré à Gitea. Il recrée l'expérience │ │ │ ├─ property_values (legacy → collection_pages) │ │ │ │ ├─ ai_keywords │ │ │ │ │ │ ├─ pages │ │ │ +│ │ │ ├─ page_shares (v4.0) │ │ │ +│ │ │ ├─ recents (v4.0) │ │ │ +│ │ │ ├─ tags (v4.0) │ │ │ +│ │ │ ├─ page_tags (v4.0) │ │ │ +│ │ │ ├─ gitea_private_pages (v4.0) │ │ │ │ │ │ ├─ users │ │ │ │ │ │ ├─ user_tokens │ │ │ │ │ │ ├─ workspaces (v2.0) │ │ │ @@ -685,42 +698,146 @@ POST /favorites → Ajouter favori DELETE /favorites/{id} → Retirer favori ``` +### 4.6 Routes Sidebar & Library (v4.0) + +``` +GET /library → Bibliothèque dynamique +GET /api/library/recents → Pages récentes +GET /api/library/favorites → Favoris +GET /api/library/shared → Pages partagées +GET /api/library/published → Pages publiées +GET /api/library/private → Pages privées +GET /api/library/workspace → Pages du workspace + +GET /api/local-workspace/items → Arborescence workspace +POST /api/local-workspace/items → Créer page/dossier +PUT /api/local-workspace/items/{id} → Renommer +DELETE /api/local-workspace/items/{id} → Soft delete +POST /api/local-workspace/upload → Upload fichier +GET /api/files/{ws_id}/{filename} → Servir fichier uploadé + +GET /help → Page d'aide complète +GET /api/public/pages/{slug} → Page publique +``` + +### 4.7 Routes Share & Publish (v4.0) + +``` +POST /api/pages/{id}/share → Partager une page +DELETE /api/pages/{id}/share/{share_id} → Retirer partage +GET /api/pages/{id}/shares → Liste partages +POST /api/pages/{id}/publish → Publier page +DELETE /api/pages/{id}/publish → Dépublier +``` + --- -## 5. Frontend +## 5. Système d'authentification (v4.0) + +FlowDeck supporte **3 méthodes d'authentification** et la **connexion d'intégrations multiples** à un même compte local. + +### 5.1 Types de comptes + +| Type | Auth | Workspaces | Intégrations | +|------|------|------------|--------------| +| **Local pur** | email + password | Locaux uniquement | Aucune | +| **Local + intégrations** | email + password | Locaux + distants | Gitea et/ou GitHub | +| **OAuth pur** | Gitea ou GitHub | Distants uniquement | Non-déconnectable | + +### 5.2 Comportement du sidebar selon le type de compte + +``` +LOCAL PUR: + ├─ 📁 [nom workspace local] + ├─ 📅 Meetings + ├─ 🕒 Recents + ├─ ⭐ Favorites + ├─ 🤖 Agents + ├─ 👥 Shared ← visible si pages partagées + ├─ 🌐 Published ← visible si pages publiées + ├─ (Private caché) + └─ 📚 Library / ✅ My Tasks / 🗑️ Trash / ❓ Help + +LOCAL + GITEA/GITHUB: + ├─ 🔗 [owner/repo] ← workspace distant actif + ├─ 📅 Meetings + ├─ 🕒 Recents + ├─ ⭐ Favorites + ├─ 🤖 Agents + ├─ 👥 Shared + ├─ 🌐 Published + ├─ 🔒 Private ← visible (fichiers locaux liés au projet distant) + └─ 📚 / ✅ / 🗑️ / ❓ + +OAUTH PUR (GITEA/GITHUB): + ├─ 🔗 [owner/repo] ← identité = compte Gitea/GitHub + ├─ 🕒 Recents + ├─ ⭐ Favorites + ├─ 👥 Shared + ├─ 🌐 Published + ├─ (Private caché) + └─ 📚 / ✅ / ❓ (Trash caché — pas de workspace local) +``` + +### 5.3 Règles d'affichage + +- **Section Private** : visible UNIQUEMENT si compte local + workspace distant actif +- **Trash** : visible si `auth_method == 'local'` ou si des pages locales existent +- **Boutons New File/New Folder** : cachés si `has_active_workspace == False` +- **Message "No workspace open"** : affiché dans la section Workspace si aucun workspace actif +- **Header sidebar** : toujours le compte local si auth_method=local, même avec intégrations + +### 5.4 cookie `flowdeck_workspace` + +- `""` → aucun workspace actif +- `"42"` → workspace local ID 42 +- `"gitea:owner:repo"` → workspace distant Gitea +- Nettoyage automatique si cookie invalide (workspace supprimé ou autre user) + +--- + +## 6. Frontend ### 5.1 Layout -``` +```ascii ┌──────────────────────────────────────────────────────────────┐ -│ TOPBAR (44px, sticky) │ -│ ┌──────────┬──────────────────────────────────┬────────────┐ │ -│ │ Logo │ Breadcrumbs: WS > Collection │ Share... │ │ -│ │ FlowDeck │ (ou WS > Collection > Page) │ Settings │ │ -│ └──────────┴──────────────────────────────────┴────────────┘ │ +│ TOPBAR (unified-header) │ +│ ┌──────┬───────────────────────────────────────┬───────────┐ │ +│ │ «» │ Breadcrumbs: 🏠 Workspaces │ Share ⚙ │ │ +│ └──────┴───────────────────────────────────────┴───────────┘ │ ├────────────┬─────────────────────────────────────────────────┤ │ SIDEBAR │ CONTENU PRINCIPAL │ │ (240px) │ │ -│ │ ┌─────────────────────────────────────────────┐│ -│ Workspace │ │ DATABASE VIEW ││ -│ header │ │ ┌──────┬──────┬──────┬──────┬──────────┐ ││ -│ │ │ │Title │Statut│Priori│Assign│Due Date │ ││ -│ 🔍 Search │ │ ├──────┼──────┼──────┼──────┼──────────┤ ││ -│ │ │ │Tâche1│Todo │ P1 │Bruno │15 juil │ ││ -│ ▼ Recents │ │ │Tâche2│Doing │ P2 │ — │20 juil │ ││ -│ · Proj A │ │ │Tâche3│Done │ P3 │Marie │10 juil │ ││ -│ · Proj B │ │ └──────┴──────┴──────┴──────┴──────────┘ ││ -│ │ │ [+ New] [Filter] [Sort] [Search] [...] ││ -│ ▼ Private │ └─────────────────────────────────────────────┘│ -│ · Notes │ │ -│ │ ┌─ Barre d'outils ────────────────────────────┐│ -│ ▼ Shared │ │ [Table▼] [Kanban] [Calendar] [Gallery] ... ││ -│ · ... │ │ [Group▼] [Filter▼] [Sort▼] [Properties▼] ││ +│ │ ┌─ Help Page ────────────────────────────────┐│ +│ ┌────────┐ │ │ ┌──────────────┐ ┌──────────────┐ ││ +│ │ Header │ │ │ │ 🚀 Getting │ │ 📝 Pages │ (...) ││ +│ │ [D] │ │ │ │ Started │ │ & Editor │ ││ +│ │ Draco │ │ │ └──────────────┘ └──────────────┘ ││ +│ └────────┘ │ └─────────────────────────────────────────────┘│ +│ │ │ +│ 🏠 💬 📨 🔍│ ┌─ Library ─────────────────────────────────┐│ +│ │ │ [Recents|Favorites|Shared|Published|...] ││ +│ 📁 Worksp. │ │ ┌──────┬──────────┬──────────┬───────────┐ ││ +│ 📄 New Pg │ │ │Name │Created by│Source │Last edited│ ││ +│ 📁 New Fl │ │ ├──────┼──────────┼──────────┼───────────┤ ││ +│ 📄 page 1 │ │ │doc A │Draco │Local │10 min ago │ ││ +│ 📄 page 2 │ │ │doc B │bruno │Gitea │2 hours ago│ ││ +│ │ │ └──────┴──────────┴──────────┴───────────┘ ││ +│ 📅 Meeting │ └─────────────────────────────────────────────┘│ +│ 🕒 Recents │ │ +│ ⭐ Favoris │ ┌─ Workspaces ───────────────────────────────┐│ +│ 🤖 Agents │ │ ┌──────────┐ ┌──────────┐ ┌───┐ ┌───┐ ││ +│ 👥 Shared │ │ │Project A │ │Project B │ │ + │ │ + │ ││ +│ 🌐 Publ. │ │ │3 pages │ │12 pages │ │ │ │ │ ││ +│ │ │ └──────────┘ └──────────┘ └───┘ └───┘ ││ +│ ══════════ │ └─────────────────────────────────────────────┘│ +│ 📚 Library │ │ +│ ✅ My Task │ ┌─ Settings ─────────────────────────────────┐│ +│ 🗑️ Trash │ │ My Account | Admin | Integrations ││ +│ ❓ Help │ │ [Upload photo] [Full Name] [Email] [...] ││ │ │ └─────────────────────────────────────────────┘│ -│ ────────── │ │ -│ [+New page]│ ┌─ Contenu de la vue ─────────────────────────┐│ -│ (sticky │ │ (table / board / calendar / gallery / ...) ││ -│ footer) │ └─────────────────────────────────────────────┘│ +│ 💬 [+📄] │ │ └────────────┴─────────────────────────────────────────────────┘ ``` @@ -1553,7 +1670,41 @@ docker compose restart flowdeck - [Notion Help — Databases](https://www.notion.com/help/intro-to-databases) - [Notion Help — Tasks & Dependencies](https://www.notion.com/help/tasks-and-dependencies) - [Notion Help — Relations & Rollups](https://www.notion.com/help/relations-and-rollups) -- [Notion Data Sources (2025)](https://www.notionapps.com/blog/notion-data-sources-update-2025/) -- [react-notion-x](https://github.com/NotionX/react-notion-x) - [FlowDeck — NOTION_DATABASE_TASKS_GUIDE.md](docs/NOTION_DATABASE_TASKS_GUIDE.md) - [FlowDeck — ROADMAP.md](ROADMAP.md) + +--- + +## 16. Versions à venir + +### v4.1.0 — Content Blocks enrichis (priorité standard) + +- **Callout boxes** — Blocs d'alerte (info, warning, tip, danger) +- **Table of Contents** — Auto-généré depuis les headings +- **LaTeX / KaTeX** — Formules mathématiques +- **Toggle lists** — Listes pliables/dépliables +- **Multi-columns** — Mise en page 2-3 colonnes + +### v4.2.0 — Export (priorité standard) + +- Export **Markdown** avec images +- Export **PDF** (via WeasyPrint ou headless Chrome) +- Export **HTML** standalone (page auto-suffisante) + +### v4.3.0 — Collaboration (priorité basse) + +- **Commentaires inline** sur les pages +- **@mentions** pour notifier des utilisateurs +- **Notifications email** (changements, mentions) +- **Permissions par workspace** (viewer, editor, admin) + +### v5.0.0 — Plateforme avancée (futur) + +- **AI Assistants** — Génération de contenu, résumés, suggestions +- **Embeds** — Vidéos, PDF, Figma, Google Docs +- **Automatisations** — Règles déclenchées sur événements (Notion-style) +- **Base de données avancée** — Relations inter-collections, rollups +- **Kanban flexible** — Colonnes custom, WIP limits +- **API publique REST** — Tokens d'accès pour intégrations tierces +- **Volume Docker persistant** — `/data` monté pour survie des données +- **PostgreSQL** — Migration optionnelle pour scaling