Full Feature Recipe
Build end-to-end features across Directus (data) and Next.js (interface) with a repeatable six-step pattern. Follow the template in template.md for each new feature.
Pattern Overview
Every feature in this stack follows the same flow:
- Data Model — Create or extend the Directus collection, its fields and its permissions
- TypeScript Types — Mirror the collection in
types/directus.ts
- Reads — One tagged read function per query in
lib/content/, then Server Component pages that call it
- Mutations — Server Actions that authenticate, authorize, write, then expire the tag (if needed)
- Register for Revalidation — Add the collection to the Directus Flow and to the Route Handler's allow-list
- Verify — Types compile, the page renders, an edit in Directus reaches the page
Prerequisites
init-project completed (client, schema type, environment variables)
- The revalidation pipeline from
deployment exists (Flow and /api/revalidate)
- Directus MCP connection working
- Next.js dev server running
How to Use
Read template.md and fill in the placeholders for each new feature. It gives the file paths, code patterns and verification steps.
For data modeling guidance defer to directus-dev; for page patterns defer to nextjs-dev. The rules at the boundary (token, cache, assets, types) are in directus-to-nextjs; this recipe applies them in order.
Quick Reference
| Step |
Where |
What |
| Data Model |
Directus Studio or MCP tools |
Create collection, add fields, give the server token's policy read (and write if needed) |
| TypeScript |
types/directus.ts |
Add the interface, update Schema |
| Reads |
lib/content/{collection}.ts |
requestTagged(readItems(...), [collection], seconds) inside cache() |
| Pages |
app/{route}/page.tsx, app/{route}/[slug]/page.tsx |
Server Components calling the read functions, plus generateStaticParams and generateMetadata |
| Actions |
app/{route}/actions.ts |
requireUser(), then createItem / updateItem with the user's token (withToken), then updateTag |
| Revalidation |
Directus Flow, app/api/revalidate/route.ts |
The collection name in both lists |
| Verify |
npx tsc --noEmit, browser, Directus |
Types, rendering, images, an edit reaching the page |
1---2name: full-feature-53description: This skill should be used when the user wants to "build a complete feature with Directus and Next.js", "create an end-to-end page from Directus data", "implement a full CRUD feature across Directus and Next.js", "build a new section of the site", "create a page that shows Directus data", "build a dashboard with Directus content", "display Directus collection in Next.js", "add a new page with CMS data", or needs a step-by-step recipe for building features that span both Directus and Next.js.4metadata:5 source: https://skillmd.com/skills/agents-store/full-feature-56---78# Full Feature Recipe910Build end-to-end features across Directus (data) and Next.js (interface) with a repeatable six-step pattern. Follow the template in `template.md` for each new feature.1112## Pattern Overview1314Every feature in this stack follows the same flow:15161. **Data Model** — Create or extend the Directus collection, its fields and its permissions172. **TypeScript Types** — Mirror the collection in `types/directus.ts`183. **Reads** — One tagged read function per query in `lib/content/`, then Server Component pages that call it194. **Mutations** — Server Actions that authenticate, authorize, write, then expire the tag (if needed)205. **Register for Revalidation** — Add the collection to the Directus Flow and to the Route Handler's allow-list216. **Verify** — Types compile, the page renders, an edit in Directus reaches the page2223## Prerequisites2425- `init-project` completed (client, schema type, environment variables)26- The revalidation pipeline from `deployment` exists (Flow and `/api/revalidate`)27- Directus MCP connection working28- Next.js dev server running2930## How to Use3132Read `template.md` and fill in the placeholders for each new feature. It gives the file paths, code patterns and verification steps.3334For data modeling guidance defer to `directus-dev`; for page patterns defer to `nextjs-dev`. The rules at the boundary (token, cache, assets, types) are in `directus-to-nextjs`; this recipe applies them in order.3536## Quick Reference3738| Step | Where | What |39|------|-------|------|40| Data Model | Directus Studio or MCP tools | Create collection, add fields, give the server token's policy read (and write if needed) |41| TypeScript | `types/directus.ts` | Add the interface, update `Schema` |42| Reads | `lib/content/{collection}.ts` | `requestTagged(readItems(...), [collection], seconds)` inside `cache()` |43| Pages | `app/{route}/page.tsx`, `app/{route}/[slug]/page.tsx` | Server Components calling the read functions, plus `generateStaticParams` and `generateMetadata` |44| Actions | `app/{route}/actions.ts` | `requireUser()`, then `createItem` / `updateItem` with the user's token (`withToken`), then `updateTag` |45| Revalidation | Directus Flow, `app/api/revalidate/route.ts` | The collection name in both lists |46| Verify | `npx tsc --noEmit`, browser, Directus | Types, rendering, images, an edit reaching the page |