# usememos/memos architecture

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

- Interactive diagram: https://gitdiagram.com/usememos/memos
- Repository: https://github.com/usememos/memos

## Overview

Memos is a self-hosted, Markdown-first notes timeline: users create memos, add files, find and revisit them, and choose whether to keep them private or share them. The runtime includes a web client, an HTTP/API server, authentication, memo and attachment handling, persistent storage, and optional integrations. The README documents search, tags, reusable views, timeline browsing, and full export; these are represented as product capabilities, but their internal call paths are not inferred from the sampled files. Edges are limited to relationships visible in the excerpts or README.

Main entry points: [`server/server.go`](https://github.com/usememos/memos/blob/main/server/server.go) (HTTP server), [`store/storage.go`](https://github.com/usememos/memos/blob/main/store/storage.go) (Attachment storage), [`server/api/v1/auth_service_session.go`](https://github.com/usememos/memos/blob/main/server/api/v1/auth_service_session.go) (Authentication API), [`web/src/components/MemoEditor/index.tsx`](https://github.com/usememos/memos/blob/main/web/src/components/MemoEditor/index.tsx) (Memo editor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_webapp["Web application<br/>[App.tsx]"]
  node_memoeditor["Memo editor<br/>[index.tsx]"]
  node_memocontent["Markdown rendering<br/>[pipeline.ts]"]
  node_timeline["Timeline and search<br/>[PagedMemoList.tsx]"]
  node_calendar["Calendar browsing<br/>[CalendarView.tsx]"]
  node_settings["Storage settings<br/>[StorageSection.tsx]"]
end

subgraph group_api["HTTP and API"]
  node_server["HTTP server<br/>[server.go]"]
  node_connect["Connect handlers"]
  node_authapi["Authentication API"]
  node_memoapi["Memo API"]
  node_attachmentapi["Attachment API"]
  node_mcpendpoint["MCP endpoint<br/>[service.go]"]
end

subgraph group_domain["Memo features"]
  node_memo["Memo lifecycle<br/>[memo_service.go]"]
  node_sharing["Visibility and sharing"]
  node_memoexport["Memo export<br/>[writer.go]"]
  node_auth["Token authentication<br/>[authenticator.go]"]
  node_attachmentfiles["Attachment transfer"]
end

subgraph group_persistence["Persistence"]
  node_store["Store interfaces<br/>[store.go]"]
  node_database[("Database drivers<br/>[sqlite.go]")]
  node_storage["Attachment storage<br/>[storage.go]"]
end

subgraph group_integrations["Integrations"]
  node_s3["S3 provider<br/>[s3.go]"]
  node_email["Email notifications<br/>[email.go]"]
  node_ai["AI providers<br/>[resolver.go]"]
  node_idp["Identity providers<br/>[idp.go]"]
end

node_user(("User"))

node_user -->|"uses"| node_webapp
node_server -->|"serves"| node_webapp
node_server -->|"registers routes"| node_attachmentapi
node_server -->|"registers gateway"| node_memoapi
node_attachmentapi -->|"resolves storage"| node_storage
node_storage -->|"uses driver"| node_s3
node_authapi -->|"authenticates refresh"| node_auth
node_authapi -->|"updates tokens"| node_store
node_memoapi -->|"builds query"| node_store
node_user -->|"writes Markdown"| node_memoeditor
node_user -->|"finds memos"| node_timeline
node_user -->|"browses timeline"| node_calendar
node_user -->|"chooses visibility"| node_sharing
node_user -->|"exports memos"| node_memoexport
node_memoeditor -.->|"renders Markdown"| node_memocontent
node_settings -.->|"configures storage"| node_storage

click node_webapp "https://github.com/usememos/memos/blob/main/web/src/App.tsx"
click node_memoeditor "https://github.com/usememos/memos/blob/main/web/src/components/MemoEditor/index.tsx"
click node_memocontent "https://github.com/usememos/memos/blob/main/web/src/components/MemoContent/pipeline.ts"
click node_timeline "https://github.com/usememos/memos/blob/main/web/src/components/PagedMemoList/PagedMemoList.tsx"
click node_calendar "https://github.com/usememos/memos/blob/main/web/src/components/CalendarView/CalendarView.tsx"
click node_settings "https://github.com/usememos/memos/blob/main/web/src/components/Settings/StorageSection.tsx"
click node_server "https://github.com/usememos/memos/blob/main/server/server.go"
click node_connect "https://github.com/usememos/memos/blob/main/proto/gen/api/v1/apiv1connect/memo_service.connect.go"
click node_authapi "https://github.com/usememos/memos/blob/main/server/api/v1/auth_service_session.go"
click node_memoapi "https://github.com/usememos/memos/blob/main/server/api/v1/memo_service_query.go"
click node_attachmentapi "https://github.com/usememos/memos/blob/main/server/api/v1/attachment_service_storage.go"
click node_mcpendpoint "https://github.com/usememos/memos/blob/main/server/mcp/service.go"
click node_memo "https://github.com/usememos/memos/blob/main/server/api/v1/memo_service.go"
click node_sharing "https://github.com/usememos/memos/blob/main/server/api/v1/memo_share_service.go"
click node_memoexport "https://github.com/usememos/memos/blob/main/core/memoexport/writer.go"
click node_auth "https://github.com/usememos/memos/blob/main/server/auth/authenticator.go"
click node_store "https://github.com/usememos/memos/blob/main/store/store.go"
click node_database "https://github.com/usememos/memos/blob/main/store/db/sqlite/sqlite.go"
click node_storage "https://github.com/usememos/memos/blob/main/store/storage.go"
click node_attachmentfiles "https://github.com/usememos/memos/blob/main/server/api/v1/attachment_service_storage.go"
click node_s3 "https://github.com/usememos/memos/blob/main/provider/storage/s3/s3.go"
click node_email "https://github.com/usememos/memos/blob/main/core/notification/email.go"
click node_ai "https://github.com/usememos/memos/blob/main/provider/ai/resolver.go"
click node_idp "https://github.com/usememos/memos/blob/main/provider/idp/idp.go"

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_webapp,node_memoeditor,node_memocontent,node_timeline,node_calendar,node_settings,node_user toneBlue
class node_server,node_connect,node_authapi,node_memoapi,node_attachmentapi,node_mcpendpoint toneAmber
class node_memo,node_sharing,node_memoexport,node_auth,node_attachmentfiles toneMint
class node_store,node_database,node_storage toneRose
class node_s3,node_email,node_ai,node_idp toneIndigo
```

## Components

### Web client

- [Web application](https://github.com/usememos/memos/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [Memo editor](https://github.com/usememos/memos/blob/main/web/src/components/MemoEditor/index.tsx): `web/src/components/MemoEditor/index.tsx`
- [Markdown rendering](https://github.com/usememos/memos/blob/main/web/src/components/MemoContent/pipeline.ts): `web/src/components/MemoContent/pipeline.ts`
- [Timeline and search](https://github.com/usememos/memos/blob/main/web/src/components/PagedMemoList/PagedMemoList.tsx): `web/src/components/PagedMemoList/PagedMemoList.tsx`
- [Calendar browsing](https://github.com/usememos/memos/blob/main/web/src/components/CalendarView/CalendarView.tsx): `web/src/components/CalendarView/CalendarView.tsx`
- [Storage settings](https://github.com/usememos/memos/blob/main/web/src/components/Settings/StorageSection.tsx): `web/src/components/Settings/StorageSection.tsx`

### HTTP and API

- [HTTP server](https://github.com/usememos/memos/blob/main/server/server.go): `server/server.go`
- [Connect handlers](https://github.com/usememos/memos/blob/main/proto/gen/api/v1/apiv1connect/memo_service.connect.go): `proto/gen/api/v1/apiv1connect/memo_service.connect.go`
- [Authentication API](https://github.com/usememos/memos/blob/main/server/api/v1/auth_service_session.go): `server/api/v1/auth_service_session.go`
- [Memo API](https://github.com/usememos/memos/blob/main/server/api/v1/memo_service_query.go): `server/api/v1/memo_service_query.go`
- [Attachment API](https://github.com/usememos/memos/blob/main/server/api/v1/attachment_service_storage.go): `server/api/v1/attachment_service_storage.go`
- [MCP endpoint](https://github.com/usememos/memos/blob/main/server/mcp/service.go): `server/mcp/service.go`

### Memo features

- [Memo lifecycle](https://github.com/usememos/memos/blob/main/server/api/v1/memo_service.go): `server/api/v1/memo_service.go`
- [Visibility and sharing](https://github.com/usememos/memos/blob/main/server/api/v1/memo_share_service.go): `server/api/v1/memo_share_service.go`
- [Memo export](https://github.com/usememos/memos/blob/main/core/memoexport/writer.go): `core/memoexport/writer.go`
- [Token authentication](https://github.com/usememos/memos/blob/main/server/auth/authenticator.go): `server/auth/authenticator.go`
- [Attachment transfer](https://github.com/usememos/memos/blob/main/server/api/v1/attachment_service_storage.go): `server/api/v1/attachment_service_storage.go`

### Persistence

- [Store interfaces](https://github.com/usememos/memos/blob/main/store/store.go): `store/store.go`
- [Database drivers](https://github.com/usememos/memos/blob/main/store/db/sqlite/sqlite.go): `store/db/sqlite/sqlite.go`
- [Attachment storage](https://github.com/usememos/memos/blob/main/store/storage.go): `store/storage.go`

### Integrations

- [S3 provider](https://github.com/usememos/memos/blob/main/provider/storage/s3/s3.go): `provider/storage/s3/s3.go`
- [Email notifications](https://github.com/usememos/memos/blob/main/core/notification/email.go): `core/notification/email.go`
- [AI providers](https://github.com/usememos/memos/blob/main/provider/ai/resolver.go): `provider/ai/resolver.go`
- [Identity providers](https://github.com/usememos/memos/blob/main/provider/idp/idp.go): `provider/idp/idp.go`

### Other components

- **User**

## Connections

- User → Web application: uses (evidence: `README.md`)
- HTTP server → Web application: serves (evidence: `server/server.go`)
- HTTP server → Attachment API: registers routes (evidence: `server/server.go`)
- HTTP server → Memo API: registers gateway (evidence: `server/server.go`)
- Attachment API → Attachment storage: resolves storage (evidence: `server/api/v1/attachment_service_storage.go`)
- Attachment storage → S3 provider: uses driver (evidence: `store/storage.go`)
- Authentication API → Token authentication: authenticates refresh (evidence: `server/api/v1/auth_service_session.go`)
- Authentication API → Store interfaces: updates tokens (evidence: `server/api/v1/auth_service_session.go`)
- Memo API → Store interfaces: builds query (evidence: `server/api/v1/memo_service_query.go`)
- User → Memo editor: writes Markdown (evidence: `README.md`)
- User → Timeline and search: finds memos (evidence: `README.md`)
- User → Calendar browsing: browses timeline (evidence: `README.md`)
- User → Visibility and sharing: chooses visibility (evidence: `README.md`)
- User → Memo export: exports memos (evidence: `README.md`)
- Memo editor → Markdown rendering: renders Markdown
- Storage settings → Attachment storage: configures storage
