Start a Consumer Repository
A LiteSpec consumer is a project built against the LiteSpec standard, and this tutorial turns an empty folder into one: its configuration, its first Intent records, the Behavior specified from them, one working use case, and a passing model check. A use case names what the product does for an actor, a person or system using it, and the model check confirms the records, code, and tests agree. This tutorial follows one backend stack and one frontend stack, the dotnet backend with a React frontend, so every step runs the same way for every reader. A developer follows these steps once, when creating the consumer. Each step names the standard it satisfies, and the tutorial adds no rule of its own.
On this page
Prerequisites#
- Install the .NET SDK and Node.js releases the adopted release pins under
stackin itslitespec.manifest.yaml. - Read nothing in advance: each step links the standard it satisfies, so open each linked page at its step.
- Ship the
dotnetbackend with a React frontend: this tutorial follows that pair from thedotnet-reactpreset. When the product ships another frontend, follow this tutorial first, then declare that frontend with its own how-to, Add a Svelte Frontend or Add a Blazor Frontend. - To start with records only and no stack, follow Start with Records Only instead of this tutorial.
Lesson#
This lesson creates a new project. The litespec new commands below write each record from its template with example values, so replace every example value with the project's own before committing. After the project runs, adding new intent to it follows the one sequence under New Intent in a Running Project on the agent page, and the check steps below walk that same order for the first slice.
- Install the LiteSpec CLI for the adopted release as the CLI overview shows. Check that
dotnet litespec --helpprints the command list from the consumer root. This satisfieslitespec/workspace/structure#use-the-canonical-root-tree. - Run
dotnet litespec init --preset dotnet-react --size smalland confirm.litespec/project.yamlexists. The initialize command lists what the command writes. This satisfieslitespec/core/scope#select-a-size-a-shape-and-stacks. - Select extensions only when their criteria already hold. Write each selection in the object form with its criterion. This satisfies
litespec/core/scope#select-conditional-extensions-explicitlyandlitespec/core/scope#record-selected-extensions. - Set
paths.behaviorDocsin.litespec/project.yamlto the Behavior root and confirm the path names that folder. This satisfieslitespec/core/scope#point-behavior-docs-at-the-behavior-root. - Create the toolchain configuration from the manifest pins named on the project file and manifest pages. Check that the SDK, build, package, tool manifest, and JavaScript toolchain pins match the manifest. This satisfies
litespec/backend/dotnet/config#set-the-sdk-floor-at-the-workspace-root,litespec/backend/dotnet/config#centralize-net-build-settings,litespec/backend/dotnet/config#centralize-nuget-versions,litespec/backend/dotnet/config#commit-the-tool-manifest, andlitespec/workspace/config#pin-the-javascript-toolchain. - Add only the packages the manifest already pins. Record each new package approval explicitly. This satisfies
litespec/workspace/dependencies#pin-every-dependency-version-centrallyandlitespec/workspace/dependencies#approve-new-packages-explicitly. - Create the API solution and its projects as Write Code for a Use Case and the .NET architecture and backend testing pages describe. Check that the solution holds the projects those pages require for a small server project. This satisfies
litespec/backend/dotnet/architecture#separate-the-shared-kernel-from-the-modules,litespec/backend/testing#keep-the-test-suites-the-size-requires, andlitespec/backend/dotnet/packages#run-litespec-analyzers-in-the-business-projects-and-hosts. - Apply the naming rules: match each C# file to its primary type and each namespace to its folder. This satisfies
litespec/backend/dotnet/naming#match-c-files-and-primary-typesandlitespec/workspace/naming#keep-namespaces-aligned-with-folders. - Write the product record. Run
dotnet litespec new product <name>and fill itsboundary, itsaddresses, and itssummary. This satisfieslitespec/core/intent#state-one-productandlitespec/core/intent#keep-intent-in-its-homes. - Write one module with its first feature. Run
dotnet litespec new module <module>, write the problem the feature answers, then follow Write a Feature Under a Problem to add the feature and its requirements. This satisfieslitespec/core/intent#keep-intent-in-its-homesandlitespec/core/intent#identify-every-requirement. - State which constraints apply. Run
dotnet litespec new constraint <name>once per outside rule and complete the record, or record that none applies. This satisfieslitespec/core/intent#answer-every-constraintandlitespec/core/scope#answer-the-constraints-question. - Record the first decision. Run
dotnet litespec new decision <name>and complete the record and its explanation file. This satisfieslitespec/core/intent#shape-each-decision-page. - Write the people records. Run
dotnet litespec new actor <name>once per party anddotnet litespec new role <name>once per grantable set. Create the module permission list from its template and add each permission withdotnet litespec new entry .litespec/behavior/modules/<module>/permissions.yaml permission <name>. When the slice exchanges anything with an outside system, rundotnet litespec new external-system <name>and complete the record. - Write one journey. Run
dotnet litespec new journey <name>and complete the record with itsserves,startedWhen,finishedWhen, steps, andbranches. This satisfieslitespec/core/intent#order-each-journey-toward-one-goal,litespec/core/intent#write-journey-steps-as-sentences-with-ids,litespec/core/intent#state-when-each-journey-starts, andlitespec/core/intent#state-when-each-journey-finishes. - Check the Intent records. Run
dotnet litespec model checkfrom the consumer root and fix every finding that names a record written so far before continuing. The run sees records only at this point, so it still reports missing Behavior record types and unreached Intent until step 16. The model command page lists the findings and their levels. - Specify the module from Intent. Leave this tutorial now and complete Model a Behavior Module from its first step to its last, then return here, run
dotnet litespec model check, and fix every finding before code moves. This satisfieslitespec/core/system#group-module-use-case-files-by-aggregateandlitespec/core/model#author-one-slice-at-a-time. - Implement one use case. Move the transition into a business method, keep the handler narrow, commit once, expose one endpoint, and authorize the target. Code points up to its record through its mark. This satisfies
litespec/backend/domain#express-transitions-through-business-methods,litespec/backend/application#keep-command-handlers-to-load-call-and-stage,litespec/backend/dotnet/persistence#commit-once-in-the-command-pipeline,litespec/backend/dotnet/api#use-one-endpoint-per-operation, andlitespec/backend/application#enforce-target-authorization-in-the-pipeline. - Declare the React frontend. Declare the application tree and mirror the backend use case path. This satisfies
litespec/frontend/web/structure#use-the-frontend-application-tree. Build each pattern Default and record it withsource: recommended, waiting for an owner only when a route departs from the Default or no Default exists, and compose each route from one floorplan. This satisfieslitespec/frontend/ui#compose-each-route-from-one-floorplan. - Deliver one complete slice. Ship source, tests, contracts, and operating evidence for one use case. This satisfies
litespec/core/system#deliver-one-complete-use-case. - Add the operating records. Write the settings and runbooks, add deployment, backup, restore, and rollback, and configure the pipeline gates. This satisfies
litespec/quality/operations#start-the-stack-with-one-local-commandandlitespec/quality/ci#run-applicable-gates-on-every-pull-request. - Run the boundary gates and the test suites the changed areas select, so the latest test run stands before the model reads it.
- Run
dotnet litespec model checkand confirm the run exits with no open blocking finding. The model command page lists its exit codes and what it reports. - Run
dotnet litespec model renderand commit what it wrote. This satisfieslitespec/core/release#run-consistency-checks. - Run
dotnet litespec bookand open the journey detail, the way product reviewers read the change.
What You Built#
- A consumer repository at small size that the model check accepts.
- One coded use case with Intent, Behavior, code, tests, and generated contracts.
- When the next use case is specified, follow Write Code for a Use Case to place each of its code elements with its mark and check.
- When the product ships another frontend, Add a Svelte Frontend and Add a Blazor Frontend declare it. The checks are documented on Model Builder; all commands are listed on the command index.