Next.jsViteReactStarter

layerbase-app-starter — Next.js Starter Template

By Layerbase-LLC

The official Layerbase app starter template, providing two self-contained examples, node-vite and nextjs, both implementing the same todo list and including a built-in publish workflow.

Explore the design

Compare the page layouts and mobile experience. Open any screenshot for a closer look.

3 previews
Desktop homepage1 / 3
Desktop captureTop of page

Actual screenshot captured by the server browser.

All pages & views 3

Screenshots show visual appearance; interactive behavior may differ.

Recorded 2026-10-14View source

What stands out

A quick read of the recorded project description.

01

Provides two self-contained examples, node-vite and nextjs, both implementing the same todo list

02

Each example folder can be copied and used on its own, and comes with its own publish workflow

03

Demonstrates the Layerbase app contract: PORT listening, DATABASE_URL persistence, idempotent startup migrations, dual health check endpoints, graceful SIGTERM exit, prebuilt image and OCI version tag

04

Includes prompts for AI coding assistants, guiding replacement of the example functionality while preserving the platform contract parts

05

Local development uses spindb to create PostgreSQL and set DATABASE_URL

Template Details

This repository is the app starter template for the Layerbase platform. It contains two complete and minimal example apps that implement the same todo list functionality but use different stacks: node-vite uses a Hono server with a React (Vite) frontend, running in a single process; nextjs uses the Next.js App Router with standalone output. Each example folder is a self-contained repository that can be copied out and used on its own, and comes with its own publish workflow.

The README explains that the template is intended to demonstrate the contract a Layerbase app must satisfy: listen on PORT and bind to all interfaces, persist only through DATABASE_URL and run idempotent migrations at startup, provide two health check endpoints GET /healthz (liveness) and GET /health (readiness), exit cleanly on SIGTERM, and publish as a prebuilt image with an OCI version tag. The template also provides prompts for AI coding assistants to replace the example todo functionality, and emphasizes not modifying the parts related to the platform contract.

For local running, the README recommends using Layerbase's spindb CLI to create a PostgreSQL database, copying .env.example to .env and setting DATABASE_URL, then running pnpm install and pnpm dev. For deployment, after pushing the code to your own GitHub repository, the bundled .github/workflows/publish.yml activates, and every push to the main branch builds an image and publishes it to your own GHCR namespace. The README does not provide information about template performance, production readiness, or other features beyond the above.

Next.jsViteStarter

Is it right for your project?

Use Cases

  • Starting a new containerized app project on the Layerbase platform
  • Referencing the node-vite or nextjs example to understand how the platform contract is implemented
  • Using an AI coding assistant with the prompts to quickly replace the example functionality with your own app
  • Copying the template to your own GitHub repository and using the bundled workflow to automatically build and publish images to GHCR

Suitable For

  • Developers preparing to deploy an app on the Layerbase platform
  • Developers who need to reference examples for both the Hono + React (Vite) and Next.js App Router stacks
  • Developers who want to quickly prototype an app that satisfies the platform contract with an AI coding assistant

Getting started & customization

Use these recorded setup notes alongside the repository instructions for your chosen version.

  1. 1

    Copy an example with pnpx tiged Layerbase-LLC/layerbase-app-starter/node-vite [APP_NAME] or pnpx tiged Layerbase-LLC/layerbase-app-starter/nextjs [APP_NAME]

  2. 2

    For local development, create a PostgreSQL database with spindb create [APP_NAME] --engine postgresql

  3. 3

    Copy .env.example to .env and set DATABASE_URL to the database connection string

  4. 4

    Run pnpm install and pnpm dev to start local development

  5. 5

    After pushing to the main branch of your own GitHub repository, the bundled publish.yml workflow automatically builds and publishes an image to GHCR

Read repository instructions

License & source material

Usage conditions & limitations

Free to use · keep license notice

This entry covers the free version under the MIT license in the public repository; the free scope is the code of this version and does not mean external services or third-party assets are free.

Must comply with when using

  • Free use, modification, commercial use, and distribution of this version's code are permitted.
  • When distributing copies or substantial portions of the code, retain the original author's copyright notice and the complete MIT license notice.
  • The code is provided as is; warranties and limitations of liability are governed by the original license and applicable law.

Additional costs & items to verify

  • Demo images, fonts, icons, and other third-party assets must be checked against their respective licenses and cannot be judged solely by the code's MIT license.
  • External services such as domains, hosting, databases, payments, or AI may incur separate charges.
  • Local development requires a PostgreSQL database; you can create one using Layerbase's spindb CLI or provide your own database.
  • When using spindb to create a local PostgreSQL database, that command must be run and depends on the spindb CLI.
  • You need to copy .env.example to .env and manually set DATABASE_URL to the database connection string.
  • Listing a new app in the Layerbase app directory currently requires contacting the official team to complete, rather than being self-service.
  • An app must comply with the contract before it can apply to be listed in the Layerbase directory.
  • Listing in the directory requires contacting the official team through Layerbase support channels.
View Original Text Basis

Permission is hereby granted, free of charge

Original License Text

# A local Postgres (Layerbase's spindb CLI, or bring your own)

Original README

spindb create todos --engine postgresql

Original README

cp .env.example .env # then set DATABASE_URL to its connection string

Original README

Listing a new app in the catalog is currently done with us rather than

Original README

self-serve: if you have an app that fits this contract,

Original README

[get in touch](https://layerbase.com/support).

Original README
https://github.com/Layerbase-LLC/layerbase-app-starter/blob/main/LICENSEhttps://github.com/Layerbase-LLC/layerbase-app-starter/blob/main/README.md

Compiled by DeepSeek based on repository license and README ·2026-10-14. 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 · 85 / 100
Technologies
Next.js · Vite · 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-07-04
Screenshot last checked
2026-10-14

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.

Review declaration: codex-user-requested-batch-review-20261015 · 2026-10-15

Inspect the recorded source material

SHA-256: 2f990deebdfd747ab7644ff0ec224099fcc5bb712e0b2ccf8ec6710d04df7b1e

2026-10-14T22:33:11.726Z

Source file / repository
# Layerbase App Starter

Two complete, minimal Layerbase apps - the same todo list, implemented twice.
**Each folder is a self-contained repo**: copy one out and it comes with
everything, including its own publish workflow.

| Example | Stack |
| --- | --- |
| [`node-vite/`](node-vite/) | Hono server + React (Vite) frontend, one process |
| [`nextjs/`](nextjs/) | Next.js App Router, standalone output |

## Start with a prompt

Building with an AI coding assistant? Pick the prompt for your stack, fill in
the `[BRACKETED]` parts, and paste it in.

### Node app with a Vite frontend

```text
Bootstrap a Layerbase app for me.

1. Scaffold from the starter:
     pnpx tiged Layerbase-LLC/layerbase-app-starter/node-vite [APP_NAME]
2. The app I am building: [WHAT YOUR APP DOES, e.g. "a link shortener with
   click analytics"]. Replace the example todo feature (the /api routes in
   src/server/index.ts, the schema in src/server/db.ts, and the UI in
   src/web/) with it, keeping the same structure.
3. Frontend: it ships as Vite + React. I want [react | vue | svelte]; if not
   React, swap the Vite plugin and rewrite src/web accordingly.
4. Do NOT change the platform contract pieces: the PORT/HOST binding, the
   idempotent boot migration against DATABASE_URL (extend the schema, keep it
   idempotent), the GET /healthz (liveness) + GET /health (readiness) split,
   the Dockerfile HEALTHCHECK, SIGTERM draining, the multi-stage Dockerfile,
   and .github/workflows/publish.yml.
5. For local dev, create a Postgres with spindb
   (spindb create [APP_NAME] --engine postgresql) then copy .env.example to .env and
   set DATABASE_URL to its connection string.
6. Create a GitHub repository named [APP_NAME] and push to main - the bundled
   workflow publishes the image to my GHCR namespace automatically.

Hosting reference: https://layerbase.com/docs/apps - the app runs as one
stateless container with a managed database injected as DATABASE_URL; TLS,
domains, and self-healing are handled by the platform.
```

### Next.js app

```text
Bootstrap a Layerbase app for me.

1. Scaffold from the starter:
     pnpx tiged Layerbase-LLC/layerbase-app-starter/nextjs [APP_NAME]
2. The app I am building: [WHAT YOUR APP DOES, e.g. "a changelog page with an
   admin editor"]. Replace the example todo feature (the route handlers in
   app/api/todos/, the schema in lib/db.ts, and the UI in app/page.tsx +
   components/) with it, keeping the same structure.
3. Do NOT change the platform contract pieces: the standalone output config,
   the idempotent boot migration in lib/db.ts wired through
   instrumentation.ts (extend the schema, keep it idempotent),
   app/healthz/route.ts (liveness) + app/health/route.ts (readiness), the
   Dockerfile HEALTHCHECK, the multi-stage Dockerfile, and
   .github/workflows/publish.yml.
4. For local dev, create a Postgres with spindb
   (spindb create [APP_NAME] --engine postgresql) then copy .env.example to .env and
   set DATABASE_URL to its connection string.
5. Create a GitHub repository named [APP_NAME] and push to main - the bundled
   workflow publishes the image to my GHCR namespace automatically.

Hosting reference: https://layerbase.com/docs/apps - the app runs as one
stateless container with a managed database injected as DATABASE_URL; TLS,
domains, and self-healing are handled by the platform.
```

## Or by hand

```bash
pnpx tiged Layerbase-LLC/layerbase-app-starter/node-vite my-app
# or: pnpx tiged Layerbase-LLC/layerbase-app-starter/nextjs my-app

cd my-app && git init && git add -A && git commit -m "init from layerbase-app-starter"
```

Push it to your own GitHub repo and the bundled workflow
(`.github/workflows/publish.yml`) activates: every push to `main` builds the
image and publishes it to **your** GHCR namespace with the tags and OCI
version label the Layerbase platform expects. (Inside this monorepo the
per-folder workflows are dormant - GitHub only executes workflows at a repo
root, and this repo deliberately has none.)

Then replace the todo parts with your real app. The platform-facing plumbing
is already done.

## The contract

A Layerbase app is a container the platform can run without knowing anything
about it. That takes exactly five things, all demonstrated in both examples:

| Requirement | Why |
| --- | --- |
| Listen on `PORT`, bound to all interfaces | The platform's proxy terminates TLS and routes to your container |
| Persist ONLY to `DATABASE_URL`, migrate on boot, idempotently | The container is disposable - every redeploy replaces it |
| Answer `GET /healthz` (liveness) and `GET /health` (readiness) | Two probes with two jobs - see [Health checks](#health-checks) below |
| Exit cleanly on `SIGTERM` | Redeploys drain in-flight requests instead of dropping them |
| Ship as a prebuilt image with an OCI version label | Nothing builds on boot; the platform detects available updates |

Everything else - TLS, domains, DNS, the database itself, backups, restarts -
is the platform's job, not yours.

## Health checks

An app answers **two** health endpoints, and they must not be the same handler:

| Endpoint | Job | Touches the DB? | Who probes it |
| --- | --- | --- | --- |
| `GET /healthz` | Liveness - is the process serving HTTP at all? | **No.** Instant 200, no auth, no I/O | The **image's own `HEALTHCHECK`** in the `Dockerfile` (what `docker inspect` reports) |
| `GET /health` | Readiness - can it actually serve, DB and all? | **Yes.** Pings the database | The **Layerbase platform** reconciler, which recreates the container and can revive the backing store |

Why split them? The platform injects **no** Docker healthcheck, so your image's
`HEALTHCHECK` is what Docker reports on its own. If that healthcheck probes a
DB-dependent path, one database blip flips a container that is serving fine to
permanently "unhealthy". Keep liveness (`/healthz`) dependency-free so it only
fails when the process is genuinely wedged; let the platform's readiness probe
(`/health`) be the one that cares about the database, because its remediation
can revive that database.

Two rules the `HEALTHCHECK` lines in both examples follow, both learned the
hard way in production:

- **Read the port from `PORT`** (`http://127.0.0.1:${PORT}/healthz`), never a
  hardcoded literal. The platform allocates the port and injects it as `PORT`;
  a hardcoded port probes the wrong place and always reports unhealthy.
- **Use a dependency the runtime image actually has.** These slim images have
  no `curl`, so the probe uses Node's built-in global `fetch`
  (`node -e "fetch(...)"`), not `curl`.

## Run an example locally

```bash
cd node-vite   # or nextjs

# A local Postgres (Layerbase's spindb CLI, or bring your own)
spindb create todos --engine postgresql
cp .env.example .env   # then set DATABASE_URL to its connection string

pnpm install
pnpm dev
```

Each example's README has the stack-specific details.

## Hosting on Layerbase

Layerbase provisions the container, the hidden backing database, the
`DATABASE_URL` wiring, an HTTPS hostname, and optional custom domains - the
same machinery that runs [Session Replay](https://layerbase.com/docs/apps).
Listing a new app in the catalog is currently done with us rather than
self-serve: if you have an app that fits this contract,
[get in touch](https://layerbase.com/support).
Report a correction

Explore similar templates

Compare previews and descriptions within the same stack and category.