MCPcopy Index your code
hub / github.com/deviseo/transit-hub

github.com/deviseo/transit-hub @v0.1.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.1.2 ↗ · + Follow
1,201 symbols 3,113 edges 114 files 392 documented · 33%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

TransitHub

Go Vue PostgreSQL Redis Docker

A multi-upstream operations hub for self-hosted API services built with sub2api or new-api.

English | 中文

Important Notice

Please read the following carefully before using this project:

  • Provider policy risk: TransitHub helps administrators connect to and operate upstream admin platforms. Make sure your use complies with the terms of service of every upstream platform you connect.
  • Compliant use only: Use this project only in compliance with the laws and regulations of your country or region. Do not use it to bypass authorization, abuse upstream services, or operate accounts you do not control.
  • Self-hosting responsibility: You are responsible for protecting admin credentials, database backups, network access, and deployment secrets in your own environment.
  • Disclaimer: This project is for technical learning only. You are responsible for complying with applicable laws and upstream platform policies. The authors assume no liability for service interruptions, account restrictions, data loss, or any direct or indirect damages caused by using this project.

Sponsors

Name Description
RecycleAI logo RecycleAI An innovation platform for AI resource reuse and intelligent service circulation, improving coordination across compute, model, and application capabilities.
XiongXiongAI logo XiongXiongAI An AI service brand centered on approachable experiences, stable access, and lightweight intelligent tools for reliable everyday usage.
qqqRouter logo qqqRouter An AI infrastructure platform for multi-model access, request routing, and usage governance, helping teams build more flexible and controllable model invocation workflows.
SparkCode logo SparkCode A stable and efficient API relay provider for mainstream AI coding models including Claude Code, Codex, and Gemini with NanoBanana-series models; supports monthly plans, usage-based billing, high-concurrency calls, invoiced top-ups, dedicated enterprise onboarding, technical support, and a long-term invitation rebate program.
UU API logo UU API An AI compute gateway for global developers and enterprises, offering one-stop access to ChatGPT, Claude, Gemini, and other major models through transparent official or first-hand channels, with reliable infrastructure built to make every call worthwhile.
ElucidRelay logo ElucidRelay An API relay providing stable, high-throughput access to major overseas models including OpenAI, Claude, Gemini, and more through a single OpenAI-compatible endpoint; built for resellers and downstream platforms that need reliable volume and competitive pricing.
songsongAi logo songsongAi An AI service brand for polished intelligent application experiences, focused on premium model access, reliable delivery, and streamlined workflows for creators and teams.
Yimo-US logo Yimo-US An API service brand focused on stable access and multi-upstream aggregation, designed for high-availability access, resource integration, and consistent service experiences.

Overview

TransitHub is a self-hosted admin and operations hub for managing multiple upstream sites and admin workspaces. It focuses on practical operator workflows: connecting upstream platforms, tracking balances and group multipliers, monitoring dashboard metrics, configuring notifications, and running scheduled group-rate campaigns that can automatically restore original multipliers after an activity ends.

The project is built as a Go backend with a Vue 3 admin frontend, backed by PostgreSQL and Redis.

Features

  • Admin workspace management - Switch between admin accounts/workspaces and isolate workspace-scoped data.
  • Upstream site management - Add, sync, inspect, and manage upstream sites with cached metrics.
  • Dashboard metrics - View live and historical operation data, including balances, costs, trends, group usage, and upstream drilldowns.
  • Group multiplier tracking - Track group multiplier snapshots, changes, history, platform tags, and custom group types.
  • Group-rate campaigns - Create immediate or scheduled pricing activities, update selected admin groups, retain activity records, and restore original multipliers at the configured end time.
  • Auto pricing support - Configure mapped group auto-pricing rules based on upstream multiplier changes.
  • Notification channels - Configure DingTalk, Feishu, and Telegram bots for balance warnings, multiplier changes, auto-pricing, and campaign notifications.
  • System settings - Manage refresh intervals, notification strategy, and runtime display settings.

Tech Stack

Component Technology
Backend Go 1.25, net/http, pgx
Frontend Vue 3.5, Vite, TypeScript, TailwindCSS, vue-i18n
Database PostgreSQL 16+
Cache / Session Redis 7+
Deployment Docker, Docker Compose

Deployment

Docker Compose

Production compose files live under deploy/.

git clone https://github.com/deviseo/transit-hub.git transit-hub
cd transit-hub

# Edit deploy/docker-compose.prod.yml first:
# - image tag (defaults to deviseo/transithub:latest)
# - database password
# - ADMIN_EMAIL / ADMIN_PASSWORD
# - APP_VERSION if you want a custom version label

docker compose -f deploy/docker-compose.prod.yml up -d

Open:

http://YOUR_SERVER_IP:10621

The production compose file includes:

  • app: TransitHub application container.
  • postgres: PostgreSQL database.
  • redis: Redis for admin sessions, cache, and scheduled tasks.

Persistent data is stored under the repository root data/ directory by default:

data/postgres
data/redis

Development Services

For local development dependencies only:

docker compose -f deploy/docker-compose.yml up -d

This starts PostgreSQL and Redis on local ports 5432 and 6379.

Build Docker Image

Because the Dockerfile is stored in deploy/ but expects the repository root as build context, build with:

docker build -f deploy/Dockerfile -t deviseo/transithub:latest .

Local Development

Backend

cd backend
go test ./...
go run ./cmd/api

Important environment variables:

PORT=10621
DATABASE_URL=postgres://postgres:postgres@localhost:5432/transithub?sslmode=disable
REDIS_URL=redis://127.0.0.1:6379/0
ADMIN_EMAIL=admin@example.com
ADMIN_PASSWORD=transithub
ALLOW_PUBLIC_REGISTER=true
APP_VERSION=dev

Frontend

cd frontend
npm install
npm run dev

Build check:

npm run build

Verification

Recommended checks before submitting changes:

cd backend
go test ./...
go vet ./...
go build ./...

cd ../frontend
npm run build

cd ..
docker compose -f deploy/docker-compose.yml config
docker compose -f deploy/docker-compose.prod.yml config

Project Structure

transit-hub/
├── backend/                  # Go backend service
│   ├── cmd/api/              # API entrypoint
│   ├── internal/config/      # Runtime configuration
│   ├── internal/database/    # PostgreSQL, Redis, migrations
│   ├── internal/httpserver/  # HTTP server assembly and middleware
│   └── internal/modules/     # Domain modules
│       ├── admin_accounts/
│       ├── auth/
│       ├── dashboard/
│       ├── group_rate_campaigns/
│       ├── group_rates/
│       ├── my_sites/
│       ├── settings/
│       ├── system/
│       └── upstream/
├── frontend/                 # Vue 3 admin frontend
│   └── src/modules/          # Feature modules
├── deploy/                   # Dockerfile and compose files
├── development-docs/         # Development notes and implementation plans
└── data/                     # Local production data directory, ignored by Git

Project Notes

  • APP_VERSION is only used for display.
  • AGENTS.md, CLAUDE.md, .sisyphus/, local .env files, build output, and runtime data are intentionally ignored by Git.

Star History

<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=deviseo/transit-hub&type=Date" />

License

This project is licensed under the GNU Lesser General Public License v3.0 (LGPL-3.0-only). See LICENSE for details.


If TransitHub helps your workflow, consider giving it a star.

Extension points exported contracts — how you extend this code

HandlerAccountResolver (Interface)
HandlerAccountResolver 由 handler 用来在请求路径上解析当前工作区。 [3 implementers]
backend/internal/modules/upstream/handler.go
LoginRequest (Interface)
(no doc)
frontend/src/modules/auth/types/auth.ts
StateRepository (Interface)
StateRepository 分组映射状态的持久化接口,由 Repository 实现。 [3 implementers]
backend/internal/modules/my_sites/service.go
EmailCodeRequest (Interface)
(no doc)
frontend/src/modules/auth/types/auth.ts
SiteCache (Interface)
SiteCache 抽象上游站点的运行时缓存层,由 Redis 实现。 站点的持久化仍由 PostgreSQL(SiteRepository)负责,SiteCache 仅保存运行时状态。 [2 implementers]
backend/internal/modules/upstream/site_cache.go
EmailCodeResponse (Interface)
(no doc)
frontend/src/modules/auth/types/auth.ts
AdminGroupOperator (Interface)
AdminGroupOperator 是活动调价对 admin 自有分组的全部远端依赖,由 my_sites.Service 实现。 定义为窄接口而不是直接依赖 my_sites 包,避免跨模块的实现耦合。 [2 implementers]
backend/internal/modules/group_rate_campaigns/service.go
RegisterRequest (Interface)
(no doc)
frontend/src/modules/auth/types/auth.ts

Core symbols most depended-on inside this repo

newRequestError
called by 70
backend/internal/modules/upstream/errors.go
requestJSON
called by 55
backend/internal/modules/upstream/http_client.go
Set
called by 39
backend/internal/modules/upstream/site_cache.go
firstNumber
called by 36
backend/internal/modules/upstream/normalizers.go
Close
called by 34
backend/internal/modules/group_rates/repository.go
firstString
called by 33
backend/internal/modules/upstream/normalizers.go
Scan
called by 31
backend/internal/modules/group_rates/repository.go
validateCreateRequest
called by 29
backend/internal/modules/group_rate_campaigns/calc.go

Shape

Method 480
Function 443
Struct 167
Interface 97
TypeAlias 13
FuncType 1

Languages

Go82%
TypeScript18%

Modules by API surface

backend/internal/modules/upstream/platform_service.go79 symbols
backend/internal/modules/my_sites/service.go69 symbols
backend/internal/modules/group_rate_campaigns/service.go63 symbols
backend/internal/modules/group_rate_campaigns/service_test.go49 symbols
backend/internal/modules/upstream/service.go44 symbols
backend/internal/modules/dashboard/service.go44 symbols
backend/internal/modules/dashboard/metrics_service_group_usage_test.go34 symbols
backend/internal/modules/settings/service.go28 symbols
frontend/src/modules/admin/api/dashboardAdmin.ts27 symbols
backend/internal/modules/auth/service.go27 symbols
backend/internal/modules/upstream/types.go26 symbols
backend/internal/modules/upstream/normalizers.go25 symbols

Datastores touched

transithubDatabase · 1 repos

For agents

$ claude mcp add transit-hub \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact