Covers both forms: OAuth apps on your own domain and iframe apps embedded in civitai.com
civitai-app-starters — Next.js Starter Template
By civitai
Official Civitai starter templates and a shared SDK for building third-party Civitai apps: both OAuth apps on your own domain and iframe apps embedded in civitai.com pages.
Explore the design
Compare the page layouts and mobile experience. Open any screenshot for a closer look.
Actual screenshot captured by the server browser.
All pages & views 2
Screenshots show visual appearance; interactive behavior may differ.
What stands out
A quick read of the recorded project description.
Provides four OAuth starter templates—Next.js, SvelteKit, React PWA, and Svelte PWA—with a consistent demo UI
@civitai/app-sdk wraps OAuth + PKCE, encrypted cookie sessions, scope helpers, and orchestrator calls
@civitai/app-sdk/blocks defines a framework-agnostic manifest and postMessage protocol; @civitai/blocks-react provides React hooks and iframe transport
starters/examples contains six runnable examples divided by function, each able to run offline through a dev harness that simulates the host
Includes PORTING.md and AGENTS.md, explaining how to integrate the SDK into an existing app and the conventions AI coding agents should follow
Template Details
This repository targets two kinds of third-party Civitai apps. The first is OAuth apps: deployed on the developer's own domain, signed in through Civitai, and calling the orchestrator. The repository provides four starter templates—Next.js, SvelteKit, React PWA, and Svelte PWA—plus @civitai/app-sdk, which handles OAuth + PKCE, encrypted cookie sessions, scope helpers, and wrappers for orchestrator calls. The second is Civitai Apps: rendered as iframes inside civitai.com pages (for example, a generator in a model sidebar). The /blocks subpath of @civitai/app-sdk provides a framework-agnostic manifest and postMessage protocol, while @civitai/blocks-react provides React hooks and an iframe transport layer, accompanied by six minimal examples that run offline.
The four OAuth templates share the same minimal demo: Civitai OAuth sign-in, reading and displaying the Buzz balance (via fetchBuzzAccount(), hidden when BuzzRead is not granted), previewing the cost of one generation with whatif, and submitting one image generation and showing the result. The PWA templates perform token exchange through a lightweight Hono BFF, so the client type remains Confidential.
Scaffolding and submission for Civitai Apps are handled by the Go-based civitai CLI (login / app init / validate / submit), while local development uses the project's dev:harness or dev:live. After submission, the platform injects the build recipe and hosts dist/ once review passes; developers do not need to provide a Dockerfile or nginx.conf, nor set iframe.src themselves. The repository also includes PORTING.md (steps for integrating the SDK into an existing app) and AGENTS.md (conventions for AI coding agents).
Is it right for your project?
Use Cases
- Build a web app on your own domain that uses Civitai sign-in and can call the orchestrator to generate images
- Develop a third-party Civitai site that needs to be indexed by search engines (choose next-app or sveltekit-app)
- Develop tools, mini-games, or interface-focused SPAs/PWAs that do not need SEO (choose react-pwa or svelte-pwa)
- Build an iframe app rendered inside a civitai.com page, such as a generator in a model sidebar
- Add Sign-in-with-Civitai to an existing app, or replace the image generation backend with the Civitai orchestrator
Suitable For
- Third-party app developers who need Civitai account sign-in and want to call its orchestrator
- Developers who want to embed a small interactive interface inside a civitai.com page
- Teams using Next.js, SvelteKit, React, or Svelte
- Developers who need minimal runnable examples to understand interfaces such as Buzz billing, scopes, and storage
Getting started & customization
Use these recorded setup notes alongside the repository instructions for your chosen version.
- 1
It is recommended to use npx tiged civitai/civitai-app-starters/starters/<template-name> to pull only the needed template rather than cloning the entire monorepo
- 2
Create an app under OAuth Apps at civitai.com/user/account, choose Confidential as the client type, and put CIVITAI_CLIENT_ID and CIVITAI_CLIENT_SECRET into .env
- 3
The default callback URL is http://localhost:3000/api/auth/callback/civitai; it may differ per template, so check the corresponding README
- 4
The repository requires Node ≥ 20 and uses pnpm; the monorepo itself supports pnpm build, pnpm test, and pnpm typecheck
- 5
Scaffolding and submission for Civitai Apps depend on the Go-based civitai CLI; local development uses the project's dev:harness or dev:live
License & source material
Usage conditions & limitations
Free to use · keep license noticeThis entry covers the free MIT version in the public repository; the free scope applies to that version's code and does not mean external services or third-party assets are free.
Must comply with when using
- When using, modifying, or distributing the code, retain the original author's copyright notice and the full MIT license.
- Free use, modification, and commercial use are allowed, as is distribution of the code; distribution must still include the copyright and license notice.
- The code is provided as is, and the authors do not promise warranties or accept liability for use.
Additional costs & items to verify
- Scaffolding, validation, and submission for Civitai Apps depend on the external Go-based civitai CLI (github.com/civitai/cli), which is not bundled with this repository; using that form requires installing the external tool separately.
- Before running the OAuth templates, you must register an OAuth app on civitai.com and obtain CIVITAI_CLIENT_ID and CIVITAI_CLIENT_SECRET to fill into .env; otherwise sign-in and orchestrator calls will not work.
- A Civitai account and OAuth client credentials (client id/secret) are required to run the templates; these credentials are issued by the Civitai platform and are an external service dependency.
- After submission, Civitai Apps must pass manual platform review before they are built and deployed; if rejected, they cannot go live, so the publishing process is subject to platform review.
- Building and hosting for Civitai Apps are handled by the Civitai platform, with final deployment under the https://<blockId>.civit.ai/ domain; developers cannot choose the hosting method or domain themselves.
- The runtime image and iframe.src are controlled by the platform; developers cannot bring their own Dockerfile/nginx.conf or set iframe.src themselves, so deployment configuration freedom is limited.
- During local development, the dev harness fixes the parent page origin, so you must serve from a matching origin; otherwise BLOCK_INIT is rejected and the app remains stuck in a loading state.
- When using Buzz billing, the estimate and submission must use exactly the same parameters (especially seed); otherwise the quoted Buzz cost will not match the actual charge.
- The Buzz balance can only be read through fetchBuzzAccount(), and the BuzzRead scope must be granted; when not authorized, the balance UI is completely hidden.
- Iframe apps must set data-theme on the root element themselves; the host cannot inject it, otherwise all [data-theme="dark"] styles will not take effect.
- The current PWA templates still require a Confidential client and a BFF holding the secret; a pure browser public-client flow is not yet provided and is only listed on the roadmap.
- Demo images, fonts, icons, and other third-party assets must be checked against their respective licenses; the code's MIT license alone is not sufficient to judge them.
- External services such as domains, hosting, databases, payments, or AI may incur additional charges.
View Original Text Basis
Permission is hereby granted, free of charge
Original License Text
Go **`civitai` CLI** ([github.com/civitai/cli](https://github.com/civitai/cli)): `civitai login` → `civitai app init` / `civitai app validate` / `civitai app submit`.
Original README
Go to [civitai.com/user/account](https://civitai.com/user/account) → **OAuth Apps** → **Create**.
Original README
Copy `CIVITAI_CLIENT_ID` and `CIVITAI_CLIENT_SECRET` into `.env`.
Original README
**Review** — a moderator reviews the manifest + file diff at **`/apps/review`** and approves (or rejects with a reason you see on `/apps/build`).
Original README
**Deploy** — on approve, the platform builds + serves your `dist/` and stamps the block's `iframe.src` server-side, serving it at **`https://<blockId>.civit.ai/`** (root-served).
Original README
**The platform owns the runtime image + `iframe.src`** — you don't ship a `Dockerfile`/`nginx.conf` or set `iframe.src`; the platform injects the build and stamps the src
Original README
**The dev harness pins the parent origin** — serve on the matching origin or `BLOCK_INIT` is rejected and the block hangs on "Loading…".
Original README
**Your estimate must build params identically to submit** (esp. the seed) or the quoted Buzz cost won't match the charge.
Original README
show your Buzz balance (read with `fetchBuzzAccount()` — **not** from `/api/v1/me`, which returns none; hidden entirely when `BuzzRead` was not granted)
Original README
**Set `data-theme` on your own root** — the host can't inject it into your iframe, so any `[data-theme="dark"]` CSS is dormant until you do.
Original README
https://github.com/civitai/civitai-app-starters/blob/main/LICENSEhttps://github.com/civitai/civitai-app-starters/blob/main/README.md(Public-client browser-only flow is on the roadmap for a future `*-static` variant.)
Original README
Based on the full MIT license and the repository README · 2026-09-29. Results only cover the materials read; dependencies, images, fonts, and subsequent term changes are subject to their respective original texts.
Project checks & description sources
Template Information
- Source platforms
- GitHub
- Documentation and maintenance reference score
- More documented · 88 / 100
- Technologies
- Next.js · Svelte · React
- Website type
- Starter
How this score is calculated
Our heuristic uses license records (up to 30), a demo link (12), a preview (10), stars (15), recorded maintenance (15), description completeness (8), feature records (5) and classification data (5). It is not a code, security or performance test, or a Google score. A link does not establish tested functionality.
What to verify for this project
- Repository update recorded
- 2026-09-28
- Screenshot last checked
- 2026-09-29
A demo link is listed. Check it with your own content and viewport sizes; its presence does not confirm that forms, authentication or payments work.
The catalog identifies Next.js as the primary stack. Check the actual dependency manifest and lockfile for versions and hosting requirements. These notes use recorded metadata, not a code audit or a deployment test.
Use a selection guide →How this description was prepared
AI-assisted description based on catalog records and repository material. Repository authors are not automatically the reviewers of this description.
Automatically checked against source and license rules; no manual editorial review.
Inspect the recorded source material
SHA-256: 75e66c0067d12ea66c124492b2ad7a007e3566901d57fd5fe8ce7803f22aea4a
2026-09-29T01:06:21.065Z
Source file / repository# Civitai App Starters
[](https://github.com/civitai/civitai-app-starters/actions/workflows/ci.yml)
[](./LICENSE)
[](https://nodejs.org)
[](https://pnpm.io)
[](https://www.npmjs.com/package/@civitai/app-sdk)
Starter templates for building on [Civitai](https://civitai.com), plus the shared SDK packages they use. Two product surfaces live here:
1. **OAuth apps** — full apps on your own domain that sign in with Civitai and
call the orchestrator. The four `starters/*` templates + `@civitai/app-sdk`.
2. **Civitai Apps** — iframe-embedded UIs that render *inside* civitai.com pages
(e.g. a generator in a model's sidebar). The `@civitai/app-sdk/blocks`
contract + `@civitai/blocks-react` hooks + the runnable
[`starters/examples/*`](./starters/examples). **See [Civitai Apps](#civitai-apps)
below.**
## What's in here
- **`packages/civitai-app-sdk`** — OAuth + PKCE, encrypted-cookie sessions, scope helpers, orchestrator-call helpers, AND the framework-agnostic **Civitai Apps** contract (`/blocks` subpath). Published to npm as `@civitai/app-sdk`.
- **`packages/civitai-blocks-react`** — React hooks + iframe transport for Civitai Apps. Published as `@civitai/blocks-react`.
- **Scaffolding + submit for Civitai Apps** — handled by the Go **`civitai` CLI** ([github.com/civitai/cli](https://github.com/civitai/cli)): `civitai login` → `civitai app init` / `civitai app validate` / `civitai app submit`. (Local dev is the scaffolded project's own `npm run dev:harness` / `npm run dev:live`.) The old `@civitai/blocks-cli` npm scaffolder it replaced stays published-but-deprecated on npm but is no longer part of this repo.
- **`starters/next-app`** — Next.js 15 (App Router) + Tailwind. SSR-friendly, SEO-capable. Best OAuth-app default.
- **`starters/sveltekit-app`** — SvelteKit 2 + Tailwind. Same demo surface as `next-app`.
- **`starters/react-pwa`** — Vite + React 19 + tiny Hono BFF for OAuth token exchange. SPA/PWA shape.
- **`starters/svelte-pwa`** — Vite + bare Svelte 5 (no Kit) + tiny Hono BFF. SPA/PWA shape.
- **`starters/civitai-block-starter`** — Vite + React 19 Civitai App scaffold.
- **`starters/examples/*`** — six minimal, runnable Civitai App examples, one per feature (see [Civitai Apps](#civitai-apps)).
The four OAuth starters ship the **same minimal demo:** log in via Civitai OAuth → show your Buzz balance (read with `fetchBuzzAccount()` — **not** from `/api/v1/me`, which returns none; hidden entirely when `BuzzRead` was not granted) → preview cost of a generation (`whatif`) → submit one image generation → display the result.
## Pick a starter
| Need | Use |
|---|---|
| Discoverable via search engines | `next-app` (default) or `sveltekit-app` |
| Tool, mini-game, focused UI, no SEO | `react-pwa` or `svelte-pwa` |
| Don't know / mainstream stack | `next-app` |
## Clone just one starter (recommended)
You almost never want to clone the whole monorepo. Pull just the starter you need:
```bash
npx tiged civitai/civitai-app-starters/starters/next-app my-app
cd my-app
cp .env.example .env
pnpm install
pnpm dev
```
Then:
1. Go to [civitai.com/user/account](https://civitai.com/user/account) → **OAuth Apps** → **Create**.
2. For SSR starters (`next-app`, `sveltekit-app`): client type **Confidential**.
3. For PWA starters (`react-pwa`, `svelte-pwa`): client type **Confidential** still — the BFF holds the secret. (Public-client browser-only flow is on the roadmap for a future `*-static` variant.)
4. Redirect URI: `http://localhost:3000/api/auth/callback/civitai` (varies per starter — see each starter's README).
5. Copy `CIVITAI_CLIENT_ID` and `CIVITAI_CLIENT_SECRET` into `.env`.
6. `pnpm dev`.
## Alternative ways to clone
```bash
# Next.js CLI native
npx create-next-app --example "https://github.com/civitai/civitai-app-starters/tree/main/starters/next-app" my-app
# Full repo + sparse-checkout (if you want git history)
git clone --filter=blob:none --sparse https://github.com/civitai/civitai-app-starters
cd civitai-app-starters && git sparse-checkout set --cone starters/next-app
```
## Civitai Apps
A **Civitai App** is a small iframe-embedded UI that renders inside a civitai.com
page — for example, a generator in a model's sidebar (`model.sidebar_top` slot).
Unlike an OAuth app, a block runs *inside* civitai.com and gets a short-lived,
block-scoped JWT + page context handed to it via `postMessage`. It's much smaller
than a full app: a single static SPA, no OAuth dance, no BFF.
### Packages
| Package | What |
|---|---|
| [`@civitai/app-sdk`](https://www.npmjs.com/package/@civitai/app-sdk) (`/blocks` subpath) — [source](./packages/civitai-app-sdk) | Framework-agnostic contract: manifest types, scopes, the `postMessage` protocol. Build-time manifest validation (`defineBlock`, `blockManifestPlugin`) lives on the node-only `/manifest` and `/vite` subpaths. |
| [`@civitai/blocks-react`](https://www.npmjs.com/package/@civitai/blocks-react) — [source](./packages/civitai-blocks-react) | React hooks (`useBlockContext`, `useBuzzWorkflow`, `useAppStorage`, …) + iframe transport. Plus `/ui` (the `SettingsForm`). |
| Go [`civitai` CLI](https://github.com/civitai/cli) | `civitai login` / `civitai app init` / `civitai app validate` / `civitai app submit` — scaffold and ship a block. (Local dev is the project's own `npm run dev:harness`.) Replaces the deprecated `@civitai/blocks-cli`. |
### Examples (start here)
Six minimal, runnable blocks under [`starters/examples/`](./starters/examples) —
one per feature, each with its own README. Each runs offline via a dev harness
that simulates the host.
| Example | Shows |
|---|---|
| [`hello-world`](./starters/examples/hello-world) | lifecycle: `useBlockContext`, the host trust frame, self-set `data-theme` |
| [`settings`](./starters/examples/settings) | manifest `settings` + the headless `SettingsForm`, publisher vs viewer scopes |
| [`buzz-workflow`](./starters/examples/buzz-workflow) | `useBuzzWorkflow` estimate→submit→poll, the cost-quote-matches-charge rule |
| [`kv-storage`](./starters/examples/kv-storage) | `useAppStorage` get/set/delete/list/getQuota |
| [`scopes-api`](./starters/examples/scopes-api) | declaring scopes + calling scope-gated REST with the BLOCK_INIT token |
| [`buzz-purchase`](./starters/examples/buzz-purchase) | `useBuzzPurchase` + the insufficient-budget flow |
### The dev → submit → review → deploy lifecycle
Devs never touch git hosting. The path is:
1. **Auth + Build** — `civitai login` once, scaffold with `civitai app init`,
iterate locally with `npm run dev:harness` (mock host) or `npm run dev:live`
(live host), `vite build` to a static `dist/`. Validate the manifest any time
with `civitai app validate`.
2. **Submit** — `civitai app submit` validates, packages your project
(`block.manifest.json` + `src/` + `index.html` + `package.json` +
`vite.config.ts` + …), and uploads it for review with your stored token. You
don't include a `Dockerfile` or `nginx.conf` — the platform injects its own
build recipe at approve. (If you have no token configured, `submit` writes the
`.zip` and prints next steps; you can also web-upload at `/apps/submit`.)
3. **Review** — a moderator reviews the manifest + file diff at **`/apps/review`**
and approves (or rejects with a reason you see on `/apps/build`).
4. **Deploy** — on approve, the platform builds + serves your `dist/` and stamps
the block's `iframe.src` server-side, serving it at
**`https://<blockId>.civit.ai/`** (root-served). Within ~5 min your block is
live in its slot.
→ **[Build your first App](./docs/build-your-first-app-block.md)** — the
end-to-end guide, from `civitai app init` to a live block.
### Gotchas worth knowing up front
These bit us building the reference block; the examples + the guide bake in the fixes:
- **Set `data-theme` on your own root** — the host can't inject it into your
iframe, so any `[data-theme="dark"]` CSS is dormant until you do.
- **Your estimate must build params identically to submit** (esp. the seed) or
the quoted Buzz cost won't match the charge.
- **The platform owns the runtime image + `iframe.src`** — you don't ship a
`Dockerfile`/`nginx.conf` or set `iframe.src`; the platform injects the build
and stamps the src (`https://<blockId>.civit.ai/`, root-served) at approve.
Keep Vite `base: '/'` so the bundle resolves its own assets at the root.
- **The dev harness pins the parent origin** — serve on the matching origin or
`BLOCK_INIT` is rejected and the block hangs on "Loading…".
## Porting an existing app
Already have an app and want to **add Sign-in-with-Civitai** or **swap your image-gen provider** for Civitai's orchestrator? See [`PORTING.md`](./PORTING.md) — step-by-step recipe for grafting the SDK into an existing codebase, with notes on both additive ("Civitai as one more provider") and full-replacement integration modes.
## For AI coding agents
See [`AGENTS.md`](./AGENTS.md) at the root and the per-starter `AGENTS.md` inside each `starters/*`. The agent guides document which patterns to keep (auth + SDK lives in `@civitai/app-sdk`), which to avoid (don't put `client_secret` in the browser), and how the demo surface is structured.
## Working on the monorepo itself
```bash
pnpm install
pnpm build # build all workspace packages
pnpm test # run all package tests
pnpm typecheck # type-check everything
```
### Releasing the SDK
`@civitai/app-sdk` ships via changesets + a GitHub Actions workflow with npm OIDC. After changing the SDK:
```bash
pnpm changeset # author a changeset (patch / minor / major)
pnpm changeset status # preview pending bumps
```
Merge the auto-opened *Version Packages* PR to publish. Full guide: [`RELEASING.md`](./RELEASING.md).
## License
[MIT](./LICENSE)
Explore similar templates
Compare previews and descriptions within the same stack and category.

Next.js SaaS Starter
The official Next.js SaaS starter template, integrating email/password authentication, Stripe Checkout subscriptions, a dashboard with user/team CRUD, basic Owner/Member RBAC, and activity logging.
Next.js · SaaS

Next.js Commerce
Vercel's officially maintained Next.js App Router ecommerce starter with deep Shopify integration, offering a complete product catalog, cart, and checkout flow. Core logic is modular for swapping backends, and community provider versions exist for BigCommerce, Medusa, and Saleor.
Next.js · E-commerce

Next-js-Boilerplate
A developer-first Next.js 16 starter with Tailwind CSS 4 and TypeScript, supporting both App Router and Page Router.
Next.js · Starter

tailwind-nextjs-starter-blog
A Next.js and Tailwind CSS blog starter template using Contentlayer for Markdown/MDX, with built-in SEO, code highlighting, and tags. It targets personal technical blogs and migration from Jekyll/Hugo to React, and supports one-click Vercel deployment.
Next.js · Blog

next-forge
next-forge is a Turborepo-based Next.js template maintained by Vercel, positioned as a starting point for SaaS products.
Next.js · Starter

SaaS-Boilerplate
SaaS-Boilerplate is an open-source SaaS starter template built with Next.js App Router, React 19, TypeScript, Tailwind CSS, and Shadcn UI.
Next.js · SaaS
