# enzofrnt/myownnotion architecture

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

- Interactive diagram: https://gitdiagram.com/enzofrnt/myownnotion
- Repository: https://github.com/enzofrnt/myownnotion

## Overview

MyOwnNotion is a self-hosted personal knowledge workspace for hierarchical pages, block editing, linked knowledge graphs, tasks, and databases, used from web and desktop clients. The main flow is an owner editing and organizing workspace content; client services provide local content and synchronization, while the API handles page operations and persistence. Distinct product branches include databases, search, protected files and security, backup/restore, Notion import, and MCP access. The README establishes the product capabilities; sampled source and the source index support only the specific internal links shown below.

Main entry points: [`apps/web/src/services/local-content.ts`](https://github.com/enzofrnt/myownnotion/blob/main/apps/web/src/services/local-content.ts) (Local content), [`apps/api/src/page-state/page-operation-service.ts`](https://github.com/enzofrnt/myownnotion/blob/main/apps/api/src/page-state/page-operation-service.ts) (Page operations), [`apps/api/src/app.ts`](https://github.com/enzofrnt/myownnotion/blob/main/apps/api/src/app.ts) (API application), [`packages/database/src/client.ts`](https://github.com/enzofrnt/myownnotion/blob/main/packages/database/src/client.ts) (PostgreSQL store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Workspace clients"]
  node_web["Web workspace<br/>[app.tsx]"]
  node_desktop["Desktop client<br/>[main.ts]"]
end

subgraph group_content["Content and sync"]
  node_local_content["Local content<br/>[local-content.ts]"]
  node_editor["Block editor<br/>[editor-engine.ts]"]
  node_page_operations["Page operations"]
  node_page_history["Page history"]
  node_realtime_sync["Realtime sync<br/>[page-sync-hub.ts]"]
  node_block_tree["Block tree model<br/>[block-tree.ts]"]
  node_contracts["Content contracts<br/>[content-api.ts]"]
end

subgraph group_api_features["API capabilities"]
  node_database_views["Database queries"]
  node_search["Workspace search<br/>[search-service.ts]"]
  node_knowledge_graph["Knowledge graph<br/>[project.ts]"]
  node_notion_import["Notion import<br/>[apply.ts]"]
  node_mcp_access["MCP access<br/>[access-service.ts]"]
  node_api["API application<br/>[app.ts]"]
end

subgraph group_security["Security and continuity"]
  node_file_service["Protected files"]
  node_protected_content["Protected content"]
  node_canonical_payloads["Canonical payloads"]
  node_backup["Backup and restore<br/>[service.ts]"]
end

subgraph group_persistence["Canonical persistence"]
  node_database[("PostgreSQL store<br/>[client.ts]")]
end

node_owner(("Workspace owner"))

node_owner -->|"uses"| node_web
node_owner -->|"uses"| node_desktop
node_web -.->|"uses"| node_local_content
node_local_content -->|"serves"| node_editor
node_local_content -->|"uses API"| node_page_operations
node_local_content -->|"uses"| node_contracts
node_local_content -.->|"uses local query"| node_database_views
node_page_operations -->|"uses"| node_page_history
node_page_operations -->|"uses"| node_protected_content
node_page_operations -->|"updates"| node_search
node_page_operations -->|"persists via"| node_database
node_page_operations -->|"uses"| node_block_tree
node_local_content -->|"transports sync"| node_realtime_sync
node_database_views -->|"resolves content"| node_protected_content
node_database_views -->|"reads projections"| node_database
node_search -->|"reads sources"| node_database
node_file_service -->|"protects payloads"| node_protected_content
node_file_service -->|"uses repositories"| node_database
node_protected_content -->|"seals payloads"| node_canonical_payloads
node_api -->|"configures"| node_backup
node_api -->|"configures"| node_mcp_access
node_api -->|"uses"| node_database
node_api -.->|"configures"| node_file_service
node_api -.->|"configures"| node_notion_import
node_local_content -->|"uses graph"| node_knowledge_graph
node_desktop -.->|"uses workspace"| node_local_content

click node_web "https://github.com/enzofrnt/myownnotion/blob/main/apps/web/src/app.tsx"
click node_desktop "https://github.com/enzofrnt/myownnotion/blob/main/apps/desktop/src/main.ts"
click node_local_content "https://github.com/enzofrnt/myownnotion/blob/main/apps/web/src/services/local-content.ts"
click node_editor "https://github.com/enzofrnt/myownnotion/blob/main/apps/web/src/features/editor/editor-engine.ts"
click node_page_operations "https://github.com/enzofrnt/myownnotion/blob/main/apps/api/src/page-state/page-operation-service.ts"
click node_page_history "https://github.com/enzofrnt/myownnotion/blob/main/apps/api/src/page-state/page-history-service.ts"
click node_realtime_sync "https://github.com/enzofrnt/myownnotion/blob/main/apps/api/src/realtime/page-sync-hub.ts"
click node_database_views "https://github.com/enzofrnt/myownnotion/blob/main/apps/api/src/databases/database-query-service.ts"
click node_search "https://github.com/enzofrnt/myownnotion/blob/main/apps/api/src/search/search-service.ts"
click node_knowledge_graph "https://github.com/enzofrnt/myownnotion/blob/main/packages/graph/src/project.ts"
click node_notion_import "https://github.com/enzofrnt/myownnotion/blob/main/apps/api/src/imports/notion/apply.ts"
click node_mcp_access "https://github.com/enzofrnt/myownnotion/blob/main/apps/api/src/mcp/access-service.ts"
click node_file_service "https://github.com/enzofrnt/myownnotion/blob/main/apps/api/src/files/protected-file-service.ts"
click node_protected_content "https://github.com/enzofrnt/myownnotion/blob/main/apps/api/src/security/protected-content.ts"
click node_canonical_payloads "https://github.com/enzofrnt/myownnotion/blob/main/apps/api/src/security/canonical-payloads.ts"
click node_backup "https://github.com/enzofrnt/myownnotion/blob/main/apps/api/src/backup/full/service.ts"
click node_api "https://github.com/enzofrnt/myownnotion/blob/main/apps/api/src/app.ts"
click node_database "https://github.com/enzofrnt/myownnotion/blob/main/packages/database/src/client.ts"
click node_block_tree "https://github.com/enzofrnt/myownnotion/blob/main/packages/page-state/src/block-tree.ts"
click node_contracts "https://github.com/enzofrnt/myownnotion/blob/main/packages/contracts/src/content-api.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_web,node_desktop toneBlue
class node_local_content,node_editor,node_page_operations,node_page_history,node_realtime_sync,node_block_tree,node_contracts toneAmber
class node_database_views,node_search,node_knowledge_graph,node_notion_import,node_mcp_access,node_api toneMint
class node_file_service,node_protected_content,node_canonical_payloads,node_backup toneRose
class node_database,node_owner toneIndigo
```

## Components

### Workspace clients

- [Web workspace](https://github.com/enzofrnt/myownnotion/blob/main/apps/web/src/app.tsx): `apps/web/src/app.tsx`
- [Desktop client](https://github.com/enzofrnt/myownnotion/blob/main/apps/desktop/src/main.ts): `apps/desktop/src/main.ts`

### Content and sync

- [Local content](https://github.com/enzofrnt/myownnotion/blob/main/apps/web/src/services/local-content.ts): `apps/web/src/services/local-content.ts`
- [Block editor](https://github.com/enzofrnt/myownnotion/blob/main/apps/web/src/features/editor/editor-engine.ts): `apps/web/src/features/editor/editor-engine.ts`
- [Page operations](https://github.com/enzofrnt/myownnotion/blob/main/apps/api/src/page-state/page-operation-service.ts): `apps/api/src/page-state/page-operation-service.ts`
- [Page history](https://github.com/enzofrnt/myownnotion/blob/main/apps/api/src/page-state/page-history-service.ts): `apps/api/src/page-state/page-history-service.ts`
- [Realtime sync](https://github.com/enzofrnt/myownnotion/blob/main/apps/api/src/realtime/page-sync-hub.ts): `apps/api/src/realtime/page-sync-hub.ts`
- [Block tree model](https://github.com/enzofrnt/myownnotion/blob/main/packages/page-state/src/block-tree.ts): `packages/page-state/src/block-tree.ts`
- [Content contracts](https://github.com/enzofrnt/myownnotion/blob/main/packages/contracts/src/content-api.ts): `packages/contracts/src/content-api.ts`

### API capabilities

- [Database queries](https://github.com/enzofrnt/myownnotion/blob/main/apps/api/src/databases/database-query-service.ts): `apps/api/src/databases/database-query-service.ts`
- [Workspace search](https://github.com/enzofrnt/myownnotion/blob/main/apps/api/src/search/search-service.ts): `apps/api/src/search/search-service.ts`
- [Knowledge graph](https://github.com/enzofrnt/myownnotion/blob/main/packages/graph/src/project.ts): `packages/graph/src/project.ts`
- [Notion import](https://github.com/enzofrnt/myownnotion/blob/main/apps/api/src/imports/notion/apply.ts): `apps/api/src/imports/notion/apply.ts`
- [MCP access](https://github.com/enzofrnt/myownnotion/blob/main/apps/api/src/mcp/access-service.ts): `apps/api/src/mcp/access-service.ts`
- [API application](https://github.com/enzofrnt/myownnotion/blob/main/apps/api/src/app.ts): `apps/api/src/app.ts`

### Security and continuity

- [Protected files](https://github.com/enzofrnt/myownnotion/blob/main/apps/api/src/files/protected-file-service.ts): `apps/api/src/files/protected-file-service.ts`
- [Protected content](https://github.com/enzofrnt/myownnotion/blob/main/apps/api/src/security/protected-content.ts): `apps/api/src/security/protected-content.ts`
- [Canonical payloads](https://github.com/enzofrnt/myownnotion/blob/main/apps/api/src/security/canonical-payloads.ts): `apps/api/src/security/canonical-payloads.ts`
- [Backup and restore](https://github.com/enzofrnt/myownnotion/blob/main/apps/api/src/backup/full/service.ts): `apps/api/src/backup/full/service.ts`

### Canonical persistence

- [PostgreSQL store](https://github.com/enzofrnt/myownnotion/blob/main/packages/database/src/client.ts): `packages/database/src/client.ts`

### Other components

- **Workspace owner**

## Connections

- Workspace owner → Web workspace: uses
- Workspace owner → Desktop client: uses
- Web workspace → Local content: uses
- Local content → Block editor: serves (evidence: `apps/web/src/features/editor/editor-engine.ts`)
- Local content → Page operations: uses API (evidence: `apps/web/src/services/local-content.ts`)
- Local content → Content contracts: uses (evidence: `apps/web/src/services/local-content.ts`)
- Local content → Database queries: uses local query
- Page operations → Page history: uses (evidence: `apps/api/src/page-state/page-operation-service.ts`)
- Page operations → Protected content: uses (evidence: `apps/api/src/page-state/page-operation-service.ts`)
- Page operations → Workspace search: updates (evidence: `apps/api/src/page-state/page-operation-service.ts`)
- Page operations → PostgreSQL store: persists via (evidence: `apps/api/src/page-state/page-operation-service.ts`)
- Page operations → Block tree model: uses (evidence: `apps/api/src/page-state/page-operation-service.ts`)
- Local content → Realtime sync: transports sync (evidence: `apps/web/src/services/local-content.ts`)
- Database queries → Protected content: resolves content (evidence: `apps/api/src/databases/database-query-service.ts`)
- Database queries → PostgreSQL store: reads projections (evidence: `apps/api/src/databases/database-query-service.ts`)
- Workspace search → PostgreSQL store: reads sources (evidence: `apps/api/src/search/search-service.ts`)
- Protected files → Protected content: protects payloads (evidence: `apps/api/src/files/protected-file-service.ts`)
- Protected files → PostgreSQL store: uses repositories (evidence: `apps/api/src/files/protected-file-service.ts`)
- Protected content → Canonical payloads: seals payloads (evidence: `apps/api/src/security/protected-content.ts`)
- API application → Backup and restore: configures (evidence: `apps/api/src/app.ts`)
- API application → MCP access: configures (evidence: `apps/api/src/app.ts`)
- API application → PostgreSQL store: uses (evidence: `apps/api/src/app.ts`)
- API application → Protected files: configures (evidence: `apps/api/src/app.ts`)
- API application → Notion import: configures
- Local content → Knowledge graph: uses graph (evidence: `apps/web/src/services/local-content.ts`)
- Desktop client → Local content: uses workspace
