{"id":23874081,"url":"https://github.com/sidmohan0/alphadb","last_synced_at":"2026-04-11T09:42:23.400Z","repository":{"id":270511235,"uuid":"731820228","full_name":"sidmohan0/alphadb","owner":"sidmohan0","description":"Cryptocurrency data infrastructure with real-time WebSocket feeds, automated feature engineering, and Grafana dashboards. Built with TimescaleDB + Rust. Deploy w/ Docker Compose.","archived":false,"fork":false,"pushed_at":"2025-06-13T23:56:28.000Z","size":204,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-08T23:05:05.907Z","etag":null,"topics":["algorithmic-trading","backtesting","cryptocurrency","data-pipeline","docker-compose","feature-engineering","grafana","grafana-dashboard","kraken-exchange-api","market-data","postgresql","python","rust","time-series","timescaledb","websocket"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sidmohan0.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-12-15T00:42:53.000Z","updated_at":"2025-06-13T23:56:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"4f2ce23c-5f31-4bc2-b8a3-c6853eaa5e33","html_url":"https://github.com/sidmohan0/alphadb","commit_stats":null,"previous_names":["sidmohan0/alphadb"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sidmohan0/alphadb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidmohan0%2Falphadb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidmohan0%2Falphadb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidmohan0%2Falphadb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidmohan0%2Falphadb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sidmohan0","download_url":"https://codeload.github.com/sidmohan0/alphadb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidmohan0%2Falphadb/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264363747,"owners_count":23596502,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithmic-trading","backtesting","cryptocurrency","data-pipeline","docker-compose","feature-engineering","grafana","grafana-dashboard","kraken-exchange-api","market-data","postgresql","python","rust","time-series","timescaledb","websocket"],"created_at":"2025-01-03T17:52:17.097Z","updated_at":"2026-04-11T09:42:23.394Z","avatar_url":"https://github.com/sidmohan0.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AlphaDB\n\n![Homepage screenshot](docs/screenshots/homepage.png)\n\nAlphaDB is a prediction-market platform monorepo for backend services, operator tooling, and fast market clients. It currently contains:\n\n- `apps/api` - the production-oriented backend for market ingestion, discovery runs, persistence, and future shared APIs\n- `apps/web` - the browser client for the backend-backed discovery workflows\n- `apps/tui` - the terminal-first market workspace for Polymarket and Kalshi with search, split view, saved markets, and ANSI charts\n- `packages/market-core` - shared provider-neutral market contracts used by the API and TUI\n- `packages/sdk` - shared backend client SDK for market reads, user state, and streaming\n\nThe repository now combines the legacy Polymarket discovery system and the newer multi-provider market workspace in one codebase, so the TUI and future clients can progressively move onto shared backend APIs without a rewrite.\n\n## Platform Direction\n\nThe target shape is:\n\n- one monorepo\n- one canonical market model\n- one backend service layer for search, trending, history, realtime delivery, and user state\n- explicit backend identity for persistent user features\n- multiple clients, starting with web and TUI\n- shared workspace packages for contracts and client access\n\nArchitecture notes and accepted decisions live in:\n\n- `docs/README.md`\n- `docs/adrs/README.md`\n- `docs/checklists/001-backend-convergence-decision-checklist.md`\n- `docs/plans/002-phase-1-backend-convergence.md`\n- `docs/plans/003-phase-2-productionization-baseline.md`\n- `docs/plans/004-fly-deployment-plan.md`\n\n## Workspace Layout\n\n```text\napps/\n  api/   Express + TypeScript backend\n  web/   React + Vite web client\n  tui/   ANSI terminal client\npackages/\n  market-core/ shared market contracts\n  sdk/         shared backend client\ndocs/\n  adrs/\n  checklists/\n  plans/\n  polymarket/\n```\n\n## Local Setup\n\n### 1. Install\n\n```bash\ngit clone https://github.com/sidmohan0/alphadb.git\ncd alphadb\nnpm install\n```\n\n### 2. Start local infra for backend work\n\nThe backend discovery stack uses Postgres and Redis:\n\n```bash\ndocker compose -f docker-compose.discovery-stack.yml up -d\n```\n\nExpected ports:\n\n- Postgres: `localhost:5432`\n- Redis: `localhost:6379`\n- API: `http://localhost:4000`\n- Web: `http://localhost:5173`\n\n### 3. Configure environment\n\n```bash\ncp .env.example .env\nset -a\n. ./.env\nset +a\n```\n\nFor ad hoc local sessions, the backend mainly needs:\n\n```bash\nexport DATABASE_URL=\"postgres://postgres:postgres@localhost:5432/alphadb\"\nexport REDIS_URL=\"redis://localhost:6379\"\nexport ALPHADB_API_USER_STATE_BACKEND=\"postgres\"\nexport DISCOVERY_REQUIRE_SCHEMA=1\n```\n\n### 4. Apply backend schema\n\n```bash\nnpm run markets:ensure-state-schema\nnpm run polymarket:discovery-migrate\n```\n\nThis applies:\n\n- `apps/api/src/markets/infra/db/userStateSchema.sql`\n- `apps/api/src/polymarket/infra/db/schemas.sql`\n\n## Development\n\nRun the backend and web app together:\n\n```bash\nnpm run dev\n```\n\nRun the TUI separately:\n\n```bash\nnpm run dev:tui\n```\n\nRun the TUI against the backend API:\n\n```bash\nALPHADB_API_BASE_URL=http://localhost:4000/api npm run dev:tui\n```\n\nUseful workspace-scoped commands:\n\n- `npm run build` - build api, web, and tui\n- `npm run test` - run backend tests\n- `npm run typecheck:tui` - typecheck the TUI only\n- `npm run markets:ensure-state-schema` - ensure backend user-state schema\n- `npm run markets:seed-state` - seed backend saved/recent state\n- `npm run polymarket:market-channels` - run the backend Polymarket CLI\n- `npm run polymarket:discovery-schema` - ensure discovery schema version state\n- `npm run polymarket:discovery-migrate` - apply discovery schema\n- `npm run fly:deploy:api` - deploy the API with `deploy/fly/api.fly.toml`\n- `npm run fly:deploy:web` - deploy the web app with `deploy/fly/web.fly.toml`\n\n## Fly Deployment\n\nFly deployment artifacts are now checked in:\n\n- `apps/api/Dockerfile`\n- `apps/web/Dockerfile`\n- `deploy/fly/api.fly.toml`\n- `deploy/fly/web.fly.toml`\n- `deploy/fly/release-api.sh`\n\nThe web app reads its production API base URL from `ALPHADB_WEB_API_BASE_URL` at runtime, so you do not need to rebuild the web image just to repoint it at a different API hostname.\n\nUse the runbook in `docs/plans/004-fly-deployment-plan.md` for the full sequence.\n\n## Current Product Surfaces\n\n### API\n\n`apps/api` owns the durable backend primitives:\n\n- Polymarket discovery runs\n- async orchestration and dedupe\n- Postgres persistence\n- Redis-backed coordination\n- normalized market read APIs for trending, search, unified views, and history\n- backend user state for saved markets and recents\n- backend SSE delivery for live market updates across Polymarket and Kalshi\n- migration and maintenance scripts\n\n### Shared Packages\n\n`packages/market-core` and `packages/sdk` define the shared boundary between apps:\n\n- canonical market contracts shared by the API and TUI\n- a reusable backend client for market reads, user state, and streaming\n- a cleaner path for the web client to adopt the same backend contract next\n\n### Web\n\n`apps/web` is the browser client around the backend discovery workflows. It remains useful as an operational and product shell while AlphaDB expands beyond the original Polymarket-only flow.\n\n### TUI\n\n`apps/tui` is the terminal-native market workspace:\n\n- Polymarket and Kalshi providers\n- unified split mode\n- fuzzy search\n- saved and recent markets\n- ANSI candlestick rendering\n\nToday it can run in either direct-provider mode or backend-backed mode. That is intentional during migration; the accepted direction is to move it behind the backend incrementally until the backend is the default source of truth.\n\nWhen `ALPHADB_API_BASE_URL` is set, the TUI now uses backend-owned market reads, backend-owned saved/recent state, backend live streaming for Polymarket and Kalshi, and can authenticate to backend user-state APIs with `ALPHADB_API_TOKEN`. Direct-provider mode remains available as a local fallback.\n\n## Docs\n\n- `docs/adrs/` - production architecture decisions for backend convergence\n- `docs/checklists/` - ordered decision checklist and accepted answers\n- `docs/plans/` - implementation plans\n- `docs/polymarket/` - legacy Polymarket discovery implementation notes and generated artifacts\n\n## Status\n\nPhase 1 convergence is complete. Current work has moved into the productionization baseline: explicit auth, observability, provider package extraction, and hardening backend-owned user features.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsidmohan0%2Falphadb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsidmohan0%2Falphadb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsidmohan0%2Falphadb/lists"}