In shortThe part I care about most is traffic accounting done like bookkeeping: an immutable ledger, idempotency keys, a shadow reconciliation phase and a fail-closed rollout. About 42% of backend commits were written by Codex, I set the tasks, review and own production.

BPN is a paid VPN subscription service. I run it with a partner, and almost all of the engineering is on my side: backend and billing, the Telegram bot, the Windows and Android clients, support tooling and production. The backend repo started on 2025-10-31, the latest merge to main is from 2026-12-02.

Traffic is accounted like money

Plans come with a monthly traffic quota. Customers can buy add-ons and carry unused traffic into the next period. The simple version is a counter that every event overwrites, and it breaks the first time a payment webhook arrives twice, a job retries after a timeout, or I fix something by hand in the admin panel at the same moment.

So traffic lives in a ledger. Base grants, rollover, add-ons, adjustments, expirations and reversals are separate immutable entries. The available balance is calculated from the ledger, and the proxy panel (PasarGuard) only gets a projection: an absolute limit derived from that balance. The panel is never the source of truth.

Every operation has its own idempotency key, stored under a unique constraint. The key builders sit in one module on purpose, so webhooks, background jobs and the admin panel can’t each invent their own incompatible retry keys. Payment provider state is kept apart from fulfillment state, and payment, period activation and the panel projection can all be retried safely.

Rollover is capped: no more than the smaller of the old and new monthly base quota carries over. Renewals get a two-hour continuity grace, measured from the provider’s payment confirmation.

Rolling it out without touching live balances

The first version, written between 2026-08-20 and 2026-09-13, was about 19.5k lines without tests. A mistake here shows up as customers losing gigabytes they paid for, so the feature shipped fail-closed, off by default. Existing subscriptions went through a shadow phase where the ledger was written and reconciled against the panel, and customers got the feature only once migration and projection invariants held. Rollout steps take PostgreSQL advisory locks so they don’t race each other.

It shipped with 32 test files and about 540 test cases. Production still found things. On 2026-09-08 I fixed grant expiry starving the expiry reminders, one bad panel response parking a whole page of subscriptions, and a stuck-items report that showed the wrong total. By 2026-09-13, when the first version was done, 64 of the 98 commits touching it were fixes.

Clients

The Windows client is Tauri with a privileged Rust service that runs the Mihomo proxy core in TUN mode. It has 163 Rust tests. In November I capped memory for the Mihomo child processes (GOMEMLIMIT=128MiB).

BPN Android client home screen: connection on, speed chart, subscription days and traffic left

The Android client, which also has a TV interface, is a fork of the open-source ClashFest, itself built on ClashMetaForAndroid. My part is 599 commits on top: a redesign, renewal checkout inside the app, the TV UI and a Mihomo core build with my own patches. The UI is covered by 2367 screenshot snapshots in light and dark themes and with large font.

Routing rules and the subscription template are public in badvpn-routing.

Support with a human behind it

Support runs through an AI agent in the bot and in site tickets. It looks at the customer’s actual subscription data, and when it can’t resolve something it hands the conversation to a human. Answer ratings are stored, so I can see where it goes wrong. During a known outage I run /incident in the bot, and for a set time, up to 24 hours, the agent names that outage as the cause instead of guessing. The flag can cover everything or one area.

One real case. On 2026-11-16 a customer on a yearly plan ran out of monthly traffic, and the bot refused the add-on with “An add-on requires an active audited consumer subscription”. The agent checked the data, saw that it didn’t add up and passed it to a human. It was a bug on our side: yearly plans without monthly periods couldn’t buy a traffic reset. The customer got the counter reset, the fix went to main the same day (#594) with a regression test that references this case, and a follow-up landed on 2026-11-19.

Shipping, and who wrote the code

Deploys go through GitHub Actions. A self-hosted runner builds the Docker image and ships it to the server over SSH. Out of 385 deploy runs, 325 succeeded, 40 failed and 20 were cancelled. When we lost the main server at the end of August 2026, the panel was back on a new host from backup in roughly 10 hours.

The backend is about 168k lines of TypeScript without tests, plus a Python bot of about 55k lines, 64 data models in Prisma, 460 TypeScript test files and 78 pytest files. Main has 1550 non-merge commits. 655 of them, about 42%, were written by Codex between May and October 2026. A few dozen more came from Jules, Cursor, Copilot and Claude. I write the tasks, review the diffs and own production. 402 of the 415 merged PRs came from my account.

Test counts on this page come from grepping the repo, I didn’t run the suites for it.