# Janosik A self-hosted **Kanban board for teams and AI agents**. Server mode provides accounts, shared boards, realtime sync and **board epics** with progress, subtasks and a detail view. The UI and API share one pure reducer and a command log; the installable PWA can reopen cached pages offline; the bundled MCP server lets compatible agents drive the same board through a scoped API key. [![React](https://img.shields.io/badge/React-18-61dafb?logo=react&logoColor=white)](https://react.dev) [![TypeScript](https://img.shields.io/badge/TypeScript-5.9-3178c6?logo=typescript&logoColor=white)](https://www.typescriptlang.org) [![Vite](https://img.shields.io/badge/Vite-8-646cff?logo=vite&logoColor=white)](https://vite.dev) [![Tailwind CSS](https://img.shields.io/badge/Tailwind-v4-38bdf8?logo=tailwindcss&logoColor=white)](https://tailwindcss.com) [![NestJS](https://img.shields.io/badge/NestJS-11-e0234e?logo=nestjs&logoColor=white)](https://nestjs.com) [![CI](https://github.com/VitalyTolstik/janosik/actions/workflows/ci.yml/badge.svg)](https://github.com/VitalyTolstik/janosik/actions/workflows/ci.yml) [![License: AGPL-3.0](https://img.shields.io/badge/license-AGPL--3.0-blue)](./LICENSE) **Current release:** app **v0.3.0** · MCP **`@janosik/mcp` 0.6.0** · self-host image `ghcr.io/vitalytolstik/janosik`. > Janosik runs in **server mode** in development and production. The UI applies edits optimistically, then sends them to the API as commands (`POST /boards/:id/commands`); the UI and API use the same `boardReducer`. Unit tests can exercise the reducer without an API. The PWA caches its app shell and assets, so previously loaded pages can reopen offline, but saving changes requires a server connection. Realtime updates use SSE and resume from `?since=` after a dropped connection. See [ROADMAP.md §7](./ROADMAP.md) for the architecture history. --- ## Repository layout — the workspaces This is an **npm workspaces monorepo** with one root lockfile. `ui`, `shared` and `backend` make up the application; `brand`, `site`, `video`, `mcp` and `skills` support its design system, website, media and agent integrations; `e2e` holds the Playwright browser suite and its isolated Docker runner. Install dependencies once with `npm install` from the repository root. | Workspace | npm name | What it is | How it runs | | --- | --- | --- | --- | | **`ui/`** | `@janosik/ui` | The **frontend**: the whole single-page app — board/calendar/table/watch views, drag & drop, card dialog, search, settings, i18n, PWA service worker, the login screen and the master panel. It talks to the backend over `fetch`. | Vite dev server (`npm run dev`, master panel at `/admin`) or static files from `ui/dist` (master panel at `/app/admin` in the self-host image) | | **`shared/`** | `@janosik/shared` | A **TypeScript library with no build step and no runtime of its own**: the domain model (`Board`/`Column`/`Card`/`Label`/`Epic`), the pure `boardReducer` (the single implementation of every board operation), its inverse for undo, command validation, export/import serialization, storage keys — plus the **typed API contracts** (user and admin DTOs). | Nothing to run. `ui` and `backend` import its `.ts` sources directly through aliases, so client and server literally share the same types and the same reducer logic | | **`backend/`** | `@janosik/backend` | The **server**: a NestJS API on PostgreSQL — auth (JWT + refresh rotation + argon2id), boards/members, the command log that persists UI actions, comments/activity, and the isolated master-admin contour (`/api/v1/admin/*`). | Node process (`npm run build:backend` + `npm run start -w backend`); dev DB via Docker Compose | | **`brand/`** | `@janosik/brand` | Shared brand assets and design tokens. | Imported by the UI and site; has its own tests and lint script. | | **`site/`** | `@janosik/site` | Astro marketing site and Starlight documentation, with English and Russian content. | `npm run dev:site` or `npm run build:site`. | | **`video/`** | `@janosik/video` | Remotion scenes and scripts for recording and rendering product clips. | `npm run studio -w video` or `npm run render -w video`. | | **`mcp/`** | `@janosik/mcp` | MCP server (87 tools in 16 groups) for boards, epics, cards, sessions, plans, approvals and runs, over stdio or Streamable HTTP, through scoped API keys. | `npm run dev -w mcp`, or use the published `@janosik/mcp` 0.6.0 package. | Why `shared` matters: a board mutation is written **once** (in the reducer), executed in the browser for instant feedback and on the server when the command arrives — so a card can never move differently in the UI and in the database. The same applies to validation and to DTO types: change a field in `shared/src/admin.ts` and both sides fail to compile until they agree. ```text janosik/ # npm workspaces root (one package-lock.json) ├─ ui/ # @janosik/ui — the React PWA (see tree below) ├─ shared/ # @janosik/shared — the domain library │ └─ src/ │ ├─ types/kanban.ts # Board / Column / Card / Label / Epic + LIMITS │ ├─ store/ │ │ ├─ board-reducer.ts # the pure reducer — every board action │ │ ├─ invert.ts # inverse actions for undo/redo │ │ ├─ validate.ts # strict command validator (both sides) │ │ ├─ migrate.ts # persisted-state migrations │ │ └─ seed-data.ts # demo "Product Launch" board │ ├─ utils/ # export/import envelope, limits, text, storage keys │ ├─ api.ts # user API DTOs (auth, boards, commands…) │ └─ admin.ts # admin API DTOs (users, boards, cards, masters…) ├─ backend/ # @janosik/backend — the NestJS API │ ├─ prisma/ # schema.prisma + versioned migrations │ ├─ src/ # auth/ boards/ commands/ comments/ activity/ │ │ # admin/ users/ health/ config/ (+ shared → ../../shared/src) │ ├─ test/ # Jest + Supertest e2e specs (real test DB) │ ├─ scripts/ # admin-cli.cjs, migrate-test-db.cjs │ ├─ docker-compose.yml # dev PostgreSQL 16 (janosik + janosik_test) │ └─ .env.example ├─ brand/ # @janosik/brand — shared brand assets and tokens ├─ site/ # @janosik/site — marketing site and documentation ├─ video/ # @janosik/video — product demo clips ├─ mcp/ # @janosik/mcp — the MCP server: the board as agent tools │ ├─ src/ # client + 16 tool groups (87 tools), epics, sessions, toolset gating │ ├─ server.json # MCP Registry metadata (published as io.github.vitalytolstik/janosik) │ └─ scripts/smoke.mjs # live smoke test against a running instance ├─ skills/janosik/ # workflow guidance for AI agents using the MCP tools │ ├─ SKILL.md # the instructions a harness loads │ └─ references/ # card/comment templates + lifecycle recipes ├─ deploy/nginx.conf # optional SPA fallback + /api proxy (single-image serving is built in) ├─ Dockerfile # multi-stage: builds UI + API into one self-host image ├─ docker-compose.yml # self-host stack: app + postgres + redis ├─ docker-entrypoint.sh # runs `prisma migrate deploy`, then the API ├─ .env.example # annotated environment for docker compose ├─ SECURITY.md / CHANGELOG.md # disclosure policy, release history ├─ LICENSE / TRADEMARK.md # AGPL-3.0 terms + brand/trademark policy ├─ docs/SELF-HOSTING.md # full self-hosting guide (TLS, backups, ops) ├─ docs/INSTALL-BY-OS.md # running it on macOS / Windows 11 / Linux ├─ ROADMAP.md # project priorities, architecture decisions and task status ├─ ROADMAP-DONE.md # archive of closed tasks └─ AGENT.md # working agreement for AI agents/contributors ``` --- ## Highlights - **Four board views** — Kanban, **Calendar** (drag deadlines, "unscheduled" panel, week/month, day panel), **Table** (sorting, inline editing, configurable columns) and **Watch** (a read-only status view with a live activity feed and 20/50/100-item pages). - **Board epics** — the **Backlog** holds epics in the same mixed row window as cards. Create an epic from the column footer, drag cards in or assign them from the card dialog, and see subtask progress on the collapsed tile. The epic detail shows status, owner, dates and every subtask across columns; edit, complete, reopen or soft-delete it without moving its cards. Epics survive export/import, support undo and SSE, appear in filters and the board-wide `Epics N` list, and are exposed over MCP and the master panel. - **Card density** — a `Simplify design` toggle switches every card to a compact one-line tile (title, label dots, blocked marker, checklist progress, priority and assignee) with far fewer elements; the full face stays one click away in the card dialog. - **Drag & drop** — move cards within/between columns and reorder columns (`@dnd-kit`), inline Trello-style "+" zones, keyboard sensor and drag overlay. - **Rich card content** — WYSIWYG description (MDXEditor) that is the card's document (up to 64k characters), checklists with progress badges (items up to 500 characters), due dates with overdue/soon badges, color/gradient covers, 14-color labels, and a machine-readable acceptance-criteria / definition-of-done contract that agents write over MCP and board members can edit in the card dialog. - **Attachments** — paste files into descriptions or add them directly; description uploads follow edits and undo/redo. Video uploads can be processed in the background for browser playback; see the [card guide](./site/src/content/docs/docs/user-guide/cards.md#attachments) for limits and retention. - **Card & board archive** — Trello-style archiving with restore (WIP-aware), plus retention-based soft delete and a `Recently deleted` restore view; board archive with admin restore. - **Multi-boards** — switcher, create (blank, from a template or an example board), rename/archive/delete, deep links `/board/:id`, global search across boards with snippets. - **Search & filters** — by title/description/labels/epic, label ANY/ALL matching, due status, creation date; hotkeys `/` and `Ctrl/Cmd+K`, match counter. - **WIP limits** — per-column caps with counters, blocked composers/drags and toasts. - **Activity feed** — per-card event history covering every board action, with relative timestamps and an "Agent" badge on entries an agent's API token caused. - **Keyboard-first** — shortcut palette (`?`), `j/k` cursor navigation, `n`/`c` composers, `e`/`Enter` edit. - **Undo / redo** — 50-step history with coalescing, `Ctrl/Cmd+Z`, `Ctrl/Cmd+Shift+Z`, `Ctrl+Y`, header buttons. - **PWA** — installable (manifest + icons). The service worker caches the app shell and hashed assets, so previously loaded pages can reopen offline. Writes still need the API: if it is unreachable, an optimistic edit rolls back with a message. There is no persistent outbox yet, so reloading discards unsynced changes; previously loaded data remains available offline. - **Server mode** — sign in to work with boards stored in PostgreSQL. The UI applies edits optimistically and sends each one through the command log (`POST /boards/:id/commands`); rejected edits roll back with a message. Per-entity version checks protect typed text from a stale undo. A request already in flight can finish during a reload. The no-API local-only mode is used by unit tests; development and production builds require the API. - **Realtime** — a `GET /boards/:id/events` SSE stream carries every committed command (`{type, seq, action, actorId}`) and the client replays foreign actions through the very same reducer. Edits appear in other browsers with no reload; a dropped stream resumes exactly where it stopped (`?since=`) and window focus remains the fallback. Your own commands are never applied twice, and a stale undo still refuses to clobber someone else's text. - **Shared boards** — a **Members (N)** dialog in the header: admins invite by email, switch roles (`ADMIN`/`MEMBER`/`VIEWER`), bound a viewer's access with an expiry date ("access expired" badge) and remove members — the last admin can never be demoted or removed. Invitations are **opt-in**: the invitee gets a badge on the header bell and accepts or declines there; nothing is shared until they accept. Everyone else sees the same member list read-only, and a `VIEWER` gets a genuinely read-only board: no drag, no composers, no menus, no inline editors, a read-only card dialog — while the server independently answers 403 to every mutation. - **Personal inbox** — the header bell and the full `/inbox` page share one attention queue with All, Mentions, Invitations, Approvals and System tabs. Only explicit `@` mentions from comments notify; rows show the actor, card, board and an `@You` excerpt, and lifecycle tags for deleted cards or archived boards. Invitations are decisions (accept/decline) rather than read/unread rows, approval decisions stay in **Agents → Attention**, and `Account → Profile` separates attention e-mail, mention e-mail and scheduled digests. The bell and `/inbox` subscribe to a session-only `GET /users/me/events` SSE stream with a focus/30-second snapshot fallback; see the [collaboration guide](./site/src/content/docs/docs/user-guide/collaboration.md#attention-inbox). - **Master panel** — a separate `/app/admin` area for the platform operator: metrics, all users and boards, board epics with progress/health and safe cleanup, command log, audit trail and moderation (block a user and their sessions die instantly, revoke API tokens, archive/soft-delete a board, create accounts with a one-time password). Master accounts live outside the user table, have their own login, cookie and JWT audience, and are created only by the server CLI (`npm run admin:create -w backend`); `OWNER` can add more masters, `OPERATOR` cannot. Panel tables are **schema-first**: columns are named after Prisma fields (`Board.id`, `BoardMember.userId`, `Card.columnId`, `Comment.authorId`, …), foreign keys are shown as copyable IDs (title/email only as a caption) and search matches those IDs — a row can be traced to its parents even when names are not unique. - **AI agents (MCP + skill)** — `@janosik/mcp` 0.6.0 gives compatible clients (Claude, Cursor, VS Code, opencode and Codex) 87 tools in 16 groups through a personal API key: boards, epics, cards, checklists, comments, plans, approvals, runs, agent sessions and more. The same package ships a shared Streamable HTTP gateway for agent fleets, and operators can require a live agent session for API-token writes. The `janosik` skill provides workflow guidance: claim a card under a temporary lease, keep its description, checklist and comments structured, check the workflow gates and return blocked work with evidence. Keys can be scoped to one board, made read-only and rate-limited. Commands retain actor attribution, history and undo. See [Drive it from an AI agent](#drive-it-from-an-ai-agent-mcp--skill). - **Performance & scale** — the board read model serves a summary plus paged card detail with ETag/304 and gzip/Brotli, an aggregate cache absorbs repeated reads, the Backlog virtualizes mixed epic/card rows, and the editor and calendar load on demand. For larger installations, `docker-compose.scale.yml` runs 2–4 API replicas behind the bundled nginx/Caddy overlays with SSE resume and shared Redis budgets. Performance measurements and their test conditions are recorded in [docs/PERF-BASELINE.md](./docs/PERF-BASELINE.md). - **Data safety** — debounced saves, JSON export/import (25 MB import/export envelope, 10 MB command bodies), automatic local backups in the no-API build (20 snapshots, rotated; server mode deliberately does not create backups), self-service export/delete, error boundary + toasts, input/collection limits everywhere. - **Themes & polish** — dark/light with no-flash preflight, four board backgrounds, adjustable column glass, `prefers-reduced-motion`, custom scrollbars. - **Accessibility & touch** — a 14px body scale across board, card, admin and account surfaces; 44px touch targets; visible focus rings and keyboard access to board and epic tiles, menus and dialogs; axe-checked layouts at 390/768/1024/1440 in light and dark. - **i18n** — English & Russian with type-safe keys and pluralization; 12h/24h time format toggle. - **Brand** — Space Grotesk wordmark (self-hosted) + animated "Перо Яношика" feather logo. --- ## Tech stack | Layer | Choice | | --- | --- | | UI | React 18, TypeScript 5.9 (strict) | | Build | Vite 8 (Rolldown), Tailwind CSS v4 (CSS-first, `@theme inline`) | | Components | Base UI + Radix primitives (dialog, dropdown, popover, tooltip, context menu, slot); local shadcn-style wrappers | | Rich text | `@mdxeditor/editor` (WYSIWYG description, hardened import pipeline) | | Drag & drop | `@dnd-kit/core` + `@dnd-kit/sortable` (board), native HTML5 DnD (calendar) | | Calendar | `react-day-picker` (lazy-loaded, locale on demand), `date-fns` | | State | React `useReducer` (pure reducer in `shared`, 50+ actions) + context, command log and optimistic server sync | | Router | `react-router-dom` (`BrowserRouter`, `/board/:id`, `?card=` deep links; SPA-fallback: `deploy/nginx.conf`) | | PWA | Hand-rolled service worker + web manifest (zero extra deps) | | i18n | `i18next`, `react-i18next`, `i18next-browser-languagedetector` | | Fonts | `@fontsource/space-grotesk` (self-hosted, no CDN) | | Shared | `@janosik/shared` — domain model, reducer + inverse, validation, DTO contracts (imported as TS source, no build step) | | Backend | NestJS 11, Prisma 6, PostgreSQL 16, JWT (`@nestjs/jwt`) + refresh rotation, argon2id, helmet, rate limiting | | Tests | Vitest + React Testing Library (UI, shared, brand, site and MCP); Jest + Supertest (backend unit and API end-to-end tests against PostgreSQL); Playwright + Google Chrome for the browser suite | | Agent protocol | MCP over stdio or Streamable HTTP (`@janosik/mcp` 0.6.0, 87 tools in 16 groups) | Browser E2E uses Playwright with Google Chrome and an isolated self-host stack, sharded across eight CI jobs (board, admin, no-mail, security). See [e2e/README.md](./e2e/README.md) for setup and commands. --- ## Quick start **Prerequisites:** Node.js **22.17+** — the repo pins **24** via `.nvmrc` (`nvm use`), and that is what CI runs. npm. Docker for server mode (PostgreSQL/Redis). > Per-OS walkthroughs (macOS, Windows 11, Linux) — both Docker and from-source, with the OS-specific gotchas — live in **[docs/INSTALL-BY-OS.md](./docs/INSTALL-BY-OS.md)**. ### Server mode (accounts + PostgreSQL) The dev UI is **always in server mode**: it calls `/api/v1` (Vite proxies it to `:3000`), so you get a **sign-in screen** and `npm run dev` alone does not show a board. Bring the database and API up first: ```bash # 1. Configure the API FIRST — the dev compose file reads POSTGRES_* from # backend/.env, so it must exist before `docker compose up`. cp backend/.env.example backend/.env # set JWT_SECRET (openssl rand -hex 32); DATABASE_URL/TEST_DATABASE_URL # already point at the container. # 2. Start the dev database (container `janosik-postgres`, port 5433) docker compose --env-file backend/.env -f backend/docker-compose.yml up -d # 3. Apply migrations and build + start the API (port 3000) npm run prisma:deploy -w backend npm run build:backend npm run start -w backend # 4. In a second terminal, start the UI; Vite proxies /api to :3000 npm run dev ``` With the default `backend/.env.example` configuration (no SMTP or bootstrap), self-service password registration is unavailable. From the repository root run `npm run admin:create -w backend -- --email me@example.com` to create the first master. Sign in at `http://localhost:5173/admin` (the Vite dev URL), go to **Users → Create user**, and open the user's details to **Verify email** for an address you control. Then sign in with the board account at `http://localhost:5173/`. > **Local-only / no-API build.** The app can also render with no backend — that is the in-browser mode the **unit tests** use (`MODE=test`), with the seeded "Product Launch" board in `localStorage`. The `npm run dev` / `npm run build` builds are **not** that mode: they always talk to the API and show the login screen, so "just look at the demo board, no login" is not available from the dev server. ### Marketing site (Astro) — dev The marketing site and docs live in `site/` (Astro + Starlight) and run on their own dev server: ```bash npm run dev:site # Astro dev server, default port 4321 ``` In dev the app is **not** served under `/app/` on the site — that path belongs to the **self-host image**, where one server serves the site at `/` and the app at `/app/`. So the site's "Sign in" / "Create account" CTAs must be pointed at the UI dev server, otherwise they 404: ```bash PUBLIC_APP_URL=http://localhost:5173 npm run dev:site ``` The reverse link — the in-app **Help → Documentation** — points at the site, so give the UI dev server `VITE_SITE_URL` (otherwise it opens `/docs/` on the UI origin and hits the not-found page): ```bash VITE_SITE_URL=http://localhost:4321/ npm run dev ``` The self-host image sets both by serving the site at `/` and the app at `/app/` on one origin; a **split deployment** (two hosts) sets `PUBLIC_APP_URL` and `VITE_SITE_URL` to the two origins — see [docs/SELF-HOSTING.md](./docs/SELF-HOSTING.md). ### Enabling outgoing email for self-service signup **Email delivery is not enabled by default.** The API boots fine with no mail setup in **log mode**. For self-service password signup, configure email in the master panel or through the `SMTP_*` environment variables. A local install with one-time bootstrap enabled can create its first board account without SMTP. To send mail, open **Settings → Email** in the master panel (`/app/admin/settings?tab=email` on the self-host image), pick a preset, enter the credentials, enable delivery and send a test email. This requires an owner master account. - **Gmail / Yandex / Mail.ru** — configure the provider's SMTP settings and use an app password where the provider requires one. - **Brevo / SendGrid** — transactional email services. SendGrid uses `apikey` as the username and your API key as the password. - **Custom SMTP** — any host / port / TLS. **Trying it out locally (Mailpit).** The **Mailpit (sandbox)** preset sends email to a local catcher and needs no credentials. Messages appear in its web inbox instead of being sent to a real address. Start it, then open the inbox: ```bash docker run -d --name janosik-mailpit --restart unless-stopped -p 1025:1025 -p 8025:8025 axllent/mailpit # open http://localhost:8025, or click "Open the inbox" in the panel ``` ### Self-hosting with Docker (production) Janosik runs in a browser and needs a running server. The Docker installation works on Linux, macOS (Intel and Apple Silicon), and Windows with Docker Desktop and WSL2. It downloads Linux `amd64` or `arm64` images; there is no standalone Windows `.exe` or macOS `.dmg` installer. GitHub release source archives are source code, not installers. Version v0.2.0 was tested on WSL and in Linux CI on both architectures; it has not been separately tested on a physical Mac. For a local trial on Linux, macOS or WSL with Docker, Compose, curl and OpenSSL installed, download and run the installer: ```bash curl -fsSLO https://raw.githubusercontent.com/VitalyTolstik/janosik/main/install.sh && bash install.sh ``` It creates `janosik/.env` with unique secrets, starts the stack bound to `127.0.0.1:3210`, and prints the app URL. Set `JANOSIK_INSTALL_PORT` or `JANOSIK_INSTALL_DIR` before running the script to change the local port or directory. It pins the Compose file and image to the latest stable GitHub release and refuses to overwrite an existing configuration. The installer enables one-time account bootstrap without SMTP. On this fresh instance, open `/app/` and choose **Create account**. After setup, turn off `ALLOW_BOOTSTRAP_USER` and `ALLOW_REGISTRATION` in `.env` and run `docker compose up -d`. Installation requires a published stable release and image. For a public deployment use HTTPS and the production instructions below. The fastest way to run Janosik is the prebuilt image: one container serves the **whole app** (API under `/api/v1` + the built SPA), next to PostgreSQL and Redis. No separate web server or proxy config — SSE and cookies work on a single origin. ```bash # 1. Grab the compose file and the env template curl -O https://raw.githubusercontent.com/VitalyTolstik/janosik/main/docker-compose.yml curl -o .env https://raw.githubusercontent.com/VitalyTolstik/janosik/main/.env.example # 2. Edit .env — at minimum JWT_SECRET and PUBLIC_ORIGIN: # JWT_SECRET=$(openssl rand -hex 32), POSTGRES_PASSWORD= # For this plain-HTTP quickstart also set COOKIE_SECURE=false (the safe # default is true; over HTTP the API refuses to boot rather than drop the # refresh cookie). Behind HTTPS keep it true. # 3. Bring it up (migrations run automatically on boot) docker compose up -d ``` Without SMTP or bootstrap, create a **master (platform admin)** account first: ```bash docker compose exec app node /app/backend/scripts/admin-cli.cjs create --email me@example.com # (hidden password prompt; the first master becomes OWNER) docker compose exec app node /app/backend/scripts/admin-cli.cjs list # then sign in at PUBLIC_ORIGIN/app/admin ``` In the master panel, choose **Users → Create user**. Open the user's details and **Verify email** for an address you control. Sign in with that board account at `PUBLIC_ORIGIN/app/` (by default `http://localhost:3000/app/`). For a private instance, set `ALLOW_REGISTRATION=false` in `.env` and run `docker compose up -d`. [First-run guide](./docs/SELF-HOSTING.md#3-first-run-account-registration-master-panel) Before an upgrade, take a consistent database and uploads backup and test restoration. See the [operations runbook](./site/src/content/docs/docs/runbooks.md) for the full procedure and rollback; migrations run when the app starts. For an installer-created instance, check the release notes and change `JANOSIK_TAG` in `janosik/.env` to the desired release before pulling. When a release changes the Compose file, update it from that same release as well. Back up the database, uploads, and `.env` before upgrading. Janosik does not schedule or verify server backups. Environment variables (see `.env.example` for the full annotated list): | Variable | Default | Meaning | | --- | --- | --- | | `JWT_SECRET` | — (required) | Access-token signing secret; `openssl rand -hex 32` | | `PUBLIC_ORIGIN` | `http://localhost:3000` | Public URL users open; builds OAuth callbacks | | `POSTGRES_USER` / `POSTGRES_PASSWORD` / `POSTGRES_DB` | `janosik` / — / `janosik` | Database credentials | | `COOKIE_SECURE` | `true` | `Secure` cookie flag. Keep `true` behind HTTPS (the API refuses to boot on HTTP in production); set `false` only for a plain-HTTP trial. | | `ALLOW_REGISTRATION` | `true` | Allow password sign-up when SMTP or one-time bootstrap is available. Set `false` for a private instance. | | `ALLOW_BOOTSTRAP_USER` | `false` | One-time first-account bootstrap without SMTP; inert after the first user. The local installer enables it. | | `TRUST_PROXY` | `0` | Reverse-proxy hops (set `1` behind nginx/Caddy/Traefik) | | `SMTP_*` | unset | Outgoing email. Unset = log mode; in production codes are withheld from the log, so configure SMTP to deliver them. | | `PURGE_AFTER_DAYS` | `30` | Retention for the hourly soft-delete sweep | | `AUDIT_RETENTION_DAYS` | `365` | Retention for the master audit trail (separate, longer window) | | `DB_CONNECTION_LIMIT` | `10` | Prisma pool size per API process (keeps replicas under `max_connections`) | | `SLOW_QUERY_MS` | `200` | Log Prisma queries slower than this (0 = off) | | `POSTGRES_SHARED_BUFFERS` | `256MB` | Postgres `shared_buffers` for the bundled container | | `POSTGRES_WORK_MEM` | `8MB` | Postgres `work_mem` for the bundled container | | `POSTGRES_MAX_CONNECTIONS` | `100` | Postgres `max_connections` for the bundled container | To build the image from a checkout instead of pulling, uncomment `build: .` in `docker-compose.yml`. For a TLS-terminating proxy in front, keep `PUBLIC_ORIGIN=https://…`, set `COOKIE_SECURE=true` and `TRUST_PROXY=1`. For 2–4 API replicas behind the bundled nginx/Caddy proxy, use the optional `docker-compose.scale.yml` overlay; sizing, rollout and the rollback to one replica are in [Scaling](./docs/SELF-HOSTING.md#scaling-streams-and-multiple-nodes). **Agent launch** — [administrator and agent developer scenarios, launch checklist and upgrade notes](./site/src/content/docs/docs/agent-launch.md) ([на русском](./site/src/content/docs/ru/docs/agent-launch.md)). The [runbook](./site/src/content/docs/docs/runbooks.md) covers backup, isolated restore drills and upgrade rollback. **Full guide** — TLS setup (Caddy/nginx/Traefik), backups & restore, the environment reference and troubleshooting: **[docs/SELF-HOSTING.md](./docs/SELF-HOSTING.md)**. --- ## Master panel (platform admin) Regular accounts are **not** admins — the panel at **`/app/admin`** belongs to the platform operator (the "master"), and there is deliberately no HTTP endpoint that can create a master: registration always creates a regular user, and no request can grant master rights. Masters live in their own table with their own login, cookie and JWT audience, so a user session can never open `/app/admin` (and a master token never works on user routes). ### Creating a master account (`admin:create`) The CLI is the only door: registration always creates regular users, and no API call can grant master rights. Run the commands from the repository root, with backend dependencies installed and `backend/.env` present (its `DATABASE_URL` must point at the same database the API uses). ```bash # 1. Interactive (recommended) — the password is typed at a hidden prompt # twice (it must match), nothing lands in the shell history. npm run admin:create -w backend -- --email me@example.com # Password: ******** # Repeat password: ******** # Master account created: me@example.com (owner) ← first master ⇒ OWNER # 2. Non-interactive (CI/automation) — password via environment, never argv. # `read -s` keeps it out of the shell history too. read -s ADMIN_PASSWORD && export ADMIN_PASSWORD npm run admin:create -w backend -- --email ci@example.com unset ADMIN_PASSWORD # 3. Explicit role and display name: --owner makes this master an OWNER # (without it a second master is created as OPERATOR). npm run admin:create -w backend -- --email ops@example.com \ --display-name "Ops" --owner # 4. Re-key an existing master: sets a new password, revokes every session # of that master and clears any lockout. Same password rules. npm run admin:passwd -w backend -- --email me@example.com # 5. Who exists: email, role, display name, last login, disabled/locked # flags. No secrets are ever printed. npm run admin:list -w backend # me@example.com owner - never logged in # Full reference, straight from the CLI: npm run admin:create -w backend -- --help ``` Rules worth knowing: - **Password**: 8–100 characters. There is deliberately **no `--password` flag** — a password in `argv` leaks into `ps` output and shell history. Without a TTY and without `ADMIN_PASSWORD` the CLI refuses to run. - **Role**: the **first** master in an empty database becomes `OWNER` automatically; every later CLI master is `OPERATOR` unless `--owner` is passed. Owners can add/block/reset masters right in the panel (**Masters** page); operators have full data access but cannot manage masters, so a stolen operator session cannot escalate. - **Email** is required and normalized to lowercase; creating a duplicate fails with a hint to use `admin:passwd`. - **Audit**: every create/re-key writes an `AdminAuditLog` row (`via: "cli"`), visible on the panel's **Audit** page. - Sign in at `http://localhost:5173/admin` (dev) or `https://your-host/app/admin` (self-hosted). Sign-out sits in the top-right corner. - What you get there: metrics with 14-day sparklines plus a runtime card (version, uptime, DB latency), all users (search, filter, create with a one-time password, block → sessions die instantly, revoke API tokens), all boards (create for an owner, archive/restore, soft-delete), all cards and comments (search + moderation), active sessions and personal API tokens (scoped to a board, read-only or rate-limited) with per-row revoke, the cross-board command log, and the audit trail of every master action. Tables follow the database schema (see Highlights) and search matches foreign-key IDs. The board content editor (`/app/admin/boards/:id/content`) creates and renames columns and cards **through the command log on behalf of the board owner**, so the board UI stays consistent. - Hardening that ships with it: argon2id hashes, 5-failed-login lockout (15 min) plus rate limiting, per-entity refresh rotation with reuse detection, response shapes that never include password/token hashes, and an audit row for every login attempt and mutation. --- ## Drive it from an AI agent (MCP + skill) Janosik lets AI agents and people work on shared boards. The MCP server provides the tools; the skill describes a consistent workflow for using them: - **`@janosik/mcp` 0.6.0 — the tools.** An MCP server (87 tools across 16 groups) for boards, **epics**, columns, cards, labels, checklists, links, comments, activity, attachments, agent sessions, approvals, plans and run inspection. Optional toolsets add members, share links and account identity. Any compatible MCP client can connect with a personal API key (`jnk_…`) whose scope preset decides what it may read and write. Writes use the same command log as the UI, so they can be undone and stream live to other board members. The same package ships `janosik-mcp-http`, a shared Streamable HTTP gateway for agent fleets. - **`skills/janosik` — workflow guidance.** It tells the agent to read before writing, start and heartbeat an agent session, claim a card under a time-limited lease, keep its description, checklist and comments structured, use reserved `agent:*` labels, check the configured workflow before a move, and return blocked work with evidence instead of marking it Done. ### 1. Get an API key In the app: **Account → API keys → create** (starts with `jnk_`). Give each agent its **own user account and key**, so the activity feed shows who did what and revoking one key stops one agent. A key can be scoped when you create it: restrict it to a single board, make it **read-only** (writes answer `403 pat_read_only`), while session start/heartbeat/end and revert preview remain available to observers, and give it its own requests-per-minute budget (over budget answers `429`) — a board-scoped, read-only key is the least-privilege choice for an agent. ### 2. Add the MCP server ```json { "mcpServers": { "janosik": { "command": "npx", "args": ["-y", "@janosik/mcp"], "env": { "JANOSIK_URL": "https://boards.example.com", "JANOSIK_TOKEN": "jnk_…" } } } } ``` Works in Claude Desktop/Code, Cursor, VS Code, opencode and Codex. For a swarm of agents on one host, the package also ships a **separate Streamable HTTP gateway** (`janosik-mcp-http`): one process serves many sessions, each binding its own `Authorization: Bearer jnk_…`, so 500 agents do not spawn 500 Node processes. Initialize is gated locally per IP/token (per-key cap `min(50, MAX_SESSIONS)` by default) before the API; raise API `THROTTLE_LIMIT` for a large first-time swarm. Sessions live in gateway memory, so a restart drops them and replicas need session affinity; limits and the SSE/proxy setup are in [mcp/README.md](./mcp/README.md#shared-streamable-http-gateway). Start it with `docker compose --profile mcp up -d`. `JANOSIK_APP_BASE` is only needed when the app is not at the site root (e.g. `/app`). By default the server registers the board-work and agent-session tools; member, share and account-identity tools are opt-in (`JANOSIK_MCP_TOOLSETS`), and attachment upload/download stays off until you set `JANOSIK_MCP_ALLOW_FS=1`. An API key carries an owner-editable scope preset (`observer`, `worker`, `reviewer`, `admin`) and an optional `trustedCi` flag; destructive actions need a human approval unless the key is trusted CI. **Agent sessions.** Before the first write, call `janosik_start_session` on the target board and keep using the same MCP connection; send `janosik_heartbeat` with the current card and progress about once a minute, and finish with `janosik_end_session`. Operators can require a live session for API-token board writes with `AGENT_REQUIRE_SESSION=true`. The MCP client explains how to recover from `agent_session_required` (start on that board) and `agent_session_stale` (heartbeat and retry), while reads and plan previews stay available. ### 3. Add the skill Drop `skills/janosik/` into your harness's skills directory — Claude Code: `~/.claude/skills/`, opencode: `~/.config/opencode/skills/`, agent-compatible harnesses: `~/.agents/skills/`. Details in [skills/janosik/README.md](./skills/janosik/README.md). The skill needs no configuration; it provides Janosik-specific guidance for working with cards. ### What the agent does with it The agent claims a card under an **atomic lease** (`janosik_claim_card`, released with `janosik_release_card`): the server refuses a claim while another member still holds a live lease, and the lease expires automatically if an agent stops responding. For a multi-card feature it can create an epic with `janosik_create_epic`, attach each card through `epicId`, read the epic's progress with `janosik_get_board` and complete it with `janosik_update_epic`. It comments as it goes, fills the description and checklist, moves it **In Progress → Review → Done**, and on a bug moves it **back** (to Bugs / In Progress) with a comment describing the defect — so a reviewer sees the card travel forward, back and forward again, with a reason at every turn. That backward move plus the comment is the audit trail. The skill asks the agent to leave a card another agent can continue without prior context: description sections (`Why` / `Scope` / `Acceptance criteria` / `Out of scope` / `Verify`), a `Definition of Done` checklist, and typed comments (a structured `kind`: `status` / `question` / `blocker` / `evidence` / `handoff`) so the thread is machine-readable and filterable. It can also write the card's task contract (`janosik_set_card_task_spec` sets `acceptanceCriteria` + `definitionOfDone`); the card dialog shows that contract, and a board ADMIN or MEMBER can edit or clear it there. The agent can tag cards with the reserved `agent:blocked` / `agent:needs-human` / `agent:verified` labels. Every command records whether a person or an agent caused it, so an agent's entries carry an "Agent" badge in the card history. Full guide in-repo: [mcp/README.md](./mcp/README.md) and [skills/janosik/SKILL.md](./skills/janosik/SKILL.md). The HTTP contract behind both MCP and the UI is published as an [OpenAPI 3.1 document](./site/public/openapi.yaml); it covers the agent-control surface and the core board write path, and lists the stable error codes and headers. See also [mcp/README.md](./mcp/README.md) and the [site API reference](https://janosik.app/docs/api/). --- ## Scripts Root scripts cover the npm workspaces: | Command | What it does | | --- | --- | | `npm run dev` | UI dev server (`npm run dev -w ui`; default port 5173, proxies `/api` to `:3000`) | | `npm run dev:site` | Marketing site + docs dev server (`npm run dev -w site`; Astro, default port 4321) | | `npm run build:site` | Build the Astro site (`site/dist`) | | `npm run build:mcp` | Build the MCP server (`mcp/dist`) | | `npm run build` | Type-check + build the UI (`ui/dist`) | | `npm run build:backend` | Prisma generate + compile the API (`backend/dist`) | | `npm run preview` | Serve the built UI locally | | `npm test` | Vitest suites for UI, shared, brand, site and MCP (not backend) | | `npm run test:backend` | Backend Jest unit + e2e (e2e creates/migrates `janosik_test` first) | | `npm run openapi:check` | Validate the public OpenAPI 3.1 contract and its operation ids/refs | | `npm run openapi:test` | Negative tests for the OpenAPI validator | | `npm run test:e2e` | Playwright against configured running servers; see [e2e/README.md](./e2e/README.md) for the isolated Docker runner | | `npm run test:coverage` | Vitest coverage for UI, shared and brand | | `npm run lint` | ESLint in the seven application and tooling workspaces | | `npm run format` / `format:check` | Prettier write / verify (repo-wide) | | `npm run size` | size-limit budgets for the UI bundle (entry, lazy chunks, admin chunk) | Workspace-specific extras worth knowing: | Command | What it does | | --- | --- | | `npm run start -w backend` | Run the built API (`node backend/dist/main.js`); applies pending migrations first | | `npm run prisma:deploy -w backend` | Apply Prisma migrations to `DATABASE_URL` (without starting) | | `npm run admin:create -w backend` / `npm run admin:passwd -w backend` / `npm run admin:list -w backend` | Master-account CLI (see above) | | `npm run test:watch -w ui` | Vitest in watch mode | --- ## Project structure (UI workspace in detail) ```text ui/ ├─ public/ # PWA: manifest, icons ├─ src/ │ ├─ admin/ # master panel: pages (including epics), admin-client, i18n, fake API │ ├─ api/ # fetch client (tokens, auth-lost callback, keepalive commands) │ ├─ auth/ # AuthContext (session, login/register/logout) │ ├─ components/ │ │ ├─ board/ # Columns, cards, epics, card dialog, filters, views (board/calendar/table/watch) │ │ ├─ auth/ # LoginPage, logout confirmation │ │ ├─ account/ # personal panel: profile, password, API keys, preferences │ │ ├─ editor/ # MDXEditor description editor (plugins, code blocks, i18n) │ │ └─ ui/ # Base UI + Radix primitives and local wrappers │ ├─ hooks/ # theme, board background, column glass, card labels │ ├─ i18n/ # i18next setup (keys typed from the EN catalog), time format │ ├─ locales/ # en/ru translation.json │ ├─ pwa/ # service worker + its registration (production only) │ ├─ store/ # BoardContext, summary/detail read model, history, server-sync, persistence │ ├─ types/ # UI-only types (domain model lives in @janosik/shared) │ ├─ utils/ # storage, persistence, backups, serialization, dnd, backlog rows, filter, due dates │ ├─ App.tsx # Provider tree + layout (+ lazy master panel route) │ ├─ main.tsx # Theme preflight + SW registration + entry point │ └─ index.css # Design tokens (Tailwind v4 @theme) ├─ vite/ # Build plugins (service worker emit + cache version) ├─ index.html ├─ vite.config.ts ├─ vitest.config.ts └─ package.json ``` --- ## Architecture (30 seconds) - **Normalized data model** — a `Board` holds ordered `Column[]`, a `Record`, `Label[]` and `Epic[]`. Reordering = reordering id arrays. Archived cards stay in the map with `archivedAt` and are dropped from `column.cardIds` until restored. - **Board epics** — an epic is a board-scoped record with a title, status and dates; a card carries an optional `epicId`. `ADD_EPIC`/`UPDATE_EPIC`/`SET_EPIC_STATUS`/`DELETE_EPIC` go through the same reducer and command log as card actions, so undo, SSE, history and MCP all see them. The Backlog row model interleaves epic tiles and cards; a soft-deleted epic leaves its cards in place. - **Pure reducer in `shared`** — `boardReducer` (50+ actions) is a pure function; every action returns a new board, which makes undo/redo, coalescing and testing trivial. The backend executes the identical reducer when a command reaches the command log, so UI and server can never diverge. - **One provider, three contexts** — `BoardProvider` owns state, debounced persistence (400 ms), per-board history, hotkeys and auto-backups in local mode. It publishes the board data, the actions (assembled once, so write-only components never re-render) and undo availability separately. Components only call typed convenience actions (`addCard`, `moveCard`, …). - **Persistence is swappable — and was swapped** — the `DebouncedPersistence` interface wraps `localStorage` for the local mode; server mode adds a fetch adapter (`ui/src/api/client.ts` + `ui/src/store/server-sync.ts`) that ships the same actions to the command log **without touching the reducer or the UI** (optimistic updates on top of the same actions). In server mode board data is deliberately not mirrored into `localStorage` (accounts on a shared browser must not see each other's boards). - **Performance** — the board shell hydrates from a summary plus paged card detail (`GET /boards/:id/summary` and `/cards`, with ETag/304 and gzip/Brotli), then streams the remaining summaries in the background; an aggregate cache serves repeated board reads. The MDXEditor description editor and the calendar are lazy-loaded on first use; vendor libraries are split into stable chunks that the service worker caches; the Backlog virtualizer handles mixed epic/card rows; columns, cards, insert zones and table rows are memoized, so typing in one card re-renders only its own column (or table row) — the cost per keystroke no longer grows with the board. See [ROADMAP.md](./ROADMAP.md) for project priorities, architecture decisions and task status. --- ## Contributing 1. Work happens in feature branches off `main` — `feat/`, `fix/` or `chore/`; never commit to `main` directly. Open a PR and let CI run. 2. Before pushing, make sure everything is green: ```bash npm run lint npm run format:check npm test npm run test:backend # needs the PostgreSQL test database running npm run test:docker -w e2e -- tests/app # Docker + Google Chrome npm run build npm run size ``` 3. UI unit and component tests use Vitest + React Testing Library. Backend end-to-end tests use Jest + Supertest against PostgreSQL. CI also runs the Google Chrome Playwright suites against disposable Docker stacks, sharded across board, admin, no-mail and security jobs. New browser coverage goes in `e2e/tests/app` or `e2e/tests/admin`; see [e2e/README.md](./e2e/README.md). 4. New UI strings land in both `src/locales/en` and `src/locales/ru` synchronously; colors come only from the design tokens in `src/index.css`. 5. Change the data model, a board operation, validation or an API contract in `@janosik/shared` first — both `ui` and `backend` compile against it. 6. The backend follows the fixed stack in `ROADMAP.md` §7 (NestJS/Prisma/PostgreSQL/JWT) and its iteration order. 7. By submitting a pull request you agree that your contribution is licensed under the [AGPL-3.0 License](./LICENSE), the same terms as the rest of the project. See [CONTRIBUTING.md](./CONTRIBUTING.md) for the full guide — dev setup, the gate commands, and the required DCO sign-off (`git commit -s`). --- ## License [AGPL-3.0](./LICENSE) © 2026 Vitali Toustsik You may use, self-host, fork and modify the code, including commercially. See [LICENSE](./LICENSE) for the full AGPL-3.0 terms. In particular, if you run a modified version as a network service, the license requires you to offer its source code to the people using that service. **Trademarks.** The license covers the code, not the name. "Janosik" and the feather mark identify this project; forks are welcome but must not present themselves as the official Janosik or its hosted service — see [TRADEMARK.md](./TRADEMARK.md).