DEV Community

Moh Ali
Moh Ali

Posted on

Introducing dotblaze

DotBlaze

Why I built this

I love .NET. It is fast, the tooling is excellent, and C# keeps getting better every year.

But every time I started a new web project, I missed Laravel. Not PHP itself, but the feeling of php artisan make:model, an expressive ORM, auth that works in five minutes, and queues that just run.

In ASP.NET Core, all the pieces exist. They are just scattered. You wire up EF Core, pick an auth approach, choose a background job library, add a frontend story, and glue it all together yourself. By the time the plumbing is done, the excitement for the actual idea is gone.

So I built dotblaze: an open-source web framework that brings Laravel's developer experience to .NET.

What is dotblaze?

dotblaze is a full-stack web framework for .NET, inspired by Laravel. It is not a port of Laravel. It is built on solid .NET foundations, with a Laravel-style API on top.

Out of the box you get:

  • Expressive models in the spirit of Eloquent, configured with attributes
  • Auth scaffolding in the style of Laravel Breeze: login, register and password reset you can read and edit
  • Queues and jobs for background work
  • Notifications across channels like email
  • Multi-database support
  • Live components inspired by Livewire, with Tailwind CSS and Alpine.js for the frontend

Quick start

Getting a new app running takes a few commands:

dotnet new install DotBlaze
dotnet new dotblaze -n MyApp
cd MyApp
dotnet run
Enter fullscreen mode Exit fullscreen mode

Open the browser and you have a working app with auth, a layout built on Tailwind, and a sample component.

A quick tour

Models that feel like Eloquent

Models are plain C# classes. Attributes describe the table and relationships, so there is no separate configuration file to keep in sync.

[Table("posts")]
public class Post : Model<Post>
{
    public string Title { get; set; }
    public string Body { get; set; }

    [BelongsTo]
    public User Author { get; set; }
}

var posts = await Post.Where(p => p.Published)
    .OrderByDesc(p => p.CreatedAt)
    .Take(10)
    .GetAsync();
Enter fullscreen mode Exit fullscreen mode

Auth you can actually read

Instead of a black box, dotblaze generates auth the way Laravel Breeze does: controllers and views live in your project. Want to change the register flow? Open the file and edit it.

Queues and jobs

Slow work goes into a job and runs in the background.

public class SendWelcomeEmail : Job
{
    public int UserId { get; set; }

    public override async Task Handle(Mailer mailer)
    {
        var user = await User.FindAsync(UserId);
        await mailer.To(user.Email).SendAsync(new WelcomeMail(user));
    }
}

await Dispatch(new SendWelcomeEmail { UserId = user.Id });
Enter fullscreen mode Exit fullscreen mode

Live components

Inspired by Livewire, components keep their state on the server and update the page without you writing JavaScript. Alpine.js handles the small client-side touches.

public class Counter : Component
{
    public int Count { get; set; }

    public void Increment() => Count++;
}
Enter fullscreen mode Exit fullscreen mode
<div>
    <span>@Count</span>
    <button blaze:click="Increment">+</button>
</div>
Enter fullscreen mode Exit fullscreen mode

A few design decisions

Build on .NET, don't fight it. dotblaze uses proven .NET building blocks underneath. The Laravel feel comes from the API on top, so you keep .NET's performance and ecosystem.

Breeze-style auth over ASP.NET Identity. Identity is powerful, but for most apps it is more than you need and hard to customize. Generated, readable auth code is easier to own.

Attributes over configuration files. Everything about a model lives in one place: the class itself.

Where it stands

dotblaze is in early preview. The core works and I'm using it on my own projects, but the API may still change before 1.0. I'd rather share it now and shape it with real feedback than polish it alone for another year.

Try it and tell me what you think

If this sounds useful, a star on GitHub helps a lot. Issues, ideas and pull requests are very welcome. Issues labeled good first issue are a good place to start.

I'm especially curious about one thing: if you've used both Laravel and ASP.NET Core, what do you miss most when switching between them? Let me know in the comments.

Top comments (0)