Felix Faerber 6a54487ec1
Docker / build (pull_request) Successful in 31s
build on Gitea, push to the Gitea registry
This repo now lives on git.ffaerber.duckdns.org and its image is consumed by the
homelab swarm, so the build moves with it: .gitea/workflows/docker.yml builds on
the homelab runner and pushes to this Gitea's registry as an immutable short-SHA
tag plus :latest.

Build-only, on purpose. The GitHub workflow it replaces also SSHed into the
Hostinger VPS and ran `docker stack deploy` on every push to main, which
deploys the machine being retired and makes a deploy a side effect of a push.
The homelab pattern is a PR bumping the tag in ffaerber/homelab, so shipping is
a reviewed commit.

Plain `docker build` rather than buildx: the runner shares the host daemon
through a mounted socket, and buildx's gha cache backend does not exist outside
GitHub.

.github/workflows is removed from this copy so Gitea does not also try to run
it -- it would log in to ghcr with a Gitea token and SSH to a host whose secrets
are not here. The GitHub repository keeps its own copy untouched.
2026-09-15 12:30:07 +03:00
2026-05-20 15:08:45 +03:00
2026-05-20 15:08:45 +03:00
2026-05-20 15:08:45 +03:00
2026-05-20 15:08:45 +03:00
2026-05-20 15:08:45 +03:00
2026-05-20 15:08:45 +03:00
2026-05-20 15:08:45 +03:00
2026-05-20 15:08:45 +03:00
2026-05-20 15:08:45 +03:00
2026-05-20 15:08:45 +03:00
2026-05-20 15:08:45 +03:00
2026-05-20 15:08:45 +03:00

Hosted T4T Gateway

Multi-tenant frontend for the Token4Token inference network. Users sign up with Google / email, get 50 free virtual xBZZ, and call OpenAI-compatible endpoints without touching a wallet, Bee node, or Gnosis RPC.

Custody model: one operator wallet handles all on-chain transactions and Swarm operations. Tenants are off-chain ledger entries denominated in xBZZ. Providers see one on-chain client address (the operator's), not per-tenant addresses.

See docs in t4t/ for the wider design context.

Stack

  • Bun + Elysia (HTTP)
  • viem (Gnosis Chain bindings) — shared with t4t-container
  • bee-js (Swarm) — shared with t4t-container
  • Prisma + Postgres (multi-tenant ledger)
  • BullMQ + Redis (queues + distributed locks + operator-wallet nonce)

The gateway engine code (provider selection, chain I/O, PSS routing, ECIES envelope) is vendored from t4t/container/src/ into src/t4t/. See src/t4t/VENDORED.md for the drift policy.

Quick start

cp .env.example .env
# fill in OPERATOR_PRIVATE_KEY, REGISTRY/ESCROW/XBZZ addresses, JWT_SECRET_KEY

docker compose up -d postgres redis bee
bun install
bunx prisma migrate deploy
bun run dev:api
# in another shell:
bun run dev:worker

Layout

src/
  api.ts               # Elysia HTTP entry
  worker.ts            # BullMQ workers + claim watcher
  db.ts                # model.<entity> CUD wrappers (write + enqueue)
  env.ts               # zod-validated process.env
  auth/                # JWT, Google OAuth, email signup
  users/, accounts/, apiKeys/, pricing/, gateway/, chain/
  queue/               # connection, registry, lock, processor base, service
  t4t/                 # VENDORED from t4t-container
prisma/schema.prisma
test/                  # E2E specs
S
Description
No description provided
Readme
161 KiB
0 Stars 1 Watchers 0 Forks
Languages
TypeScript 99.7%
Dockerfile 0.3%