craftsman
A .NET scaffolding tool to help you stop worrying about boilerplate and focus on your business logic ๐
Top Related Projects
๐ A lightweight, framework-agnostic database migration tool.
Swagger 2.0 implementation for go
Infinite Red's battle-tested React Native project boilerplate, along with a CLI, component/model generators, and more! 9 years of continuous development and counting.
The simple, fast, and scalable code generator that lives in your project.
Quick Overview
Craftsman is a .NET scaffolding tool designed to streamline the process of creating and maintaining .NET projects, particularly those following Clean Architecture principles. It automates the generation of boilerplate code, API endpoints, and database migrations, allowing developers to focus on core business logic.
Pros
- Accelerates development by generating consistent, well-structured code
- Supports Clean Architecture and Domain-Driven Design principles out of the box
- Offers customizable templates to fit specific project needs
- Integrates well with popular .NET libraries and frameworks
Cons
- Learning curve for developers unfamiliar with the tool's conventions
- May generate more code than necessary for simple projects
- Limited flexibility for projects with unconventional architectures
- Requires regular updates to keep up with changes in .NET ecosystem
Code Examples
- Creating a new API project:
craftsman new api MyAwesomeApi
This command generates a new API project with the name "MyAwesomeApi" using Craftsman's default template.
- Adding a new entity to an existing project:
craftsman add entity Product -n "Name" -n "Description" -n "Price:decimal"
This command adds a new "Product" entity with "Name", "Description", and "Price" properties to the project.
- Generating database migrations:
craftsman add migration "InitialMigration"
This command creates a new database migration named "InitialMigration" based on the current entity models.
Getting Started
To get started with Craftsman, follow these steps:
-
Install the Craftsman CLI tool:
dotnet tool install -g craftsman
-
Create a new API project:
craftsman new api MyProject
-
Navigate to the project directory and run the API:
cd MyProject/MyProject dotnet run
This will create a new API project, set up the necessary files and folders, and start the API server.
Competitor Comparisons
๐ A lightweight, framework-agnostic database migration tool.
Pros of dbmate
- Language-agnostic database migration tool, supporting multiple databases
- Simple CLI interface for easy integration into various workflows
- Supports both SQL and Go-based migrations
Cons of dbmate
- Limited to database migrations, lacking broader application scaffolding features
- Doesn't provide code generation capabilities for other parts of the application
- Less opinionated about project structure compared to Craftsman
Code Comparison
dbmate migration example:
-- migrate:up
CREATE TABLE users (
id INTEGER PRIMARY KEY,
name VARCHAR(255),
email VARCHAR(255) NOT NULL
);
-- migrate:down
DROP TABLE users;
Craftsman entity example:
public class User : BaseEntity
{
public string Name { get; set; }
public string Email { get; set; }
}
Summary
dbmate is a focused database migration tool that works across multiple languages and databases. It excels in simplicity and flexibility for managing database schemas. Craftsman, on the other hand, is a more comprehensive solution for .NET projects, offering full application scaffolding and code generation beyond just database migrations. While dbmate provides a straightforward approach to database management, Craftsman offers a more opinionated and feature-rich experience for .NET developers looking to quickly bootstrap entire applications.
Swagger 2.0 implementation for go
Pros of go-swagger
- Mature and widely adopted project with extensive documentation
- Supports generating server stubs and client SDKs from Swagger/OpenAPI specs
- Offers a CLI tool for easy integration into development workflows
Cons of go-swagger
- Limited to Go language, while Craftsman supports multiple languages
- Focuses primarily on API development, whereas Craftsman offers broader project scaffolding
- Steeper learning curve for developers new to Swagger/OpenAPI specifications
Code Comparison
go-swagger example:
swagger generate server -f ./swagger.yaml -A myapp
Craftsman example:
craftsman new api MyApi
Key Differences
- go-swagger is specifically designed for Swagger/OpenAPI-based API development in Go
- Craftsman is a more general-purpose project scaffolding tool supporting multiple languages and frameworks
- go-swagger generates code from existing Swagger/OpenAPI specs, while Craftsman creates new project structures based on user input
Use Cases
- Choose go-swagger for Go-based API projects with existing Swagger/OpenAPI specifications
- Opt for Craftsman when starting new projects in various languages or requiring more comprehensive scaffolding
Infinite Red's battle-tested React Native project boilerplate, along with a CLI, component/model generators, and more! 9 years of continuous development and counting.
Pros of Ignite
- Broader ecosystem support, including React Native and mobile app development
- More extensive documentation and community resources
- Longer project history and larger user base
Cons of Ignite
- Less focused on backend development compared to Craftsman
- May have a steeper learning curve for developers new to React Native
- Not specifically tailored for .NET development
Code Comparison
Ignite CLI command:
ignite new MyAwesomeApp
Craftsman CLI command:
craftsman new api MyAwesomeApi
Key Differences
- Focus: Ignite is primarily for React Native app development, while Craftsman specializes in .NET API development
- Language: Ignite uses JavaScript/TypeScript, Craftsman uses C#
- Target Audience: Ignite caters to mobile app developers, Craftsman targets backend developers
- Customization: Craftsman offers more fine-grained control over API structure and features
- Ecosystem: Ignite has a larger ecosystem of plugins and extensions
Conclusion
Both Ignite and Craftsman are valuable tools for their respective domains. Ignite excels in React Native development with a rich ecosystem, while Craftsman provides a more specialized solution for .NET API development with detailed customization options. The choice between them depends on the specific project requirements and the developer's preferred technology stack.
The simple, fast, and scalable code generator that lives in your project.
Pros of Hygen
- Language-agnostic and can be used with various programming languages and frameworks
- Highly customizable with a flexible templating system
- Supports interactive prompts for dynamic code generation
Cons of Hygen
- Requires more setup and configuration for specific project structures
- Less opinionated, which may lead to inconsistencies across projects
- Steeper learning curve for creating custom templates
Code Comparison
Hygen template example:
---
to: app/models/<%= name %>.js
---
const <%= Name %> = {
name: '<%= name %>',
// Add more properties here
}
module.exports = <%= Name %>
Craftsman template example:
public class <%= entity.Name %>
{
public Guid Id { get; set; }
// Add more properties here
}
Both tools use similar templating syntax, but Craftsman is more focused on .NET-specific code generation, while Hygen offers a more generic approach suitable for various languages and frameworks.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Craftsman Scaffolds Your Boilerplate!
Craftsman is the workhorse behind the Wrapt framework and provides a suite of CLI commands for quickly scaffolding out new files and projects for your .NET Web APIs with simple CLI commands and configuration files.
Quickstart
- Make sure you have the .NET 8 SDK installed, along with EF Core
- Install the craftsman tool
dotnet tool install -g craftsman
- Spin up an example project
craftsman new example MyFirstProject
Documentation
For all the documentation on how to use Craftsman, visit wrapt.dev.
Upcoming Features
You can find some highlights below. I have some reminement items in the pipe and I'm working through a deep example project the really dogfood things and will be making updates around my finding from there.
Have a request for something you don't see in the project? Join our discord and let's talk about it!
Some 0.26 highlights
รขยย Primary Constructors
รขยย Updated API Versioning
Some 0.25 highlights
รขยย .NET 8 scaffolding
รขยย Archicture test enhancement
รขยย Remove obsolete BFF commands
รขยย Fix test actions
Some 0.24 highlights
รขยย Logging enhancements and masking
รขยย Dependabot and Github Actions for tests
รขยย
string[]
support for Postgres
รขยย Value Object property scaffolding
Some 0.23 highlights
รขยย Moq -> NSub
รขยย
New GetAll
feature
รขยย Hangfire scaffolding
Some 0.22 highlights
รขยย Move from Sieve to QueryKit
รขยย TestContainers updated
รขยย Records for queries and commands and DTOs
รขยย Relationships overhaul
Some 0.21 highlights
รขยย New default error handler middleware (existing still optional)
รขยย Mapster -> Mapperly
Some 0.20 highlights
รขยย Intermediate model to not pass DTOs to domain
รขยย Specification support
Some 0.19 highlights
รขยย Test projects updated to use XUnit
รขยย .NET 7
รขยย Integration tests have better service collection scoping and now have a service collection per test. This makes service mocking possible without clashing with other tests
รขยย Options Pattern Configuration
Some 0.18 highlights
รขยย Environment Service
รขยย Built in Migrations
รขยย Various testing and other improvements
Some 0.17 highlights
รขยย Users and Roles managed in each boundary (AuthN still separate)
รขยย
New Email
Value Object
รขยย Functional Tests use Docker DB and has other cleanup items
รขยย NextJS template (still a WIP and not documented, but you can find the sandbox for things here and poke through the Craftsman code if you'd like. Can answer questions in out Discord as well.)
Some v0.16 highlights
รขยย Testing Optimizations
รขยย Common Value Object Scaffolding
รขยย Auth Server rewrite with Keycloak
รขยย Move permission guards to feature
รขยย
Migrate Automapper
to Mapster
Some v0.15 highlights
รขยย Updated CLI command structure
รขยย OpenTelemetry & Jaeger Tracing
รขยย Built in Domain Event support (with unit test scaffolding)
รขยย
Moved to Program.cs
only format
รขยย Added repository & unit of work abstractions for better testing and validation
รขยย SmartEnum property scaffolding support
Some v0.14 highlights
รขยย Duende BFF scaffolding
รขยย React scaffolding
รขยย Dockerfile and Docker Compose scaffolding
Some v0.13 highlights
รขยย DDD promoted entities (private setters, factory methods, associated fakers)
รขยย Huge permissions upgrade. Significantly simplified setup which resulted in a new library (HeimGuard) that can be used in any .NET project.
รขยย
New register:producer
command
รขยย Added soft delete capability
รขยย Added Shared Kernel
Some v0.12 highlights
รขยย .NET 6 Scaffolding
รขยย Docker utility updates for integration tests using Fluent Docker รฐยยยณ
รขยย
add:feature
enhancement to add more than just ad-hoc features
รขยย
new:example
command to generate example projects with associated templates
รขยย Auth Server Scaffolding (In-Memory)
รขยย Auditable entities
Support
If Wrapt and Craftsman are saving you time and helping your projects, consider sponsoring me on Github to support ongoing Wrapt development and make it even better!
Contributing
Time is of the essence. Before developing a Pull Request I recommend opening a new topic for discussion. I also haven't had enough PR interest to take the time and put together a contributing.md
, but if you are interested, I will definitely put together a detailed writeup.
Contact Me
Sometimes Github notifications get lost in the shuffle. If you file an issue and don't hear from me in 24-48 hours feel free to ping me on twitter or Discord (pdevito3#4244). We also have own discord channel now for easy contact with me and larger community discussions!
Top Related Projects
๐ A lightweight, framework-agnostic database migration tool.
Swagger 2.0 implementation for go
Infinite Red's battle-tested React Native project boilerplate, along with a CLI, component/model generators, and more! 9 years of continuous development and counting.
The simple, fast, and scalable code generator that lives in your project.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot