nafi@portfolio:~$
bash — ~/projects/lmhub
$cd ~/projects/lmhub && cat summary.txt
SaaS-style all-in-one AI chat: one authenticated interface for OpenAI, Anthropic and Gemini with streaming responses, usage and cost tracking, rate limiting and credit-based billing — multi-tenant, so every user only sees their own data.

LMHUB

Full-Stack Developer · #b6f0d32 ai-saas
Next.js 16 · React 19 · Vercel AI SDK · Postgres · Upstash Redis · Stripe github.com/sleepyhead000/LMHub
~/projects/lmhub $

cat README.md

README.md
$cat overview.txt
Users sign up, pick a model per conversation, and stream replies rendered as Markdown with code blocks. Conversations are scoped to the account, usage draws down a credit balance, and the whole thing is one interface instead of three vendor dashboards.
$cat architecture.txt
Next.js App Router with route handlers: /api/auth (login, signup with bcrypt + jose JWT cookie), /api/conversations CRUD, /api/chat streaming through the Vercel AI SDK (@ai-sdk/openai / anthropic / google), and /api/stripe checkout + webhook for credits. Postgres via pg; react-markdown + remark-gfm for rendering.
$cat limits.txt
Rate limiting and caching run on Upstash Redis (@upstash/ratelimit) so counters stay correct across serverless instances. Pricing tiers and per-request credit costs live in one config module rather than being scattered through handlers.
$cat routes.txt
A Next middleware (proxy.ts) verifies the JWT cookie on every request: public routes are just /login, /signup, / and the Stripe webhook — everything else redirects to /login, and an invalid token is deleted on the spot. Pages: dashboard, chat, billing, login, signup.
~/projects/lmhub $

ls -l features/

models
Multi-provider chat · OpenAI · Anthropic · Gemini — one interface
streaming
Streaming responses · Vercel AI SDK · Markdown + GFM code blocks
threads
Conversations · per-user CRUD · switch model mid-thread
usage
Usage tracking · credit balance drawn down per request
billing
Credit billing · Stripe Checkout + webhook top-ups · billing page
limits
Rate limiting · Upstash Redis · correct across serverless instances
auth
Auth · bcrypt + jose JWT cookie · login and signup pages
tenancy
Multi-tenant · users only ever see their own conversations
guard
Route guard · Next middleware redirects unauthenticated → /login
~/projects/lmhub $

cat stack.yaml

framework
Next.js 16 (App Router) · React 19 · TypeScript · Tailwind CSS
ai
Vercel AI SDK — ai · @ai-sdk/openai · anthropic · google · @ai-sdk/react
database
Postgres (pg) · conversation and profile tables
auth
bcryptjs · jose (JWT cookie) · middleware route guard
infra
Upstash Redis (@upstash/ratelimit) · Stripe (checkout + webhook)
ui
react-markdown · remark-gfm · lucide-react
~/projects/lmhub $

git log --oneline

#8e2c5b7feat/auth

Auth & middleware route guard

bcrypt · jose · Next middleware
  • Email/password signup and login issue a JWT cookie; middleware verifies it on every request and deletes an invalid token immediately.
  • Public routes are limited to /login, /signup, / and the Stripe webhook — everything else redirects to /login.
  • Sessions persist in the cookie, so no separate session store is needed.
#41fa9c0feat/chat

Multi-provider streaming chat

Vercel AI SDK · route handlers · react-markdown
  • /api/chat streams from OpenAI, Anthropic or Gemini through one handler; the client renders Markdown with GFM for code blocks and tables.
  • A conversation is tied to a model but can switch mid-thread — later messages use the newly selected model.
  • Message history scrolls in a thread that clearly separates user and assistant turns.
#cd77b14feat/billing

Credits, pricing & Stripe

Stripe Checkout · webhook · pricing config
  • Pricing tiers and per-request credit costs live in one config module, so a price change never means hunting through handlers.
  • Stripe Checkout and a webhook route top the credit balance back up after payment.
  • A dedicated billing page shows the balance and purchase options.
#35b9e81feat/limits

Rate limiting & dashboard

Upstash Redis · per-user CRUD · dashboard
  • @upstash/ratelimit keeps per-user limits correct across serverless instances instead of per-instance memory.
  • The conversations API gives per-user CRUD; the dashboard page summarizes threads, and chat/billing pages complete the flow.
  • Multi-tenancy is structural: queries are scoped to the authenticated user, so nobody reads another account's data.