CLI tool for scaffolding full-stack applications with C# N-Tier API and Angular frontend
$ dotnet add package QuinntyneBrown.DataBuilder.CliA CLI tool for scaffolding full-stack applications with a C# N-Tier API backend and Angular frontend.
DataBuilder (db) is a .NET global tool that generates complete full-stack solutions with CRUD operations based on JSON schema definitions.
C# N-Tier API Backend
Angular Frontend
Schema-Driven Generation
Incremental Development
# Install from NuGet
dotnet tool install --global QuinntyneBrown.DataBuilder.Cli
# Update to latest version
dotnet tool update --global QuinntyneBrown.DataBuilder.Cli
After installation, the db command will be available globally.
# 1. Create a new solution with initial entities
db solution-create --name MyApp --directory ./my-app --json-file entities.json
# 2. Navigate to generated solution
cd my-app/src/MyApp.Api
# 3. Run the API
dotnet run
# 4. In another terminal, run the Angular UI
cd my-app/src/MyApp.Ui
npm install
ng serve
solution-createCreates a new full-stack solution with API and Angular projects.
db solution-create --name MySolution --directory ./my-project
Options:
| Option | Alias | Description | Default |
|---|---|---|---|
--name | -n | Solution name (required) | - |
--directory | -d | Output directory | Current directory |
--json-file | -j | JSON schema file (opens editor if not provided) | - |
--bucket | -b | Couchbase bucket name | general |
--scope | -s | Couchbase scope name | general |
--collection | -c | Couchbase collection name | Entity name |
--use-type-discriminator | - | Use shared collection with type field | false |
model-addAdds a new entity with full CRUD support to an existing solution.
db model-add --json-file product.json
Options:
| Option | Alias | Description | Default |
|---|---|---|---|
--json-file | -j | JSON schema file (opens editor if not provided) | - |
--bucket | -b | Couchbase bucket name | general |
--scope | -s | Couchbase scope name | general |
--collection | -c | Couchbase collection name | Entity name |
--use-type-discriminator | - | Use shared collection with type field | false |
Requirements:
solution-create{
"product": {
"name": "",
"price": 0.0,
"isActive": true
}
}
This generates a Product entity with full CRUD operations on both backend and frontend.
DataBuilder supports nested objects and arrays in your schema. These are rendered as JSON editors in the Angular UI with full dark theme support:
{
"idea": {
"title": "",
"description": "",
"tags": [""],
"customMetadata": {
"key": "value"
}
}
}
tags): Rendered as a JSON editor initialized with []customMetadata): Rendered as a JSON editor initialized with {}The JSON editors support validation, syntax highlighting, and a dark theme that matches the Material Design 3 aesthetic.
The ID field maps directly to Couchbase's Meta.id() (the document key). DataBuilder handles ID fields as follows:
{entityName}Id property (e.g., productId for Product): Used as the ID fieldid property: Used as the ID fieldId property is automatically added// Option 1: Explicit entity ID
{
"product": {
"productId": "",
"name": ""
}
}
// Option 2: Generic ID
{
"product": {
"id": "",
"name": ""
}
}
// Option 3: Auto-generated (Id property added automatically)
{
"product": {
"name": ""
}
}
The ID is always stored as a string and used directly as the Couchbase document key.
DataBuilder supports two storage strategies for Couchbase:
Each entity is stored in its own collection within the specified bucket and scope. This is the default behavior and recommended for most use cases.
# Each entity gets its own collection (e.g., 'product', 'category')
db solution-create -n MyApp -j entities.json -b myBucket -s myScope
Generated structure:
myBucketmyScopeproduct, category (one per entity)All entities share a single collection and use a type field to distinguish between entity types. Useful for simpler setups or when you want all data in one collection.
# All entities in 'general' collection with type discriminator
db solution-create -n MyApp -j entities.json --use-type-discriminator
Generated structure:
generalgeneralgeneral"type": "product" or "type": "category" fieldtype PropertyIf your JSON schema includes a type property on an entity, DataBuilder automatically enables type discrimination for that entity:
{
"product": {
"type": "product",
"name": "",
"price": 0.0
}
}
The type property is removed from the generated entity model (it's handled by the repository layer). This allows per-entity control over storage strategy without using CLI flags.
# Custom bucket and scope, separate collections per entity
db solution-create -n MyApp -j entities.json -b enterprise -s sales
# Custom bucket with type discriminator (all in one collection)
db solution-create -n MyApp -j entities.json -b enterprise -s sales --use-type-discriminator
# Force specific collection name for all entities
db solution-create -n MyApp -j entities.json -b enterprise -s sales -c documents --use-type-discriminator
DataBuilder/
├── src/
│ └── DataBuilder.Cli/ # CLI tool
│ ├── Commands/ # CLI command definitions
│ ├── Generators/
│ │ ├── Api/ # C# API code generator
│ │ └── Angular/ # Angular code generator
│ ├── Models/ # Entity and property definitions
│ ├── Services/ # Schema parsing, solution generation
│ ├── Templates/ # Scriban templates (.sbn)
│ │ ├── Api/ # API templates (Entity, Controller, etc.)
│ │ └── Angular/ # Angular templates (components, services)
│ └── Utilities/ # Naming conventions, type mapping
├── docs/ # Documentation
├── playground/ # Test projects and sample schemas
├── eng/
│ └── scripts/
│ └── install-tool.bat # Build and install CLI tool locally
└── artifacts/ # Generated output examples
| Component | Technology |
|---|---|
| CLI Framework | System.CommandLine |
| Templating | Scriban |
| String Utilities | Humanizer |
| Generated Backend | .NET 9.0, Couchbase, System.Text.Json |
| Generated Frontend | Angular 19, Angular Material, RxJS, Monaco Editor |
| CI/CD | GitHub Actions |
# Build, pack, and install in one step
eng\scripts\install-tool.bat
# Or manually:
dotnet build src/DataBuilder.Cli -c Release
dotnet pack src/DataBuilder.Cli -c Release
dotnet tool install -g QuinntyneBrown.DataBuilder.Cli --add-source src/DataBuilder.Cli/nupkg
The project uses GitHub Actions for continuous integration and deployment:
main that modifies src/DataBuilder.Cli/** triggers a new NuGet release{major}.{minor}.{run_number} format (e.g., 1.0.42)DefaultIgnoreCondition.WhenWritingNullMIT