# ajet-chat PRDs

Product Requirements Documents for ajet-chat v1.

## Documents

| Module | PRD | Test Cases | Status |
|--------|-----|------------|--------|
| [shared](shared.md) | DB, EventBus, API Client, Schemas, Mentions, Markdown, Config, Logging, Storage | 92 | v1 |
| [api](api.md) | REST API: 15 endpoint groups, full CRUD, health check, ban/mute | 129 | v1 |
| [auth-gw](auth-gw.md) | OAuth, session/token validation, reverse proxy, CORS, audit logging | 40 | v1 |
| [web-sm](web-sm.md) | Browser UI: Datastar SSE, Discord layout, emoji picker, toasts | 57 | v1 |
| [tui-sm](tui-sm.md) | TUI session manager: SSE JSON events, backpressure | 30 | v1 |
| [cli](cli.md) | CLI commands + Rich TUI (clojure-tui), bbin packaging, exit codes | 79 | v1 |
| [infrastructure](infrastructure.md) | Docker Compose (dev/test/prod), NATS JetStream, MinIO, nginx | 10 | v1 |
| [mobile](mobile.md) | Deferred — PWA recommended for v1 | 0 | v2+ |

**Total test cases: 437**

## Key Product Decisions

- **Multi-community** — users can be in multiple communities (Discord model)
- **Discord-style layout** — community icon strip, categories, channel sidebar
- **DMs are global** — separate from communities, always accessible
- **Flat threads** — Slack-style 1-level threads, no nesting
- **Discord-flavor markdown** — bold, italic, strikethrough, underline, spoilers, code blocks
- **Mention storage** — `@<user:uuid>` / `@<here>` / `#<channel:uuid>` in DB, rendered at display time
- **1-hour edit window** — messages can only be edited within 1 hour of creation
- **Images + paste** — clipboard paste and upload, no arbitrary file types in v1
- **OAuth auth** — GitHub + Gitea + generic OIDC (future: email-based auth via magic link/OTP)
- **DB-stored OAuth providers** — OAuth provider config stored in `oauth_providers` table, manageable at runtime via admin API
- **Admin setup wizard** — multi-step first-deployment bootstrap: configure providers, admin OAuth login, create first community
- **3-tier roles** — Owner / Admin / Member (no custom roles in v1)
- **Invite links + direct invites** — admins generate links or invite by user ID
- **Incoming webhooks** — external services POST to channel (outgoing deferred)
- **Full slash commands** — /help, /kick, /ban, /mute, /topic, /nick, /token, /webhook, /status
- **Global search** — messages + channels + users via PostgreSQL tsvector
- **Full Datastar hypermedia** — server-rendered HTML, SSE fragment updates, minimal client JS
- **Paginated messages** — "Load older" button, cursor-based pagination
- **Rich TUI** — split panes, inline images (timg/sixel), markdown rendering, mouse support
- **Full CLI** — all operations scriptable, JSON output, stdin piping
- **Tailwind CSS** — dark theme, utility-first styling in Hiccup
- **Ban/mute enforcement** — bans permanent until lifted, mutes time-limited with auto-expiry
