# Athena TODO

## Existing Items

- Pipe logs into the `logs` table from pg | [SFM-3461](https://linear.app/suitsbooks/issue/SFM-3461/pipe-logs-into-the-logs-table-from-pg)
  ✅ Postgres athena provisioning pipeline | [SFM-3462](https://linear.app/suitsbooks/issue/SFM-3462/postgres-athena-provisioning-pipeline)
- Network management | [SFM-3463](https://linear.app/suitsbooks/issue/SFM-3463/network-management)
  ✅ Athena workbench | [SFM-3464](https://linear.app/suitsbooks/issue/SFM-3464/athena-workbench)
- Interface full PG-meta | [SFM-3465](https://linear.app/suitsbooks/issue/SFM-3465/interface-full-pg-meta)
  [WIP 50%] Get sequin stable | [SFM-3468](https://linear.app/suitsbooks/issue/SFM-3468/get-sequin-stable)
  ✅ Build the Athena JS SDK | [SFM-3469](https://linear.app/suitsbooks/issue/SFM-3469/build-the-athena-js-sdk)
  [WIP 60%] Build the CDC WSS client | [SFM-3470](https://linear.app/suitsbooks/issue/SFM-3470/build-the-cdc-wss-client)
  ✅ Build the Athena RS SDK | [SFM-3466](https://linear.app/suitsbooks/issue/SFM-3466/build-the-athena-rs-sdk)
  ✅ Build the Athena Gateway API | [SFM-3467](https://linear.app/suitsbooks/issue/SFM-3467/build-the-athena-gateway-api)
  ✅ Write an OpenAPI 3.0.3 for the gateway API | [SFM-3446](https://linear.app/suitsbooks/issue/SFM-3446/athena-database-feature-implementation-batch)
  [WIP 80%] Backup infrastructure | [SFM-3471](https://linear.app/suitsbooks/issue/SFM-3471/backup-infrastructure)
  [WIP 80%] Rollback infrastructure | [SFM-3472](https://linear.app/suitsbooks/issue/SFM-3472/rollback-infrastructure)
  [WIP 30%] Sequin change retention | [SFM-3473](https://linear.app/suitsbooks/issue/SFM-3473/sequin-change-retention)
  [WIP 80%] Usable GUI | [SFM-3474](https://linear.app/suitsbooks/issue/SFM-3474/usable-gui)
  ✅ Build the Athena MCP | [SFM-3475](https://linear.app/suitsbooks/issue/SFM-3475/build-the-athena-mcp)
  ✅ Build API Keys, (better auth) | [SFM-3479](https://linear.app/suitsbooks/issue/SFM-3479/build-api-keys-better-auth)
  ✅ Make the DockerFile | [SFM-3480](https://linear.app/suitsbooks/issue/SFM-3480/make-the-dockerfile)
  ✅ Build the pipeline ETL engine | [SFM-3476](https://linear.app/suitsbooks/issue/SFM-3476/build-the-pipeline-etl-engine)
  ✅ Write the Athena driver | [SFM-3477](https://linear.app/suitsbooks/issue/SFM-3477/write-the-athena-driver)
  ✅ Load balancer to other mirrors | [SFM-3478](https://linear.app/suitsbooks/issue/SFM-3478/load-balancer-to-other-mirrors)
  ✅ Traffic logging all to a logging db | [SFM-3482](https://linear.app/suitsbooks/issue/SFM-3482/traffic-logging-all-to-a-logging-db)
  ✅ Good error handling and hints | [SFM-3483](https://linear.app/suitsbooks/issue/SFM-3483/good-error-handling-and-hints)
- Load testing | [SFM-3484](https://linear.app/suitsbooks/issue/SFM-3484/load-testing)
  [WIP] Athena-Scylla driver | [SFM-3485](https://linear.app/suitsbooks/issue/SFM-3485/athena-scylla-driver)
  ✅ Athena-Postgres driver | [SFM-3481](https://linear.app/suitsbooks/issue/SFM-3481/athena-postgres-driver)
  ✅ Calculation modules | [SFM-3488](https://linear.app/suitsbooks/issue/SFM-3488/calculation-modules)
  ✅ Add group_by as calc module | [SFM-3487](https://linear.app/suitsbooks/issue/SFM-3487/add-group-by-as-calc-module)
  ✅ Add levensthein_distance as calc module | [SFM-3486](https://linear.app/suitsbooks/issue/SFM-3486/add-levensthein-distance-as-calc-module)
  ✅ Moka cache | [SFM-3489](https://linear.app/suitsbooks/issue/SFM-3489/moka-cache)
- Cache to a KV db like Redis or Dragonfly | [SFM-3490](https://linear.app/suitsbooks/issue/SFM-3490/cache-to-a-kv-db-like-redis-or-dragonfly)
- Write a tests Suite for E2E API | [SFM-3494](https://linear.app/suitsbooks/issue/SFM-3494/write-a-tests-suite-for-e2e-api)
- Write a tests suite for the E2E CDC Engine | [SFM-3493](https://linear.app/suitsbooks/issue/SFM-3493/write-a-tests-suite-for-the-e2e-cdc-engine)
  ✅ Write a tests suite for the Athena-MCP server | [SFM-3492](https://linear.app/suitsbooks/issue/SFM-3492/write-a-tests-suite-for-the-athena-mcp-server)
  ✅ Write a tests suite for the ahtena-js sdk | [SFM-3491](https://linear.app/suitsbooks/issue/SFM-3491/write-a-tests-suite-for-the-ahtena-js-sdk)
  ✅ Write a tests suite for the athena_rs sdk | [SFM-3495](https://linear.app/suitsbooks/issue/SFM-3495/write-a-tests-suite-for-the-athena-rs-sdk)
  ✅ Reverse engineer and backwards comp the Postgrest supabase interface | [SFM-3496](https://linear.app/suitsbooks/issue/SFM-3496/reverse-engineer-and-backwards-comp-the-postgrest-supabase)
- Prevent querying of CQL / Scylla endpoints if there's no scylla client available
- If host for scylla or pg couldn't be resolved don't let the error leak
  ✅ Add an endpoint & Table that shows all the current Mirrors and their status & version
- Make a very nice web documentation for all the SDKs (JS & RS and the MCP server)
- Make a Grafana dashboard
  ✅ Add prometheus metrics endpoint globally for Athena per mirror, and on a x-athena-client scope
- Purge the registry endpoints since they still call a arcane supabase anyways
- Enrich the logging solution and save more
- Online log viewer
  ✅ Online gateway or sdk playground
  ✅ Backup functionality -> S3 (Via Directory & PG_DUMP)
  ✅ Restore functionality <- S3 (Via Directory & PG_RESTORE)
- Add a direct clone functionality with instant Backfill with Athena-CDC (db1.table1 -> db2.table1)
- Add support for schema and table creation for Athena CDC
- Add support for backing up of schemas -> S3
- Add support for rollbacking schemas <- S3
  ✅ Add webhook event system
- Finalize the events orchestration and scheduling system in the Athena-CDC engine allowing websocket travel
- Add support for installing extensions on a PG db
- Add support for fully provisioning a PG db -> Athena db (on hetzner & railway)
- Add postgres grafana dashboards
- Ingest all the logs from railway databases via Stargate

---

## Client Application Enhancements (Web Explorer UI)

### Bugs

- [x] SQL Editor has no intellisense about tables/columns in the database
- [x] `SUPABASE_POSTGRES_URI` env var error — should use gateway URL from settings, not hardcoded env
- [ ] "No columns" shown in side panel despite columns existing and rendering in the data grid
- [x] No horizontal scrollbar on the data grid
- [ ] "Failed to fetch clients" error on first API key entry — should auto-load after save
- [x] "Gateway API key enforcement cannot be evaluated because the auth store is unavailable" — investigate if UI or API level, log all API requests
- [x] Creating an API key causes blank page
- [ ] Failed cluster health fetch is silently swallowed — show error and log it

### UI / UX Improvements

- [x] Dark mode should be full black (`#000000` background)
- [ ] All switches and buttons should use HeroUI v3 library
- [ ] Replace base URL combobox with newest Shadcn Combobox component
- [ ] Reduce aggressive border-radius / rounding across the app
- [ ] Mobile responsiveness is very poor — fix across all views
- [ ] Make overall UI look more professional and polished
- [ ] Settings pages should match the Supabase-style design shown in reference images
- [ ] Filters should not be a super-long horizontal bar — redesign as dropdown/popover

### Data Grid Enhancements

- [ ] Right-click cell context menu: "View full value" in side sheet (for large JSON, etc.), "Edit value"
- [ ] Editing a cell adds to a pending transaction (not-yet-executed SQL), visible in an app-wide bottom island
- [ ] JSON values opened in side sheet should be editable in a Monaco editor
- [ ] Allow selecting rows (checkbox column) with bulk delete and CSV export
- [ ] Add client-side caching so switching tables doesn't reload constantly

### SQL Editor Enhancements

- [ ] Add table/column intellisense from the database schema
- [ ] Save queries to `athena_logging` database
- [ ] Save and display previously executed queries (query history)

### Schema & Table Management

- [ ] View SQL schema of a table (via right-click or context menu)
- [ ] Create new tables UI
- [ ] Add/remove/change column types on existing tables
- [ ] Schema switching for databases with multiple schemas

### New Pages / Views

- [ ] Logs page — view gateway request and operation logs
- [ ] Backups page (stub for now)
- [x] Functions page — show postgres functions (API routes exist)
- [x] Triggers page (Supabase-like trigger management)
- [x] Database Extensions tab
- [ ] Database Publications tab
- [ ] Database Configuration tab
- [ ] Database Indexes tab
- [ ] Replication page (with add destination UI as shown in reference image)
- [ ] Authentication page (better-auth backend supported)
- [x] Connection modal — show how to connect via Athena-MCP, @xylex-group/athena, athena_rs, or postgres URL

### Table Context Menu (Right-click in sidebar)

- [ ] Copy name
- [ ] Copy table schema
- [ ] Edit table
- [ ] Export data
- [ ] Delete table
- [ ] Hide table

### Database Page Enhancements

- [x] Show database-level statistics: table count, total columns, total size, etc.

### API & Logging

- [ ] Log all API requests to Athena (with target URL) and make them viewable
- [ ] Create SQL migration files for all new tables in `/sql/` folder
- [ ] Use Athena MCP to create tables following athena policy

### Infrastructure

- [x] All athena-related tables go on `athena_logging` client database
