{
  "markdown": "# Poshkan — Paper Trading\n\nRisk-free US stock paper trading. Start with virtual cash, practice the market,\ntrack holdings and P&L — no real money on the line.\n\n> See [DESIGN.md](DESIGN.md) for the full product/architecture design.\n\n## Stack\n\n- **Next.js 16** (App Router) + **TypeScript** + **Tailwind CSS v4**\n- **Supabase** — auth (with email confirmation), Postgres, Row-Level Security\n- **Twelve Data** — primary quotes and OHLC history, proxied server-side\n- **Yahoo Finance** — symbol discovery, news, quote enrichment, and automatic fallback\n- **TanStack Query** — live quote polling\n\n## Setup\n\n### 1. Install dependencies\n\n```bash\nnpm install\n```\n\n### 2. Create a Supabase project\n\n1. Create a project at [supabase.com](https://supabase.com).\n2. Open the **SQL Editor** and run the contents of [`supabase/schema.sql`](supabase/schema.sql).\n   This creates the tables, RLS policies, the auto-profile trigger, and the\n   trading RPC functions.\n3. Run [`supabase/market-data-cache.sql`](supabase/market-data-cache.sql) to enable the shared,\n   service-role-only Twelve Data candle cache.\n4. In **Authentication → Providers → Email**, keep \"Confirm email\" enabled.\n5. In **Authentication → URL Configuration**, set the production Site URL and add these exact\n   redirect URLs (plus the equivalent URL for any other production hostname you serve):\n   - `https://www.poshkan.com/auth/callback`\n   - `http://localhost:3000/auth/callback`\n6. Run [`supabase/google-auth.sql`](supabase/google-auth.sql) in the SQL Editor. This updates the\n   profile trigger so social-auth users receive a non-email, collision-safe username.\n\n### 2a. Enable Google sign-in\n\n1. In the Google Auth Platform console, configure the OAuth consent screen and create an OAuth\n   client with application type **Web application**.\n2. Add your app origins under **Authorized JavaScript origins**, for example\n   `https://www.poshkan.com` and `http://localhost:3000`.\n3. Under **Authorized redirect URIs**, add the Supabase callback URL shown on the Supabase\n   **Authentication → Providers → Google** page. It has this form:\n   `https://YOUR-PROJECT-REF.supabase.co/auth/v1/callback`.\n   This is the Supabase URL, not Poshkan's `/auth/callback` URL.\n4. Copy the Google Client ID and Client Secret into Supabase's Google provider settings and enable\n   the provider.\n\n### 3. Get a Twelve Data API key\n\nSign up at [twelvedata.com](https://twelvedata.com) and copy your API key from\nthe dashboard. The free tier is rate-limited (~8 requests/min) — fine for dev.\n\n### 4. Configure environment\n\nCopy `.env.local.example` to `.env.local` and fill in:\n\n```\nNEXT_PUBLIC_SUPABASE_URL=https://YOUR-REF.supabase.co\nNEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key\nTWELVE_DATA_API_KEY=your-twelve-data-key\nTWELVE_DATA_CREDITS_PER_MINUTE=8\nNEXT_PUBLIC_SITE_URL=http://localhost:3000\n```\n\n> The Twelve Data key is **server-only** — never prefix it with `NEXT_PUBLIC_`.\n\n### 5. Run\n\n```bash\nnpm run dev\n```\n\nOpen [http://localhost:3000](http://localhost:3000).\n\n## How it works\n\n- **Auth** — users can continue with Google, or use email/password with email confirmation. Google\n  returns through `/auth/callback`; email confirmation returns through `/auth/confirm`.\n- **Accounts** — create multiple paper portfolios with starting cash and\n  optional seeded holdings. Top up or reset cash anytime.\n- **Trading** — search a symbol, then Buy / Sell / add to Watchlist. Trades fill\n  at the live price (fetched server-side at execution) via an atomic Postgres\n  RPC that validates cash and share balances (long-only, no margin).\n- **P&L** — holdings show shares, avg cost, live price, day %, market value, and\n  unrealized P&L in $ and %.\n\n## Roadmap (v2)\n\nCrypto & Forex asset classes, limit orders, transaction-history view,\naccount-value charts.\n",
  "bytes": 3796,
  "sha": "98e88d8e8d00a57789c9e18f24d51480c90e19e47a0c6d437147b2ac4298a15f",
  "repo_slug": "afrazja/poshkan-v2",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_afrazja_poshkan_58497c4c/readme"
}