# One key for your whole app: the one-API stack for indie builders

> Run hosting, a Postgres database, sign-in, and payments through one API and one key. Manage your entire stack without account sprawl.

**You can run hosting, a Postgres database, user sign-in, and card payments through a single API and a single key.** thelastapi gives your project one secret—`VIBIZ_APP_KEY`—that connects your running app to serverless Postgres, Google and GitHub sign-in, card payments, transactional email, file storage, and analytics. You manage one account, keep one prepaid credit balance, and eliminate multi-vendor configuration.

This guide walks through how the single-API architecture works, how to use each core capability in code, and how to deploy your app without managing five separate developer accounts.

## Why indie builders lose days to account sprawl

Launching a simple software product usually requires stitching together half a dozen developer platforms:

- A cloud platform for your frontend and serverless compute
- A hosted database provider for Postgres
- An authentication service for social sign-in and session management
- A payment processor for checkouts, subscriptions, and merchant compliance
- An email delivery service for transactional notices
- An object storage bucket for user uploads and media assets

Every service demands its own account, dashboard, payment method, SDK, and set of API keys. When you add development and production environments, you suddenly manage twelve sets of credentials across multiple dashboards. If an environment variable changes or rotates, you must update it by hand across multiple settings pages.

Consolidating these services under one API solves the operational burden. Your application loads its required configuration at boot with a single key. Billing lives in one prepaid balance, and local development mirrors production without manual credential copying. If you want to review the full setup process in a single sitting, see our guide on how to [build a SaaS in a weekend: database, sign-in, payments, email, deploy](https://thelastapi.dev/blog/build-saas-weekend).

| Capability | Conventional setup | thelastapi stack |
| --- | --- | --- |
| **Credentials** | 6–10 secrets across 5 dashboards | One `VIBIZ_APP_KEY` per environment |
| **Billing** | Multiple subscriptions and monthly minimums | One prepaid credit balance with safety caps |
| **Local dev** | Manual `.env` copying or local Docker setup | `vibiz dev` creates an isolated schema branch |
| **Agent access** | Giving AI full cloud or production credentials | Limited keys that block production secrets and live money |
| **Merchant setup** | Complex merchant accounts and tax registration | thelastapi acts as the merchant of record |

## How the one-key architecture works

When you initialize a project using the CLI, thelastapi provisions the required infrastructure together under a unified project ID:

```bash
vibiz init "Acme SaaS"
```

By default, this command configures hosting, a Postgres database, authentication, and analytics. It writes a project configuration file (`vibiz.json`) and gives you access to the local development environment:

```bash
vibiz dev
```

Running `vibiz dev` provisions an isolated development database branch with your schema but zero production rows, a development sign-in instance configured for `http://localhost:3000`, and a dedicated development AI key. It writes these credentials into `.env.development.local`.

In your application code, you install the client library:

```bash
npm install @vibiz/app
```

The package requires only `VIBIZ_APP_KEY`. It has zero external dependencies and runs in Node 20+, Bun, Deno, and standard edge runtimes. At server startup, you call `vibiz.loadEnv()` to populate your runtime environment:

```ts
import { vibiz } from '@vibiz/app';

// Injects DATABASE_URL, VIBIZ_AUTH_*, and webhook secrets into process.env
await vibiz.loadEnv();
```

To learn more about client initialization and runtime options, visit the [@vibiz/app documentation](https://thelastapi.dev/docs/app-sdk).

## Core services on a single key

Every service in the project is reachable through the same SDK or over plain HTTP under `https://thelastapi.dev/v1/app` with `Authorization: Bearer $VIBIZ_APP_KEY`.

### 1. Database and sign-in

The database is plain Postgres accessible over standard connections using `DATABASE_URL`. User authentication supports email and password, magic links, Google, and GitHub:

```bash
# Enable Google sign-in
vibiz auth providers add google

# Enable GitHub sign-in
vibiz auth providers add github
```

For custom OAuth setups, you can supply your own Google client ID using `vibiz auth providers add google --own --client-id <id>`.

### 2. Card payments and subscriptions

thelastapi acts as the merchant of record, meaning you can accept one-time payments and recurring subscriptions without setting up your own commercial merchant account. You configure products in the CLI or API:

```bash
vibiz payments products add "Pro Plan" --amount 2900 --interval month --lookup-key pro-monthly
```

Your app creates hosted checkout sessions directly with `@vibiz/app`:

```ts
import { vibiz } from '@vibiz/app';

const { url } = await vibiz.payments.checkout({
  lookup_key: 'pro-monthly',
  user: session.userId,
  success_url: 'https://acme.example.com/dashboard?checkout=success',
  cancel_url: 'https://acme.example.com/pricing',
});

// Redirect the customer to url
```

To verify webhooks in your API route, call `await vibiz.webhooks.receive(req)`. The SDK checks the signature against the project signing secret automatically. For deeper cost comparisons of this approach, read about [the cheapest stack for a side project in 2026](https://thelastapi.dev/blog/cheapest-stack-side-project-2026).

### 3. File storage with permanent links

Every project includes a file drive with a 50 MB per-file limit. Storage is accessible through `vibiz.files.upload()`, which returns a permanent, non-guessable URL:

```ts
const file = await vibiz.files.upload(imageBuffer, {
  name: 'avatar.png',
  contentType: 'image/png',
});

console.log(file.url); // https://thelastapi.dev/f/.../avatar.png
```

Any media generated by integrated AI models lands in this project drive automatically. To learn more about uploading and managing media, see our guide to [file uploads for your app, with permanent links](https://thelastapi.dev/blog/file-uploads-permanent-links) or the [Files documentation](https://thelastapi.dev/docs/files).

### 4. AI gateway

The stack includes an OpenAI-compatible gateway at `/v1/ai`. You pass `vibiz.ai` directly to the standard OpenAI SDK:

```ts
import OpenAI from 'openai';
import { vibiz } from '@vibiz/app';

const openai = new OpenAI(vibiz.ai);

const res = await openai.chat.completions.create({
  model: 'vibiz/fast',
  messages: [{ role: 'user', content: 'Draft a three-line welcome email.' }],
});
```

The gateway routes requests to models from OpenAI, Anthropic, Google, DeepSeek, and other labs under one key and one billing balance.

## Bringing your own hosting or using individual services

You do not have to deploy your frontend on thelastapi. Every service can run independently while your application code lives on another hosting provider, an on-premise server, or a mobile client backend. Check the [Use one service documentation](https://thelastapi.dev/docs/use-one) for standalone configurations.

To use the services from an external host:

1. **Initialize only what you need:**
   ```bash
   vibiz init "External Store" --resources database,auth
   ```
2. **Register your external domain:**
   ```bash
   vibiz domains add app.example.com --elsewhere
   ```
3. **Inject the app key:**
   Add `VIBIZ_APP_KEY` into your external host's environment settings. In your server startup file, call `await vibiz.loadEnv()` or use the CLI runner:
   ```bash
   npx @vibiz/cli run -- node server.js
   ```

When deploying on thelastapi hosting, running `vibiz deploy` pushes your directory to production, automatically injects all variables, issues HTTPS certificates, and routes payment webhooks to `https://<slug>.vibiz.app/api/vibiz/webhook`.

## Safe keys for AI coding agents

If you use tools like Claude Code, Cursor, or Codex, giving them unrestricted production access is dangerous. thelastapi implements granular key permissions to solve this, detailed in [Keys and environments](https://thelastapi.dev/docs/keys).

- **Full-access keys (`vz_sk_...`)**: Reserved for owners and secure CI/CD pipelines. They can withdraw funds, view production secrets, and delete databases.
- **Limited keys (`vz_sk_...`)**: Designed for coding agents. They can initialize resources, write code, run builds, access the development database branch, and deploy previews. They get a `403 forbidden` if they attempt to view production variables or handle live money.

For a detailed breakdown of permissions when building autonomous tools, read [one API key for an AI agent: hosting, database, email, payments and models](https://thelastapi.dev/blog/one-api-key-for-ai-agent).

## Billing, safety limits, and data export

thelastapi accounts operate on a prepaid credit system. Accounts start with $2 in trial credit. Every billable event—database compute, email sends, AI queries, and domain registrations—deducts from your credit balance.

To protect against runaway loops from autonomous agents:
- Accounts include a default safety ceiling of $5 per day.
- Projects include a default daily AI budget of $1 per day.
- Owners can raise limits in the console or via CLI (`vibiz billing limit 50`).
- Auto-recharge can be enabled to top up your balance when it falls below a threshold:
  ```bash
  vibiz billing auto-recharge on --threshold 5 --amount 25
  ```
Review [Billing and credits](https://thelastapi.dev/docs/billing) for full details on recharge configurations and credit deduction.

### Zero vendor lock-in

If you decide to leave the platform, your code and data remain entirely portable. The export command packages your application into an archive containing your exact source code, an environment guide, and a complete PostgreSQL snapshot:

```bash
vibiz export --code --db --csv
```

The database backup unpacks as standard SQL:

```bash
gunzip -c shop-production-database.sql.gz | psql "$NEW_DATABASE_URL"
```

For more on migrating your schema and code, consult the [Export documentation](https://thelastapi.dev/docs/export) and the general overview in [What is thelastapi](https://thelastapi.dev/docs/introduction).

## Next step

Create your account at [thelastapi.dev/start](https://thelastapi.dev/start), or explore the [introductory documentation](https://thelastapi.dev/docs/introduction) to review available CLI workflows and schema patterns.

## Frequently asked questions

### Do I have to host my frontend on thelastapi to use the database and payments?

No. Every service works standalone on any server, container, or external host using the `VIBIZ_APP_KEY` secret and `await vibiz.loadEnv()`.

### What happens if an AI coding agent tries to access production payment data?

If the agent is using a Limited key, the request returns a 403 error with an `owner_only` reason code and provides a URL for the human account owner to approve the specific action.

### Can I use my own Google OAuth credentials for user sign-in?

Yes. You can enable default social sign-in or provide your own OAuth credentials by running `vibiz auth providers add google --own --client-id <id>`.

### How do database migrations work between local development and production?

Running `vibiz dev` creates a clean development database branch containing your production schema tables but zero production rows, ensuring test data never pollutes live systems.

---

Published 2026-11-15 · https://thelastapi.dev/blog/one-key-whole-app-stack
