Skip to main content

Monetizing TeaQL in Public — Day 0: Our Own SaaS Backend

· 6 min read
Philip Z
Architect

TeaQL needs an account system of its own. Developers need to manage API keys, review models, and understand their usage. Someone also needs to manage the subscription and explain what changed when a payment arrives.

We are going to build that system with TeaQL, and document the work here. We also want other SaaS builders to take useful pieces into their own products: team models, permission rules, billing workflows, and eventually runnable examples. Each entry should leave you with something you can reuse, even if your backend uses a different framework.

This is Day 0: the starting design and the first scenario we intend to implement. There is no working console demo yet. Future entries will include running examples, the changes that made them work, and the problems we found. The day numbers identify entries in this series; they are not a promise of a daily release.

Start with the limits of a shared API key​

Today, free access uses a shared public API key. It lets a developer try model processing without first setting up an account. It does not give us a reliable identity for a personal usage history or a private console.

We want to keep that low-friction entry point while adding an authenticated path. Our plan is GitHub sign-in, a TeaQL account, and personal API keys associated with a team. A free user should be able to see their own requests and allowances. Paying should change their team's entitlements without requiring them to replace a key in every project.

Two consoles, one account​

We have two different kinds of work to support:

ConsoleWhat someone comes to do
Developer consoleManage API keys, inspect assessment and generation requests, review model versions and field changes, and track processing and storage usage.
Account and billing consoleChoose a plan, manage renewal, view transactions, request a refund, and understand subscription changes.

A developer investigating a failed generation should not have to navigate invoice settings. A person managing payments should not need access to model contents. Both consoles will use the same identity and team context.

Make the team the ownership boundary​

Even a solo developer starts with a team containing one person. Subscriptions, allowances, storage, and saved content belong to that team. A membership connects a user to a team; an API key also records its team and creator.

The initial role design has four responsibilities:

  • Owner: accountable for the team, including ownership transfer and deletion.
  • Admin: manages membership and developer settings.
  • Developer: works with models, API keys, assessments, and generation.
  • Finance: manages subscriptions and billing without automatically seeing models.

We are considering combined roles, so one person can be both Admin and Finance. The role names are only the beginning: we still need to implement and test which actions each role permits. Administrative authority should not silently grant access to every saved model.

The first useful test is easy to describe: a Finance member opens the billing console successfully, then attempts to read a model and is denied. A second team must not be able to read either resource. Those are the behaviors we want to show in the next implementation entry.

A payment needs an explanation in the product​

We have Paddle Sandbox and live accounts. Integration work will start in Sandbox. The launch plan has Free, Plus, Pro, and Max tiers, with monthly and annual prices for the paid tiers. Exact processing and storage allowances still need cost estimates.

Paddle will handle the purchase transaction. Our application still needs to map payment and subscription events to team entitlements and keep a useful history.

For example, when a team changes from Free to Plus, we want to answer:

  • What was the previous value, and what is the new value?
  • Was the change requested by a member or caused by a payment event?
  • Which transaction or request explains it?
  • Has the same event already been processed?

This is a billing-state history. Model field changes are a separate developer review feature; neither history requires publishing a customer's model contents.

Annual payment also does not mean annual usage release. Our agreed product rule is to release allowances each service month, including for annual subscribers. That rule belongs in the application alongside usage consumption, failed-request reversals, and reset dates.

Where TeaQL fits​

We plan to model teams, memberships, subscriptions, entitlements, usage entries, and change records in TeaQL, then generate the domain library and implement the application around it. GitHub supplies sign-in, Paddle supplies billing integration, and OCI hosts the services. The console frontend is still to be selected.

The interesting question is how this holds up as requirements change. If Finance needs another permission, what changes in the model and application? If a payment notification arrives twice, can we demonstrate that allowances were granted once? We will show the resulting code and observed behavior before making claims about speed or how much implementation TeaQL saves.

What you can take away from Day 0​

Start with an explicit permission matrix. This is our proposed starting point, not an implemented authorization policy:

ActionOwnerAdminDeveloperFinance
Transfer ownership or delete the teamYesNoNoNo
Manage members other than the ownerYesYesNoNo
Manage developer settingsYesYesNoNo
Manage personal API keysYesYesYesNo
Manage subscriptions and paymentsYesNoNoYes
Read a saved modelRequires content permissionRequires content permissionRequires content permissionNo by default

Copy it and change the actions to match your product. Check three things before turning it into code: every resource has an owning team, billing authority does not imply content access, and cross-team access is denied regardless of role. For combined roles, decide explicitly how permissions compose; adding Finance must not accidentally remove an existing Developer's authorized content access.

That is today's reusable artifact. As the implementation progresses, we intend to share the corresponding TeaQL models, application examples, and tests, with setup instructions and explicit license terms. Runnable starter code is not yet available, and the repository and license for those examples remain to be selected.

The explanations should separate the reusable business rule from the TeaQL code that implements it. For example, processing a repeated payment event once is a requirement other builders can adopt; our generated APIs are one implementation we will need to demonstrate.

What comes next​

The first implementation milestone is a small team-permission scenario: create a team, add members, and exercise allowed and denied operations across both roles and teams. After that, we will connect a Sandbox purchase to an entitlement change and test duplicate event handling.

Each implementation entry will link its example, explain how to run it, and state what was actually verified. If something is blocked, we will say so. Any public demos will use synthetic accounts and models, with no customer content or credentials.

You can follow the series under TeaQL SaaS. If you have built team billing before, I would like to hear which permission or subscription edge case you wish you had handled on day one.