Extenote
← All Docs

Architecture Overview

Extenote is a content management system for structured Markdown documents with YAML frontmatter. The name comes from Externalized Notes — content that lives outside any particular institution, laptop, or software.

Key Concepts

Understanding these three terms will help you navigate Extenote:

TermWhat it isExample
ObjectA single markdown file with YAML frontmattershared-references/smith2024.md
VaultA directory containing objectsextenote-pub/content/shared-references/
ProjectA configuration defining sources, schemas, and outputsprojects/shared-references.yaml

How they relate:

projects/my-blog.yaml          # Project config
  └── sources:
        └── content/my-blog/   # Vault (directory)
              ├── post1.md     # Object
              ├── post2.md     # Object
              └── ...
  └── includes: [shared-references]  # Include another project's objects

System Architecture

┌─────────────────────────────────────────────────────────────────┐
│                        User Interfaces                          │
├─────────────────┬─────────────────────┬─────────────────────────┤
│      CLI        │        TUI          │          Web            │
│   (Commander)   │    (Ink/React)      │   (React + Bun API)     │
└────────┬────────┴──────────┬──────────┴────────────┬────────────┘
         │                   │                       │
         └───────────────────┼───────────────────────┘

                    ┌────────▼────────┐
                    │  @extenote/core │
                    │                 │
                    │  - Config       │
                    │  - Schemas      │
                    │  - Validation   │
                    │  - Lint         │
                    │  - Export       │
                    └────────┬────────┘

              ┌──────────────┼──────────────┐
              │              │              │
        ┌─────▼─────┐  ┌─────▼─────┐  ┌─────▼─────┐
        │ projects/ │  │  Content  │  │   dist/   │
        │ schemas/  │  │   Vaults  │  │  export   │
        │  (YAML)   │  │    (MD)   │  │  (output) │
        └───────────┘  └───────────┘  └───────────┘

Data Model

VaultObject

A vault object is a Markdown file with YAML frontmatter. See packages/core/src/types.ts for the full interface.

Key fields:

File format:

---
type: blog_post
title: My Article
visibility: public
date: 2024-12-17
tags:
  - tech
---

# My Article

Content goes here...

Schema Definition

Schemas define structure and validation rules. See packages/core/src/types.ts for the full interfaces (SchemaDefinition, SchemaFieldDefinition).

Key fields:

Visibility

Objects have three visibility levels:

LevelDescription
publicVisible to all, included in public exports
privateHidden from public exports
unlistedNot listed but accessible if URL known

Issues

Validation and lint issues. See VaultIssue in packages/core/src/types.ts.

Key fields: sourceId, filePath, field, message, severity (error | warn | info), rule.

Directory Structure

extenote/
├── packages/
│   ├── core/                   # Business logic
│   │   └── src/
│   │       ├── index.ts        # Public API
│   │       ├── types.ts        # Type definitions
│   │       ├── constants.ts    # Shared configuration defaults
│   │       ├── config.ts       # Config loading
│   │       ├── schemas.ts      # Schema loading
│   │       ├── validation.ts   # Object validation
│   │       ├── lint.ts         # Lint rules
│   │       ├── exporters/      # Export formats
│   │       └── plugins/        # Discussion, network, semble plugins
│   │
│   ├── cli/                    # Command-line interface
│   │   └── src/
│   │       ├── index.ts        # Entry point (registers commands)
│   │       └── commands/       # One file per command
│   │           ├── utils.ts    # Shared CLI utilities
│   │           ├── build.ts
│   │           ├── deploy.ts
│   │           ├── validate.ts
│   │           └── ...
│   │
│   ├── web/                    # Web interface (React + Bun)
│   │   └── src/
│   │       ├── server.ts       # API server entry point
│   │       └── server/         # Server modules
│   │           ├── utils.ts    # Shared utilities
│   │           ├── cache.ts    # Vault caching logic
│   │           └── handlers/   # API route handlers
│   │
│   ├── tui/                    # Terminal UI (Ink/React)
│   └── refcheck/               # Reference validation library

├── projects/                   # Project configurations
│   ├── personal-website.yaml
│   └── ...

└── schemas/                    # Schema definitions
    ├── common.yaml
    ├── personal-website.yaml
    └── ...

Core API

Key functions exported from @extenote/core (see packages/core/src/index.ts):

Export Formats

FormatOutputDescription
jsonobjects.jsonAll objects as JSON array
markdownMirror of sourceReconstructed markdown files
htmlindex.htmlSingle-page HTML summary
atprotorecords.jsonATProto-compatible records
bibtexreferences.bibBibTeX bibliography

Build & Deploy

Projects can define build and deploy configuration in their YAML files:

┌─────────────────┐      ┌─────────────────┐      ┌─────────────────┐
│   Content       │      │    Website      │      │    Hosting      │
│   Vaults        │─────▶│    Build        │─────▶│    Platform     │
│   (Markdown)    │      │    (Astro/      │      │  (Cloudflare/   │
│                 │      │     Quarto)     │      │   GitHub Pages) │
└─────────────────┘      └─────────────────┘      └─────────────────┘
        │                        │
        │                        │
        ▼                        ▼
   PreRender Steps:         Build Types:
   - rsync content          - astro (npm run build)
   - export bibtex          - quarto (quarto render)
   - copy files             - custom (preRender only)
   - shell commands

Build Types

TypeCommandUse Case
astronpm install && npm run buildAstro static sites
quartoquarto renderQuarto documents/books
custom(none)Only preRender steps

Deploy Platforms

PlatformToolConfig File
cloudflare-pageswranglerwrangler.toml
github-pagesgh-pages(package.json)
ftplftp(inline config)
vercelvercel clivercel.json
netlifynetlify clinetlify.toml

Note: Vercel and Netlify deployment require their respective CLI tools to be installed and authenticated. These platforms are implemented but less tested than Cloudflare Pages and GitHub Pages.