# stxapps/bracemark-monorepo architecture

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

- Interactive diagram: https://gitdiagram.com/stxapps/bracemark-monorepo
- Repository: https://github.com/stxapps/bracemark-monorepo

## Overview

Bracemark is an end-to-end encrypted bookmark manager: clients capture and organize links locally, encrypt each library item before upload, and synchronize opaque files through the API. Its distinct product areas include account and subscription management, link extraction and previews, browser capture, and native sharing. The graph combines those documented capabilities with source-index relationships; several client and service internals are unsampled, so their connections are omitted rather than inferred.

Main entry points: [`packages/web-react/src/sync/engine.ts`](https://github.com/stxapps/bracemark-monorepo/blob/main/packages/web-react/src/sync/engine.ts) (Sync engines), [`apps/bracemark-api/src/routes/sync.ts`](https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-api/src/routes/sync.ts) (Sync endpoints), [`apps/bracemark-api/src/app.ts`](https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-api/src/app.ts) (API router), [`apps/bracemark-web/src/app/(app)/links/page.tsx`](https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-web/src/app/(app)/links/page.tsx) (Web app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Apps and capture"]
  node_webapp["Web app<br/>[page.tsx]"]
  node_mobile["Mobile app<br/>[main.tsx]"]
  node_browserext["Browser extension<br/>[App.tsx]"]
  node_shareext["Share extension"]
  node_accountui["Account screens"]
  node_linksui["Link library UI<br/>[main.tsx]"]
  node_marketing["Marketing site<br/>[page.tsx]"]
end

subgraph group_sync["Encrypted library sync"]
  node_syncengines["Sync engines<br/>[engine.ts]"]
  node_mobileengine["Mobile sync engine<br/>[engine.ts]"]
  node_syncdata[("Sync data stores<br/>[db.ts]")]
end

subgraph group_backend["API and accounts"]
  node_syncapi["Sync endpoints<br/>[sync.ts]"]
  node_blobapi["Blob endpoints<br/>[blob.ts]"]
  node_blobstorage[("Encrypted file storage<br/>[user-files.ts]")]
  node_apiapp["API router<br/>[app.ts]"]
  node_authroutes["Authentication routes<br/>[auth.ts]"]
  node_accountservice["Account service<br/>[account.ts]"]
  node_iaproutes["Subscription routes<br/>[iap.ts]"]
  node_iapservice["Subscription service<br/>[iap.ts]"]
  node_apistores[("Account databases<br/>[db-routes.ts]")]
  node_userdo[("Per-user data<br/>[user-data.ts]")]
end

subgraph group_content["Extraction and previews"]
  node_extractapp["Extractor router<br/>[app.ts]"]
  node_extractroute["Page extraction<br/>[extract.ts]"]
  node_imageroute["Image previews<br/>[image.ts]"]
  node_extractclient["Extraction clients<br/>[client.ts]"]
end

subgraph group_shared["Shared platform core"]
  node_synccontracts["Sync contracts<br/>[entities.ts]"]
  node_sharedapi["API contracts<br/>[client.ts]"]
end

node_user(("User"))

node_user -->|"uses"| node_webapp
node_user -->|"uses"| node_mobile
node_user -->|"captures with"| node_browserext
node_user -.->|"shares to"| node_shareext
node_user -.->|"creates account"| node_accountui
node_webapp -.->|"syncs through"| node_syncengines
node_mobile -.->|"syncs through"| node_mobileengine
node_browserext -.->|"uses sync"| node_syncengines
node_syncengines -->|"reads and writes"| node_syncdata
node_mobileengine -->|"updates sync state"| node_syncdata
node_syncengines -.->|"requests sync"| node_syncapi
node_mobileengine -.->|"requests sync"| node_syncapi
node_apiapp -->|"routes requests"| node_authroutes
node_apiapp -->|"routes requests"| node_iaproutes
node_apiapp -->|"routes requests"| node_syncapi
node_apiapp -->|"routes requests"| node_blobapi
node_authroutes -->|"calls"| node_accountservice
node_authroutes -.->|"resolves database"| node_apistores
node_iaproutes -->|"calls"| node_iapservice
node_syncapi -->|"uses per-user data"| node_userdo
node_syncapi -->|"uses contracts"| node_synccontracts
node_blobapi -->|"handles files"| node_blobstorage
node_extractapp -->|"mounts"| node_extractroute
node_extractapp -->|"mounts"| node_imageroute
node_extractclient -.->|"requests extraction"| node_extractapp
node_linksui -.->|"displays library"| node_syncengines
node_user -->|"learns about product"| node_marketing
node_webapp -.->|"uses API contracts"| node_sharedapi

click node_webapp "https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-web/src/app/(app)/links/page.tsx"
click node_mobile "https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-expo/src/features/links/main.tsx"
click node_browserext "https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-extension/entrypoints/popup/App.tsx"
click node_shareext "https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-expo/modules/bracemark-share/ios-extension/ShareViewController.swift"
click node_accountui "https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-expo/src/features/auth/create-account-form.tsx"
click node_linksui "https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-expo/src/features/links/main.tsx"
click node_syncengines "https://github.com/stxapps/bracemark-monorepo/blob/main/packages/web-react/src/sync/engine.ts"
click node_mobileengine "https://github.com/stxapps/bracemark-monorepo/blob/main/packages/expo-react/src/sync/engine.ts"
click node_syncdata "https://github.com/stxapps/bracemark-monorepo/blob/main/packages/web-react/src/data/db.ts"
click node_syncapi "https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-api/src/routes/sync.ts"
click node_blobapi "https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-api/src/routes/blob.ts"
click node_blobstorage "https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-api/src/r2/user-files.ts"
click node_apiapp "https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-api/src/app.ts"
click node_authroutes "https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-api/src/routes/auth.ts"
click node_accountservice "https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-api/src/services/account.ts"
click node_iaproutes "https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-api/src/routes/iap.ts"
click node_iapservice "https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-api/src/services/iap.ts"
click node_apistores "https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-api/src/db/db-routes.ts"
click node_userdo "https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-api/src/do/user-data.ts"
click node_extractapp "https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-extractor/src/app.ts"
click node_extractroute "https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-extractor/src/routes/extract.ts"
click node_imageroute "https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-extractor/src/routes/image.ts"
click node_extractclient "https://github.com/stxapps/bracemark-monorepo/blob/main/packages/shared/src/extract/client.ts"
click node_synccontracts "https://github.com/stxapps/bracemark-monorepo/blob/main/packages/shared/src/sync/entities.ts"
click node_sharedapi "https://github.com/stxapps/bracemark-monorepo/blob/main/packages/shared/src/api/client.ts"
click node_marketing "https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-site/src/app/page.tsx"

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_mobile,node_browserext,node_shareext,node_accountui,node_linksui,node_marketing,node_user toneBlue
class node_syncengines,node_mobileengine,node_syncdata toneAmber
class node_syncapi,node_blobapi,node_blobstorage,node_apiapp,node_authroutes,node_accountservice,node_iaproutes,node_iapservice,node_apistores,node_userdo toneMint
class node_extractapp,node_extractroute,node_imageroute,node_extractclient toneRose
class node_synccontracts,node_sharedapi toneIndigo
```

## Components

### Apps and capture

- [Web app](https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-web/src/app/(app)/links/page.tsx): `apps/bracemark-web/src/app/(app)/links/page.tsx`
- [Mobile app](https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-expo/src/features/links/main.tsx): `apps/bracemark-expo/src/features/links/main.tsx`
- [Browser extension](https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-extension/entrypoints/popup/App.tsx): `apps/bracemark-extension/entrypoints/popup/App.tsx`
- [Share extension](https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-expo/modules/bracemark-share/ios-extension/ShareViewController.swift): `apps/bracemark-expo/modules/bracemark-share/ios-extension/ShareViewController.swift`
- [Account screens](https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-expo/src/features/auth/create-account-form.tsx): `apps/bracemark-expo/src/features/auth/create-account-form.tsx`
- [Link library UI](https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-expo/src/features/links/main.tsx): `apps/bracemark-expo/src/features/links/main.tsx`
- [Marketing site](https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-site/src/app/page.tsx): `apps/bracemark-site/src/app/page.tsx`

### Encrypted library sync

- [Sync engines](https://github.com/stxapps/bracemark-monorepo/blob/main/packages/web-react/src/sync/engine.ts): `packages/web-react/src/sync/engine.ts`
- [Mobile sync engine](https://github.com/stxapps/bracemark-monorepo/blob/main/packages/expo-react/src/sync/engine.ts): `packages/expo-react/src/sync/engine.ts`
- [Sync data stores](https://github.com/stxapps/bracemark-monorepo/blob/main/packages/web-react/src/data/db.ts): `packages/web-react/src/data/db.ts`

### API and accounts

- [Sync endpoints](https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-api/src/routes/sync.ts): `apps/bracemark-api/src/routes/sync.ts`
- [Blob endpoints](https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-api/src/routes/blob.ts): `apps/bracemark-api/src/routes/blob.ts`
- [Encrypted file storage](https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-api/src/r2/user-files.ts): `apps/bracemark-api/src/r2/user-files.ts`
- [API router](https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-api/src/app.ts): `apps/bracemark-api/src/app.ts`
- [Authentication routes](https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-api/src/routes/auth.ts): `apps/bracemark-api/src/routes/auth.ts`
- [Account service](https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-api/src/services/account.ts): `apps/bracemark-api/src/services/account.ts`
- [Subscription routes](https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-api/src/routes/iap.ts): `apps/bracemark-api/src/routes/iap.ts`
- [Subscription service](https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-api/src/services/iap.ts): `apps/bracemark-api/src/services/iap.ts`
- [Account databases](https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-api/src/db/db-routes.ts): `apps/bracemark-api/src/db/db-routes.ts`
- [Per-user data](https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-api/src/do/user-data.ts): `apps/bracemark-api/src/do/user-data.ts`

### Extraction and previews

- [Extractor router](https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-extractor/src/app.ts): `apps/bracemark-extractor/src/app.ts`
- [Page extraction](https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-extractor/src/routes/extract.ts): `apps/bracemark-extractor/src/routes/extract.ts`
- [Image previews](https://github.com/stxapps/bracemark-monorepo/blob/main/apps/bracemark-extractor/src/routes/image.ts): `apps/bracemark-extractor/src/routes/image.ts`
- [Extraction clients](https://github.com/stxapps/bracemark-monorepo/blob/main/packages/shared/src/extract/client.ts): `packages/shared/src/extract/client.ts`

### Shared platform core

- [Sync contracts](https://github.com/stxapps/bracemark-monorepo/blob/main/packages/shared/src/sync/entities.ts): `packages/shared/src/sync/entities.ts`
- [API contracts](https://github.com/stxapps/bracemark-monorepo/blob/main/packages/shared/src/api/client.ts): `packages/shared/src/api/client.ts`

### Other components

- **User**

## Connections

- User → Web app: uses (evidence: `README.md`)
- User → Mobile app: uses (evidence: `README.md`)
- User → Browser extension: captures with (evidence: `README.md`)
- User → Share extension: shares to
- User → Account screens: creates account
- Web app → Sync engines: syncs through
- Mobile app → Mobile sync engine: syncs through
- Browser extension → Sync engines: uses sync
- Sync engines → Sync data stores: reads and writes (evidence: `packages/web-react/src/sync/engine.ts`)
- Mobile sync engine → Sync data stores: updates sync state (evidence: `packages/expo-react/src/sync/engine.ts`)
- Sync engines → Sync endpoints: requests sync
- Mobile sync engine → Sync endpoints: requests sync
- API router → Authentication routes: routes requests (evidence: `apps/bracemark-api/src/app.ts`)
- API router → Subscription routes: routes requests (evidence: `apps/bracemark-api/src/app.ts`)
- API router → Sync endpoints: routes requests (evidence: `apps/bracemark-api/src/app.ts`)
- API router → Blob endpoints: routes requests (evidence: `apps/bracemark-api/src/app.ts`)
- Authentication routes → Account service: calls (evidence: `apps/bracemark-api/src/routes/auth.ts`)
- Authentication routes → Account databases: resolves database
- Subscription routes → Subscription service: calls (evidence: `apps/bracemark-api/src/routes/iap.ts`)
- Sync endpoints → Per-user data: uses per-user data (evidence: `apps/bracemark-api/src/routes/sync.ts`)
- Sync endpoints → Sync contracts: uses contracts (evidence: `apps/bracemark-api/src/routes/sync.ts`)
- Blob endpoints → Encrypted file storage: handles files (evidence: `apps/bracemark-api/src/routes/blob.ts`)
- Extractor router → Page extraction: mounts (evidence: `apps/bracemark-extractor/src/app.ts`)
- Extractor router → Image previews: mounts (evidence: `apps/bracemark-extractor/src/app.ts`)
- Extraction clients → Extractor router: requests extraction
- Link library UI → Sync engines: displays library
- User → Marketing site: learns about product (evidence: `README.md`)
- Web app → API contracts: uses API contracts
