Blog Template
A complete blog starter with posts, categories, tags, frontend pages, and demo content.
The Blog template is a production-quality blog starter. It ships posts, categories, tags, three admin-editable site singles, a full set of public-facing pages under a (frontend) route group, RSS feeds, sitemap, OG images, RBAC access policies, and a one-click demo-content seeder. Use it when you want a working starter to read, run, and modify rather than building from scratch.
Scaffold
pnpm create nextly-app@alpha my-blog --template blognpx create-nextly-app@alpha my-blog --template blogyarn create nextly-app@alpha my-blog --template blogbun create nextly-app@alpha my-blog --template blogTo skip the schema-approach prompt, pass --approach:
pnpm create nextly-app@alpha my-blog --template blog --approach code-first
pnpm create nextly-app@alpha my-blog --template blog --approach visualSchema approach
The Blog template supports two approaches:
code-first(default) -- Collections and singles are defined in TypeScript files undersrc/collections/andsrc/singles/. The CLI copiesconfigs/codefirst.config.tsto the project root asnextly.config.ts, and once the dependencies are installed it runsnextly migrate:create initialto write the first migration from that config, for the database you chose, intosrc/db/migrations/. The build'snextly migrateapplies it, the form-builder plugin's collections included. With--skip-install, run that command yourself after installing, before the first build. Best for version control and type safety.visual-- Collections and singles are created via the Visual Schema Builder in the admin. The CLI copiesconfigs/visual.config.ts(an empty config) to the project root asnextly.config.ts, and the template's prebuilt migration tomigrations/, the folder that config names. After scaffolding, define your schemas through the admin UI, or seed the demo schemas and content from the Start with sample content step of the Set up your project card on the admin dashboard.
What it ships
Collections
- Posts -- Title, slug, rich-text content, featured image, author (relation to users), categories, tags, excerpt, publish date, featured flag, SEO group (metaTitle, metaDescription, ogImage, canonical, noindex), and draft/published status. Auto-generates a slug from the title and computes reading time and word count on save.
- Categories -- Name, slug, description.
- Tags -- Name, slug, description.
The template uses the built-in users collection for authors. Posts relate to users via the author field, and users is extended with three scalar fields (bio, avatarUrl, slug) -- there is no separate authors collection.
Singles
- Site Settings -- Site name, tagline, description, logo, social handles. Drives the header, footer, and SEO metadata.
- Navigation -- Header link list, footer "Read" link list, theme-toggle and search-icon visibility flags.
- Homepage -- Hero title and subtitle, plus toggles for featured-post, latest-grid, category-strip, and newsletter-CTA sections, and the newsletter heading and subheading.
Frontend pages
Public-facing routes live under the src/app/(frontend)/ route group:
/-- Homepage (hero, featured, latest grid, category strip, newsletter CTA)./blog-- All posts, paginated./blog/[slug]-- Post detail with reading-progress bar, auto-generated table of contents, share bar, author card, and prev/next./categoriesand/categories/[slug]-- Category index and per-category archive./tagsand/tags/[slug]-- Tag cloud and per-tag archive./authors/[slug]-- Author profile page./search-- Client-side search powered by Pagefind.
SEO routes:
/sitemap.xmland/robots.txt, at the root ofsrc/app/./feed.xml(site-wide RSS), and per-category, per-tag and per-author RSS at/{categories,tags,authors}/[slug]/feed.xml, undersrc/app/(frontend)/.- Default OG image at
/opengraph-image, plus per-page OG handlers under each(frontend)segment.
Components
A set of React components for the frontend lives under src/app/(frontend)/components/, including PostCard, PostGrid, FeaturedPost, Hero, Header, Footer, CategoryCardGrid, CategoryStrip, TagCloud, Pagination, NewsletterCta, RichTextRenderer, ThemeToggle, ReadingProgressBar, PostTOC, PostShareBar, PostPrevNext, AuthorCard, JsonLd, and a few smaller helpers.
Access control
Three rules under src/access/ gate each CRUD operation:
anyone-- public read.has-permission-- the caller's role holds the operation's permission on the collection, as the Roles screen grants it:update-poststo edit a post,create-tagsto add a tag.own-posts-- Posts' update and delete rule: a caller holdingpublish-postschanges every post, and anyone else only the posts whoseauthoris them (see Only their own entries).
None checks a role's name, so a role you create and an API key are judged by the
permissions they hold. Publishing a post needs publish-posts. Only a caller holding it
sets or changes a post's author; a new post with no author becomes its creator's.
Media has no rule of its own: a visitor reads it through the built-in Public role's
read-media, granted once by the first nextly migrate, and taking it away on the Roles
screen keeps it away.
The demo-content seed creates three roles (admin, editor, author). An author may
draft posts and edit and delete their own, but holds no publish-posts; an editor
publishes, and edits and deletes every post. A blog scaffolded with the visual approach
has no code rules, so the permission alone decides: there the seed gives an author no
delete-posts, and an author edits every post.
Demo data
The demo content is 16 posts, 3 authors, 4 categories, and 8 tags. The CLI does not ask about it: seeding runs from the first step of the Set up your project card on the admin dashboard, Start with sample content, which a super-admin sees while nobody has loaded or declined it and the site holds no entry. Load starts the seed and shows its progress in the step, and the step is ticked once it completes; No thanks declines it for the whole site. A seed or a decline that fails says so in the step, with Retry. The seed is idempotent and uses placeholder gradient SVGs that you can replace later.
Newsletter form
The homepage and footer newsletter forms submit through the form-builder plugin. The seed creates a form with slug newsletter; submissions are stored in the form-submissions collection and viewable at /admin/collections/form-submissions.
File tree
my-blog/
├── migrations/ # Visual: the blog schema, prebuilt for each dialect
├── scripts/
│ └── build-search-index.mjs # Pagefind index builder
├── src/
│ ├── access/ # RBAC access functions
│ ├── actions/ # Server actions (newsletter)
│ ├── app/
│ │ ├── (frontend)/ # Public pages, their components, RSS feeds and OG handlers
│ │ │ └── components/ # Frontend React components
│ │ ├── admin/ # Admin route, its API, and the seed endpoints
│ │ ├── api/ # Health and media routes
│ │ ├── opengraph-image.tsx
│ │ ├── robots.ts
│ │ ├── sitemap.ts
│ │ ├── globals.css
│ │ └── layout.tsx
│ ├── collections/
│ │ ├── Categories.ts
│ │ ├── Posts/
│ │ └── Tags.ts
│ ├── endpoints/seed/ # Demo-content seed phases and media
│ ├── singles/
│ │ ├── Homepage/
│ │ ├── Navigation/
│ │ └── SiteSettings/
│ ├── hooks/ # Shared collection hooks (auto-slug, etc.)
│ ├── lib/ # Cached query helpers, RSS builder, OG layout
│ └── instrumentation.ts # Registers Next.js cache revalidation
├── nextly.config.ts # The config for the approach you chose
├── .env.example
├── next.config.ts
├── package.json
└── tsconfig.jsonNext steps
- Installation -- Pick your database, create the super-admin account, and run the dev server.
- Tutorial: build a blog -- Walk through building a blog from scratch to compare against the template.
- Configuration -- Add fields, create new collections, or define your own singles.