
router
TanStack Router is a type-safe, data-driven React router with built-in caching, prefetching, and nested layouts, while TanStack Start extends it into a full-stack SSR framework.
SZRouter is a self-hosted, multi-tenant AI token platform with frontend, admin panel, OpenAI-compatible API gateway, async worker, PostgreSQL/pgvector, Redis/BullMQ, and Nginx/Let's Encrypt all in a single TypeScript monorepo.
92
+1
1
0
No data
2026-07-23
It provides a complete, Docker-ready solution for running a production-grade AI token service with billing, RAG, agent marketplace, and workflow capabilities, all in one codebase.
SZRouter 是一个可自托管的多租户 AI Token 平台:前台、运营后台、OpenAI Compatible API Gateway、异步 Worker、PostgreSQL/pgvector、Redis/BullMQ 与 Nginx/Let's Encrypt 都包含在同一个 TypeScript monorepo 中。
token-factory/
├── web/ Next.js 用户前台(3000)
├── admin/ Next.js 管理后台(3001)
├── gateway/ Express API Gateway(8000)
├── worker/ BullMQ Worker / Scheduler
├── packages/database/ Prisma Client、Schema、pgvector SQL
├── nginx/ 三域名反向代理与 TLS 配置
├── docs/ API、架构和部署文档
├── docker-compose.yml
└── docker-compose.prod.yml
前置条件:Docker 24+ 与 Docker Compose v2。
cp .env.example .env
# 至少修改 ADMIN_PASSWORD、JWT_SECRET、API_KEY_PEPPER 和数据库密码
docker compose up -d --build
服务地址:
首次启动会自动创建数据库表、pgvector 索引与演示数据。演示用户为 demo@szrouter.local / demo123456。未配置 OPENAI_API_KEY 时使用内置 Mock 渠道,便于完整验证登录、API Key、余额计费和 SSE;配置真实 Key 后执行 docker compose restart gateway worker 并重新运行 docker compose exec gateway npm run db:seed。
查看状态与日志:
docker compose ps
docker compose logs -f gateway worker
curl http://localhost:8000/health
停止服务(保留数据):
docker compose down
本机需要 Node.js 20+、PostgreSQL 16 + pgvector、Redis 7。
cp .env.example .env
# 把 DATABASE_URL / REDIS_URL 的主机名改为 localhost
npm install
npm run prisma:generate
npm run db:push
npm run db:seed
npm run dev
质量检查:
npm test
npm run typecheck
npm run build
创建 API Key 后:
curl http://localhost:8000/v1/chat/completions \
-H "Authorization: Bearer sz_your_key" \
-H "Content-Type: application/json" \
-d '{
"model":"gpt-4o-mini",
"stream":true,
"messages":[{"role":"user","co
https://szrouter.shop/
Similar projects matched by category, topics, and programming language.

TanStack Router is a type-safe, data-driven React router with built-in caching, prefetching, and nested layouts, while TanStack Start extends it into a full-stack SSR framework.
scriptc compiles ordinary TypeScript into small, fast native executables without needing Node.js, V8, or any JavaScript runtime in the binary.
A React component library that renders six hand-tuned animated thought orb loading indicators on a plain 2D canvas, with two purpose-tuned sizes and automatic theme detection for AI and agent UIs.