Synapse is a study workspace. Organize courses read and annotate the material, train with generated exercises and watch your progress forked from denishovart.com/synapse
README.md

Synapse #

Self-hosted exam revision app. Upload course materials in almost any format, read and annotate them, OCR scanned documents, generate exercises with AI, train with quizzes or timed mock exams, keep a lexicon of notions linked to slides, and track progress until the exam. The workspace is stored on the device, so every page keeps working with the network off. Fonts, pdf.js and every library are bundled locally, so no request ever leaves for a CDN.

What it does #

  • Courses with chapters, uploaded materials and external links. PDF is native; office and markup formats convert through LibreOffice or pandoc. A PDF book can be split into one document per chapter on the way in.
  • A PDF viewer with highlights, drawings, anchored notes and rich text page notes, a per-course colour palette, undo/redo and keyboard nudging. A course exports as a single PDF with the annotations baked in.
  • A lexicon of notions linked to the slides where they appear.
  • Generated exercises (multiple choice, true/false, open questions) with local grading, adaptive sessions and per-chapter progress. AI is opt-in per course, and the provider is yours. The default is OpenAI's gpt-4o-mini, which works on their free tier, and Anthropic or a local model through Ollama also work.
  • Accounts with per-user data isolation, and SSO through OIDC, SAML or OAuth2.
  • Three languages (English, French, Brazilian Portuguese), six colour themes, and an axe pass over every screen in the end-to-end tests.

Local-first #

Every device holds the whole workspace as Loro CRDT documents in IndexedDB, plus a content-addressed cache of the file bytes. Pages read and write locally. The server keeps no relational copy of the study data, so there is no second source of truth to reconcile. What the server does hold is the part a device cannot do alone: accounts, file storage, conversion and OCR, the AI proxy, and an append-only log of opaque update blobs that devices push and pull to converge. Two devices can also converge with no server involved, over the LAN or by carrying an exported file pack. The desktop and phone apps are standalone out of the box and treat a server as one more peer.

Stack #

A pnpm monorepo on Node 22. apps/web is a Svelte 5 (runes) single-page app built with Vite. apps/api is a NestJS backend in clean architecture, with Drizzle ORM over SQLite or Postgres. apps/shell is the Tauri shell that ships the same web build as a desktop and mobile app, with the LAN sync plumbing in Rust. packages/ai-core holds the provider-agnostic AI calls and packages/design-system the UI kit. docs/architecture.md has the diagrams and a table of where to start reading.

Getting started #

pnpm install
pnpm dev        # API on :3000, web app on :5173

Open http://localhost:5173. The first launch asks you to create an admin account, then drops you on an empty dashboard. pnpm seed fills it with demo courses if you would rather poke at something than build it.

For a real install, Install and configure the app covers a computer or a phone, Install a server covers Docker and systemd on Linux, and Development has the toolchain, the quality gates and the conventions.

Documentation #

Everything under docs/ doubles as an MkDocs site, with a tour of the features, the syncing and AI guides, the accounts and SSO reference, and the build notes for the desktop and mobile apps. Preview it with pip install -r docs/requirements.txt && pnpm docs:serve.

The code lives at tangled.org/denishovart.com/synapse.

AI assistance #

An AI coding assistant was used to help build parts of this codebase. It was a tool, not an author: generated code was read, questioned, tested and often reworked before landing, and the decisions that shape the project (data model, security model, dependencies, UX) were made by a human. Nothing was merged blindly.

License #

Synapse is free software under the GNU AGPL-3.0. You can use, study, share and modify it. If you run a modified version as a network service, the AGPL asks you to offer your users the corresponding source. The freedoms travel with the code, which is the point.