# Headless CMS: Nextly as a headless CMS.

Read content straight from your database in your page code (the Direct API), or over REST.

MIT licensed, self-hosted. Runs inside your own Next.js app, on your own PostgreSQL or MySQL database, or SQLite for local work.

[Start building](https://nextlyhq.com/docs/getting-started/quick-start.md) · [Read the docs](https://nextlyhq.com/docs/api-reference/rest-api.md)

```bash
npx create-nextly-app@alpha my-app
```

## The short answer: Can I use Nextly as a headless CMS?

Yes. Access rules you write in code apply over REST and in the admin, including read rules on a collection’s or single’s own fields. Sign-in for your team: email and password, sessions and API keys, stored in your own database.

## How it fits together: What you write, what Nextly runs, and who it is for

Each numbered part is explained under the drawing, with its limit where it has one.

| # | In your code | Nextly, inside your Next.js app | Who it is for |
| --- | --- | --- | --- |
| 1 |  | **REST**: Under /admin/api, with API keys | Other apps and services |
| 2 | `nextly.config.ts`: Collections, singles, rules | **The admin**: At /admin | Your team: entries, media, users |
| 3 | `app/**/page.tsx`: Your routes and server code | **The Direct API**: Trusted server code | Your pages and routes |

Your own PostgreSQL or MySQL database, or SQLite for local work

### 1. REST

Access rules you write in code apply over REST and in the admin, including read rules on a collection’s or single’s own fields.

Limit: With the rate limit on (the default), every REST request, the admin API included, counts against a budget for whoever is asking: a signed-in session, an API key, or an address.

[CMS for Next.js](https://nextlyhq.com/nextjs-cms)

### 2. The admin

Model content in TypeScript or in the Visual Schema Builder. Both feed the same Nextly runtime, admin and APIs.

Role-based permissions for each collection and action, plus field-level read and write rules in code, on a collection’s or single’s own fields.

[CMS for Next.js](https://nextlyhq.com/nextjs-cms)

### 3. The Direct API

Read content straight from your database in your page code (the Direct API), or over REST.

Limit: The Direct API runs as trusted server code and skips access rules unless you pass `overrideAccess: false`.

[CMS for Next.js](https://nextlyhq.com/nextjs-cms)

## In your code: The code you write

`nextly.config.ts`

```ts
import { defineCollection, defineConfig, richText, text } from "nextly/config";

const Posts = defineCollection({
  slug: "posts",
  admin: { useAsTitle: "title" },
  fields: [
    text({ name: "title", required: true }),
    text({ name: "slug", required: true, unique: true }),
    richText({ name: "content" }),
  ],
  status: true,
});

export default defineConfig({ collections: [Posts] });
```

written for nextly 0.0.2-alpha.82.

`app/blog/page.tsx`

```tsx
import { getNextly } from "nextly";
import config from "@/nextly.config";

export default async function BlogPage() {
  const nextly = await getNextly({ config });
  const { items: posts } = await nextly.find({
    collection: "posts",
    where: { status: { equals: "published" } },
    sort: "-createdAt",
    limit: 10,
  });
  return <ul>{posts.map((p) => <li key={p.id}>{p.title}</li>)}</ul>;
}
```

written for nextly 0.0.2-alpha.82.

## What ships today: in 0.0.2-alpha.82

- **Package:** `nextly`
- **Release:** `0.0.2-alpha.82` · 28 Nov 2026
- **Licence:** MIT
- **APIs:** The Direct API and REST
- **Databases:** PostgreSQL 15+, MySQL 8+, SQLite 3.38+ for local work
- **Requires:** Node.js 22.12+ or 24+; Next.js 16 with the App Router; React 19

## Before you start

Nextly fits if you want:

- Access rules in code that apply over REST and in the admin.
- Your data in your own PostgreSQL or MySQL database.

Look elsewhere if you need:

- A GraphQL API. Nextly offers REST and the Direct API.
- A hosted service. Nextly is self-hosted.

- **Behind a proxy:** Behind a proxy, set `security.trustProxy` so anonymous callers are told apart. [Docs](https://nextlyhq.com/docs/api-reference/rest-api.md)
- **Access rules and the Direct API:** The Direct API runs as trusted server code and skips access rules unless you pass `overrideAccess: false`. Called that way with no `user`, it is judged as a signed-out visitor: it can read where no rule names the read, and a create, update or delete needs a rule that allows it. [Docs](https://nextlyhq.com/docs/permissions.md)
- **Sign-in:** Sign-in for your team: email and password, sessions and API keys, stored in your own database. [Docs](https://nextlyhq.com/docs/guides/authentication.md)

Nextly is in alpha. APIs may change before 1.0. Pin exact versions in production.

## Short answers

### Does Nextly have a GraphQL API?

No. Nextly offers REST and the Direct API.

### Does Nextly run inside my Next.js app?

MIT licensed, self-hosted. Runs inside your own Next.js app, on your own PostgreSQL or MySQL database, or SQLite for local work.

### Do access rules apply over REST?

Access rules you write in code apply over REST and in the admin, including read rules on a collection’s or single’s own fields.

### Is Nextly free?

Nextly is MIT licensed and self-hosted. MIT today, and no decision yet about paid offerings.

## The parts of Nextly this uses

- [CMS for Next.js](https://nextlyhq.com/nextjs-cms): Runs inside your own Next.js app, on your own PostgreSQL or MySQL database.
- [Plugins](https://nextlyhq.com/plugins): The established official plugins: Visual Page Builder, SEO and Form Builder.
- [Publishing](https://nextlyhq.com/publishing): Working drafts, version history and Content Releases.

- [Next.js apps](https://nextlyhq.com/use-cases/nextjs-apps.md): Use Nextly as the content and admin layer inside your Next.js app.
- [Marketing websites](https://nextlyhq.com/use-cases/marketing-site.md): After a developer sets up and deploys Nextly, editors manage content and pages in the admin.
- [Agency work](https://nextlyhq.com/use-cases/agency-work.md): Client sites with an admin you can hand over.
