Code Generation & Templates
Code generation is the step that turns your application’s specification into a real, working codebase. This page covers what gets produced, how to run generation, and the templates that shape the output.
What gets generated
From your specification, Mushin generates a complete application in Nandeshou’s standard stack:
- A Go backend — data models, services, and a REST API, built on the platform’s conventions (Gin, GORM, and PostgreSQL, with the platform’s asynchronous service pattern).
- A TypeScript / React frontend — the data model, services, and pages, built with the platform’s frontend conventions (Vite and Material UI).
The generated code follows the same patterns a hand-written Nandeshou application uses, so it is idiomatic and ready to build and run rather than a rough sketch you must rework.
Running generation from the Workbench
From your project you run Generate. Generation runs in the background: Workbench starts a run, and you can watch its status and, when it finishes, see the result — whether it succeeded, its log, and how many files were written. Because a run does real work on the server, one generation runs at a time per project.
Generation reads the specification from your latest committed design, so commit your work (see Design Streams & Version Control ) before generating to capture the design you want.
Running generation from the command line
Mushin also has a command-line generator, nds generate, for use in scripts and automated pipelines. It takes the project to generate and where to write the output, and produces the same result as the Workbench. This is how generation fits into a repeatable build process. See Deployment & Operations
for the nds command line.
Generation needs two things configured: the templates to generate from, and an output location to write to. If they are not set, Workbench and the CLI will tell you generation is not configured rather than failing obscurely.
Templates
The generator does not hard-code what it produces — it fills in templates. Templates are the blueprints for every generated file, and they encode Nandeshou’s backend and frontend conventions: how a model is written, how a service is structured, how a page is laid out.
The template set covers both stacks and includes an authentication variant, so a generated application can be produced with multi-tenant authentication and the platform’s tenant model built in, or without, depending on what your application needs. Because the conventions live in the templates, generated applications stay consistent with the platform and with each other.
Related pages
- The Metadata Knowledge Base — the specification generation reads
- Design Streams & Version Control — committing before you generate
- Deployment & Operations
— the
ndscommand line and packaging