Code Generation · Overview
Code Generation
Underpeaks generates complete, production-ready applications from your content models, pages, menus, and themes.
What gets generated
Flutter
- Full project scaffold (pubspec.yaml, lib/, assets/)
- Data models with null safety
- Repository layer connecting to your Underpeaks public API
- Navigation with go_router, including bottom-nav and drawer shells
- Auth screens (sign in, sign up, forgot password, reset password)
- Content list and detail screens per model
Next.js
- App Router project scaffold
- TypeScript types matching your models
- API route wrappers around your Underpeaks public API
- Pages per model
- Custom auth screens (sign in, sign up, forgot password, reset password) backed by Underpeaks' own auth API — not a third-party auth library
- A navigation component built from your pages' nav settings — a top bar, or a collapsible sidebar on desktop that becomes an off-canvas panel on mobile, depending on how your pages are configured
How to generate
Code generation runs through the nxf CLI. See Quick Start for full setup, or jump straight in:
npm install -g underpeaks-nxf
nxf login
nxf generate flutter # or nextjs
File categories and regeneration
Every generated file is tagged with a category:
| Category | Behaviour |
|---|---|
generated | Refreshed on regeneration — e.g. routing/navigation files. Don't hand-edit these. |
customizable | Generated once, then yours to edit — e.g. auth screens, page UI, the nav component. |
root | Project-level files like .env.example. |
Regeneration is smarter than a simple overwrite: each run computes a checksum of every generated file and compares it against the file actually on disk. If a customizable file's on-disk content no longer matches what was last generated — meaning you've edited it — it's flagged as customized and skipped on the next run, so your changes aren't overwritten. Files you haven't touched are regenerated normally.
Run nxf generate <target> any time to pick up model, page, menu, or theme changes.