Skip to content

codifyidea/pergament

Repository files navigation

πŸͺΆ Pergament

Privacy-first note-taking and brainstorming tool for personal, local use.

Your notes are plain Markdown files on your own machine β€” no cloud, no account, no data leaving your computer. AI features are optional and work through your existing GitHub Copilot subscription or GitHub Models. Cloud backup via Git is available, but only if you want it. You own your data, completely.

Status: Active development Β· v1.0.0


Screenshots

Daily journaling Technical notes with Mermaid & code Dark mode
Daily journal entry showing mood check-in, task checklist and standup notes Git workflow page showing a Mermaid branch diagram and fenced code blocks Kubernetes cheatsheet in dark mode with YAML code blocks and architecture diagram
AI chat assistant AI settings
AI panel open alongside a project page, showing a multi-turn conversation with context-aware responses Settings modal open on the AI tab, showing model selection and provider configuration

Features

Category Capabilities
Editor BlockNote rich-text editor (built on ProseMirror/Tiptap), slash commands, headings, lists, tables, code blocks, images
Markdown Bidirectional Markdown serialisation β€” all content stored as .md files
Page tree Hierarchical pages with drag-and-drop reordering and reparenting
Internal links [[page-title]] wiki-link syntax with autocomplete and backlinks panel
Diagrams Mermaid diagram blocks with live preview
Math KaTeX equation blocks (inline and display)
Version history Automatic Git commits on every save; diff viewer; one-click restore
Remote backup Optional Git push to any remote (GitHub, GitLab, Gitea) using a PAT
Full-text search SQLite FTS5-powered search across all pages
AI assistant Streaming chat panel with context-aware page inclusion; inline rewrite/expand/summarise actions
AI providers GitHub Models API (PAT) or GitHub Copilot (device-flow OAuth) β€” switchable in Settings
Import / Export Import Markdown files and ZIP archives; export pages as Markdown or PDF
Themes Light, dark, and system-follow modes
Keyboard-first Full keyboard shortcut coverage

Tech Stack

Frontend

Backend

Shared

  • TypeScript monorepo (npm workspaces) with shared type definitions

Architecture

pergament/
β”œβ”€β”€ client/          # React frontend (Vite)
β”œβ”€β”€ server/          # Express API server
β”œβ”€β”€ shared/          # Shared TypeScript types
└── docs/            # ADRs and action plan

Data is stored separately from the source code, in your home directory:
~/.pergament/data/
β”œβ”€β”€ workspace.json         # Page tree metadata
β”œβ”€β”€ pages/
β”‚   └── <uuid>/
β”‚       └── index.md       # One Markdown file per page
└── .pergament/
    β”œβ”€β”€ config.json        # All settings (AI tokens, Git config, preferences)
    └── search.db          # SQLite FTS5 index (auto-rebuilt)

All settings β€” including AI tokens and Git credentials β€” are managed through the in-app Settings UI and stored in ~/.pergament/data/.pergament/config.json. No secrets are ever needed in environment variables or source code.

The data directory location can be overridden with the PERGAMENT_DATA_DIR environment variable (see .env.example).

For a detailed breakdown of every layer β€” frontend, backend, data model, request flow, and AI integration β€” see ARCHITECTURE.md.

See docs/adr/ for Architecture Decision Records covering every major design choice.


Getting Started

Prerequisites

  • Node.js 20+ and npm 10+
  • A modern browser (Chrome, Firefox, Edge, Safari)
  • Native build tools β€” required by better-sqlite3:
    • macOS: xcode-select --install
    • Ubuntu/Debian: sudo apt install build-essential python3
    • Windows: install windows-build-tools or use WSL2

Install

git clone https://github.com/<your-github-username>/pergament.git
cd pergament
npm install

Run in development

npm run dev

This starts:

  • Express API server on http://localhost:3000
  • Vite dev server on http://localhost:5173 β€” open this URL in your browser

On first run, Pergament automatically:

  1. Creates ~/.pergament/data/ with a default config
  2. Initialises a local Git repository inside the data directory
  3. Builds the full-text search index

The browser does not open automatically in development mode. Navigate to http://localhost:5173 yourself.

Build for production

npm run build
npm start

The server serves the compiled frontend and API from a single process on http://localhost:3000. In production mode the browser opens automatically on startup (configurable in Settings β†’ General).

Optional: copy .env.example to .env to override the port or data directory path before starting.

Configuration

All configuration is done through Settings β†’ General / Git / AI in the app UI. There is no manual config file editing required.

The only runtime environment variables are optional overrides:

Variable Default Purpose
PORT 3000 (or value in config) Override the server port
PERGAMENT_DATA_DIR ~/.pergament/data Override the data directory path
NODE_ENV development Set to production for production builds

AI Setup

In Settings β†’ AI, choose a provider and enter your credentials:

  • GitHub Models β€” paste a GitHub Personal Access Token with models:read scope
  • GitHub Copilot β€” click "Sign in with GitHub" and complete the device flow (requires an active Copilot subscription); no PAT needed

Running Tests

# All tests
npm test --workspaces

# Frontend only
npm test -w client

# Backend only
npm test -w server

Project Structure

client/src/
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ editor/          # BlockNote editor, AI bar, math/mermaid blocks
β”‚   β”œβ”€β”€ layout/          # App shell, sidebar, panels
β”‚   β”œβ”€β”€ sidebar/         # Page tree, search, git status
β”‚   └── ui/              # Generic UI components
β”œβ”€β”€ context/             # React contexts (pages, settings, toasts)
β”œβ”€β”€ hooks/               # useTheme, useKeyboardShortcuts
└── utils/               # AI helpers, templates, tree utilities

server/src/
β”œβ”€β”€ routes/              # Express route handlers
β”œβ”€β”€ services/            # Business logic (git, search, config, AI)
└── utils/               # Shared server utilities

Roadmap

Architecture decisions are documented in docs/adr/.

High-level upcoming work:

  • PWA support (installable, offline-capable)
  • Plugin/extension system
  • Multi-workspace support
  • Mobile-responsive layout improvements

Contributing

Contributions are welcome! Please read CONTRIBUTING.md before opening a pull request.


License

MIT © 2026 Radu Tămaș — Codify Idea


Proudly made in Cluj-Napoca, Romania πŸ‡·πŸ‡΄

About

Privacy-first note-taking and brainstorming tool for personal, local use. Your notes are plain Markdown files on your own machine. Optional AI via your GitHub Copilot subscription or GitHub Models. Optional cloud backup through Git - only if you want it. You own your data, completely. Feel free to contribute.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors