An open API service indexing awesome lists of open source software.

https://github.com/dvurechensky-tools/dotnetify

Turn any OpenAPI (swagger.json) file into a runnable C# (.NET) backend project in seconds.
https://github.com/dvurechensky-tools/dotnetify

api-generator aspnetcore backend cli code-generation csharp dotnet dvurechensky dvurechenskypro dvurechenskytools nswag openapi roslyn scaffolding swagger swagger-json

Last synced: 4 days ago
JSON representation

Turn any OpenAPI (swagger.json) file into a runnable C# (.NET) backend project in seconds.

Awesome Lists containing this project

README

          

Dotnetify Logo

# Dotnetify

### Turn any OpenAPI (`swagger.json`) file into a runnable C# (.NET) backend project in seconds.






---


🌐 Language:


πŸ‡·πŸ‡Ί Russian

|

βœ… πŸ‡ΊπŸ‡Έ English (current)

---

## Overview

**Dotnetify** is a CLI tool that transforms an OpenAPI / Swagger specification into a fully generated **ASP.NET Core server project**.

Instead of producing raw generator output, Dotnetify builds a **structured, launch-ready backend scaffold** that can be compiled, started, and extended immediately.

It is designed for developers who need a fast backend starting point from an existing API schema.

> [!IMPORTANT]
> Dotnetify focuses on producing a **usable server project**, not just generated source files.

---

## What It Does

Input:

```text
swagger.json
```

Pipeline:

```text
OpenAPI Spec
↓
Code Generation
↓
Roslyn Processing
↓
Project Structuring
↓
Runnable .NET Backend
```

Output:

```text
ProjectName/
β”œβ”€β”€ Controllers/
β”œβ”€β”€ Models/
β”œβ”€β”€ Enums/
β”œβ”€β”€ Common/
β”œβ”€β”€ Program.cs
β”œβ”€β”€ ProjectName.csproj
```

By default, `ProjectName` is `GeneratedApi`. You can override it with `--name`.

---

## Features

| Category | Description |
| ----------------- | -------------------------------------------------------------- |
| OpenAPI Import | Reads `swagger.json` specifications |
| Controllers | Generates API controllers by route groups |
| Models | Generates DTO / entity classes |
| Enums | Generates enums from schema definitions |
| Mock Responses | Auto-generates test responses for endpoints |
| Build Ready | Produces compilable .NET project |
| Run Ready | Can start generated API instantly |
| Swagger UI | Generated server exposes Swagger portal |
| Custom Name | Generates project folders and files with a custom project name |
| Custom Port | Runs generated API on a selected HTTP port with `--port` |
| Roslyn Processing | Cleans and restructures generated code |

---

## Why Dotnetify?

Most generators stop here:

```text
swagger.json β†’ raw generated code
```

Dotnetify continues further:

```text
swagger.json β†’ working backend project
```

That means:

- Faster frontend development
- Faster prototyping
- Easier API testing
- Better reverse engineering workflows
- Immediate backend starting point

---

## Quick Start

Go to the compiled binary:

```bash
cd app\Dotnetify\bin\Debug\net8.0
```

Generate and run:

```bash
Dotnetify.exe generate Input\swagger.json --run
```

Generate with a custom project name:

```bash
Dotnetify.exe generate Input\swagger.json --name MyApi
```

Generate with a custom project name and run it immediately:

```bash
Dotnetify.exe generate Input\swagger.json --name MyApi --run
```

Generate, run, and bind the generated API to a custom HTTP port:

```bash
Dotnetify.exe generate Input\swagger.json --name MyApi --run --port 5103
```

If `--port` is not provided, Dotnetify uses port `5000`.

This creates:

```text
Output/MyApi/MyApi.csproj
```

Example output:

```text
[Dotnetify] Running: Roslyn Split Processor
[Dotnetify] Running: Dotnet Project Processor
[Dotnetify] Running: Package Resolve Processor

Generation complete.
Starting server...
Started PID: 29296

Swagger: http://localhost:5000/swagger
```

With a custom port:

```text
Started PID: 29296
Swagger: http://localhost:5103/swagger
```

---

## Use Cases

### Frontend Teams

Need backend before real backend exists.

### QA / API Testing

Generate local API from schema instantly.

### Legacy Systems

Recreate documented APIs into editable .NET projects.

### Startups / MVP

Launch backend prototype rapidly.

---

## Example Result

Generated controller:

```csharp
[HttpGet("inventory")]
public Task> GetInventory()
{
var response = new Dictionary
{
{ "test", 1 }
};

return Task.FromResult>(response);
}
```

---

## Philosophy

Dotnetify does **not** aim to replace real backend engineering.

It aims to eliminate the empty starting phase.

Instead of spending hours scaffolding:

- controllers
- DTOs
- routes
- startup boilerplate
- fake data

You start with all of it already generated.

---

## Roadmap

Planned future improvements:

- Database scaffolding
- Repository generation
- React admin panel generation
- Authentication templates
- Docker support
- CI/CD templates
- Multiple architecture modes

---

## Current Status

> Active development

Core generation pipeline is already functional and produces runnable projects.

---

## Tech Stack

- C#
- .NET
- ASP.NET Core
- Roslyn
- NSwag