AI platform
Asterio

What it is
Asterio gives access to modern neural networks from Russia without a VPN, in one product: a chat, image and video generation, and tool-calling AI agents, paid for with an internal currency. It is built as three channels — a web app, a Telegram bot and a Telegram mini-app — over one core, so a balance topped up on the site is instantly available in the bot and the history is unified. I'm one of two developers and lead the site, the backend and the server side.
Proof
$ curl -sI https://asterio-ai.com | head -1
HTTP/2 200
# bundle 977 KB → 276 KB after code splitting
Architecture & what I own
01Three channels, one core
The web app (a landing plus a terminal workspace), the Telegram bot and the mini-app all work against one database and one set of business rules — balance, pricing and history. Duplicating billing per channel would have been costlier and more dangerous than folding it into a single point.
02Three isolated contours
Production is split across three machines — a database contour, an application contour and a bots contour — plus a bastion for admin and builds. Neither the database nor the bots expose a public port; only the application contour faces the internet and carries all the defensive layers.
03BFF that hides the core
The browser talks only to a Node BFF on /api/ — it checks the token, normalizes formats, adds service headers, then calls the main API. The API address and the provider keys are never handed to the browser.
04Money truth lives on the server
The client never says how many stars to credit — amounts and bonuses are computed on the server by product id, and stars are credited only after the payment provider confirms. Balance is a sum of batches, so paid and bonus stars stay distinct through refunds.
05Backend on FastAPI
The site and the REST API run on FastAPI under Uvicorn in four workers for parallel requests, deployed from Git with a reproducible Docker build. Auto-generated Swagger / OpenAPI docs for every endpoint.
06Data & caching
PostgreSQL 16 accessed through PgBouncer connection pooling, plus a Redis cache with a fallback to in-memory if Redis is down — all in Docker Compose.
07Auth & server security
JWT for users and service-to-service authorization through an internal secret between the site and the Telegram bots. Network locked down with UFW — each port open only to specific IPs — and root SSH disabled.
08Delivery perimeter
Nginx as a reverse proxy in front of Uvicorn with SSL/TLS from Let's Encrypt and an HTTP→HTTPS redirect. Deploy scripts update the service from Git with no downtime — pull, rebuild, graceful restart — plus rollback and a post-release health check.
09Multi-provider LLM & payments
The platform integrates several LLM providers (OpenRouter, Together AI, Google AI) behind one interface, serves the front-end and the Telegram bots through the internal API, and takes card payments via YooKassa under a proper offer and privacy policy.
10Anti-bot & load speed
The generation endpoints are gated so real users get through and automated abuse does not; on the front, code splitting squeezed the bundle from 977 KB to 276 KB in Brotli — 3.5×.
Stack: Python, FastAPI, Uvicorn, Nginx, Let's Encrypt, PostgreSQL 16, PgBouncer, Redis, Docker & Compose, UFW, Git, Bash on Ubuntu.