From 64f003015554411cd1d7fec76087bcc2f52a1fe9 Mon Sep 17 00:00:00 2001 From: Daniel Widgren Date: Wed, 24 Jun 2026 10:15:00 +0200 Subject: [PATCH] docs: track CLAUDE.md and update stack to kura Start version-controlling CLAUDE.md so the project notes live with the code (CLAUDE.md is no longer globally gitignored). Fix the stack line: persistence is kura (kura_postgres backend), not pgo (removed in #30). --- .gitignore | 1 - CLAUDE.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 CLAUDE.md diff --git a/.gitignore b/.gitignore index 719d11f..4046932 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ _build/ _checkouts/ priv/attachments/* -CLAUDE.md .claude/ *.crashdump \ No newline at end of file diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..9da3fe9 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,45 @@ +# chatli + +Erlang/OTP real-time chat backend built on the Nova web framework. + +## Stack +- Erlang/OTP, Nova framework, Cowboy +- PostgreSQL via kura (kura_postgres backend) +- JWT auth via jwerl +- Erlydtl templates +- WebSocket for real-time delivery + +## Build & run +```bash +rebar3 compile +rebar3 shell # Dev with config/sys.config.local +rebar3 release # Production release +``` + +## Test & quality +```bash +rebar3 ct # Common Test +rebar3 ci # compile, dialyzer, xref, fmt, lint +rebar3 fmt # erlfmt +rebar3 lint # rebar3_lint +``` + +## Configuration +- Port: 8090 (nova.cowboy_configuration.port) +- DB: PostgreSQL (host: db, port: 5432, user: postgres, pass: root) +- WebSocket idle timeout: 15s +- Attachments: ./priv/attachments/ + +## API routes +- `/v1/*` — public (signup, login, callbacks, history, heartbeat) +- `/client/*` — JWT-protected (messages, chats, participants, devices) +- `/client/device/:deviceid/user/:userid/ws` — WebSocket + +## Structure +- `src/chatli_router.erl` — route definitions +- `src/chatli_db.erl` — database queries +- `src/chatli_auth.erl` — JWT auth +- `src/chatli_ws_srv.erl` — WebSocket server +- `src/chatli_ws_client.erl` — WebSocket client handler +- `src/controllers/` — HTTP endpoint handlers +- `src/plugins/` — Nova middleware