Clarity Docs

What exists today in the app, the backend, the AI surface, and the plugin system.

Clarity is a Next.js frontend, a FastAPI backend, document storage, a small AI feature boundary, and a plugin system with a sandboxed bridge runtime, developer portal, and live marketplace. These docs describe the implementation that exists in this repo.

Backend API

Auth, documents, AI endpoints, public v1 routes, developer tokens, and plugin delegation.

View API

Plugins

Plugin manifest format, bridge API, permission model, dev mode, and marketplace vetting.

View Plugin Docs

Developer Portal

Register plugins, issue API tokens, track usage, and submit for marketplace review.

Go to /dev

Marketplace

Browse and install reviewed plugins. Enable or disable installed plugins per-document stage.

Browse Marketplace

Current Architecture

  • Frontend: login, register, menu, editor, marketplace, developer portal, and docs pages.
  • Backend: FastAPI routes for auth, documents, health, AI, developer portal, marketplace, and public v1 API.
  • Storage: Postgres for metadata and /app/documents for document files by default.
  • AI: bounded actions for checking, rewriting, summarizing, and guided prompting. Weekly token allowance enforced per user.
  • Plugin runtime: sandboxed iframe bridge, permission enforcement, stage-scoped lifecycle, dev mode URL installs, and marketplace distribution.

Authentication Model

Users authenticate with email/password or Google Sign-In — both produce an HttpOnly cookie session. Developer API tokens are separate: they are issued from the developer portal, scoped to specific public v1 routes, and billed independently from user sessions.

AI and Token Allowances

The public POST /v1/ai/check route supports check, rewrite, summarize, and promptactions. Calls made with developer tokens are billed to the developer's balance. Marketplace plugins can alternatively bill against the user's own weekly allowance via POST /v1/ai/delegate-check.