npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dinocsharp

v1.0.6

Published

CLI tool to generate C# Controller structure using Plop

Readme

DinoCSharp 🦕

npm version License: MIT

A powerful CLI tool to generate C# Controller structures with CRUD operations, DTOs, Services, and Templates using Plop.js.

Features

  • 🚀 Generate complete C# Controller structure
  • 📁 Support for multiple roles (Admin, User)
  • 🎯 Customizable namespaces and output paths
  • 📄 Auto-generate DTOs, Services, and Templates
  • 🔧 Batch generation from JSON config
  • 💼 TypeScript support
  • 🎨 Beautiful CLI interface with Chalk

Installation

Global Installation

npm install -g dinocsharp

Local Installation

npm install dinocsharp

Usage

Interactive Mode

dinocsharp

Batch Mode with Config File

dinocsharp --multiple

Configuration

Create a controllers-config.json file:

{
  "namespace": "YourApp.API",
  "outputPath": "./Controllers",
  "defaultRoles": ["Admin", "User"],
  "controllers": [
    {
      "name": "Product",
      "roles": ["Admin", "User"]
    },
    {
      "name": "Category",
      "roles": ["Admin"]
    }
  ]
}

Generated Structure

Controllers/
├── Products/
│   ├── Admin/
│   │   ├── ProductsController.cs
│   │   ├── ProductsDTO.cs
│   │   ├── ProductsService.cs
│   │   └── ProductsTemplate.cs
│   └── User/
│       ├── ProductsController.cs
│       ├── ProductsDTO.cs
│       ├── ProductsService.cs
│       └── ProductsTemplate.cs

Templates

The CLI generates the following files for each controller:

  • Controller: API endpoints with CRUD operations
  • DTO: Data Transfer Objects for View, Create, Edit, Key
  • Service: Business logic layer
  • Template: Configuration template

Available Generators

  1. single-controller: Generate a single controller with roles
  2. batch-controller: Generate multiple controllers from config file
  3. preset-admin-user: Quick preset for Admin and User roles

Examples

Single Controller Generation

# Run interactive mode
dinocsharp

# Follow the prompts:
# ? Controller name: Product
# ? Namespace: MyShop.API
# ? Output path: ./Controllers
# ? Select roles: Admin, User

Generated files:

Controllers/
├── Products/
│   ├── Admin/
│   │   ├── ProductsController.cs
│   │   ├── ProductsDTO.cs
│   │   ├── ProductsService.cs
│   │   └── ProductsTemplate.cs
│   └── User/
│       ├── ProductsController.cs
│       ├── ProductsDTO.cs
│       ├── ProductsService.cs
│       └── ProductsTemplate.cs

Batch Generation with Config File

Create controllers-config.json:

{
  "namespace": "ECommerce.API",
  "outputPath": "./src/Controllers",
  "defaultRoles": ["Admin", "User", "Manager"],
  "controllers": [
    {
      "name": "Product",
      "roles": ["Admin", "User", "Manager"]
    },
    {
      "name": "Category", 
      "roles": ["Admin", "Manager"]
    },
    {
      "name": "Order",
      "roles": ["Admin", "User"]
    },
    {
      "name": "User",
      "roles": ["Admin"]
    }
  ]
}

Run batch generation:

dinocsharp --multiple

Generated structure:

src/Controllers/
├── Products/
│   ├── Admin/
│   │   ├── ProductsController.cs
│   │   ├── ProductsDTO.cs
│   │   ├── ProductsService.cs
│   │   └── ProductsTemplate.cs
│   ├── User/
│   │   └── [same files...]
│   └── Manager/
│       └── [same files...]
├── Categories/
│   ├── Admin/
│   │   └── [same files...]
│   └── Manager/
│       └── [same files...]
├── Orders/
│   ├── Admin/
│   │   └── [same files...]
│   └── User/
│       └── [same files...]
└── Users/
    └── Admin/
        └── [same files...]

Generated Code Examples

Controller Example

// ProductsController.cs (Admin role)
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;

namespace ECommerce.API.Controllers.Products.Admin
{
    [ApiController]
    [Route("api/admin/products")]
    [Authorize(Roles = "Admin")]
    public class ProductsController : ControllerBase
    {
        private readonly ProductsService _service;

        public ProductsController(ProductsService service)
        {
            _service = service;
        }

        [HttpGet]
        public async Task<ActionResult<IEnumerable<ProductViewDTO>>> GetAll()
        {
            var result = await _service.GetAllAsync();
            return Ok(result);
        }

        [HttpGet("{id}")]
        public async Task<ActionResult<ProductViewDTO>> GetById(int id)
        {
            var result = await _service.GetByIdAsync(id);
            return result != null ? Ok(result) : NotFound();
        }

        [HttpPost]
        public async Task<ActionResult<ProductViewDTO>> Create([FromBody] ProductCreateDTO dto)
        {
            var result = await _service.CreateAsync(dto);
            return CreatedAtAction(nameof(GetById), new { id = result.Id }, result);
        }

        [HttpPut("{id}")]
        public async Task<ActionResult<ProductViewDTO>> Update(int id, [FromBody] ProductEditDTO dto)
        {
            var result = await _service.UpdateAsync(id, dto);
            return result != null ? Ok(result) : NotFound();
        }

        [HttpDelete("{id}")]
        public async Task<ActionResult> Delete(int id)
        {
            var success = await _service.DeleteAsync(id);
            return success ? NoContent() : NotFound();
        }
    }
}

DTO Example

// ProductsDTO.cs
namespace ECommerce.API.Controllers.Products.Admin
{
    public class ProductViewDTO
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public string Description { get; set; }
        public decimal Price { get; set; }
        public DateTime CreatedAt { get; set; }
        public DateTime UpdatedAt { get; set; }
    }

    public class ProductCreateDTO
    {
        public string Name { get; set; }
        public string Description { get; set; }
        public decimal Price { get; set; }
    }

    public class ProductEditDTO
    {
        public string Name { get; set; }
        public string Description { get; set; }
        public decimal Price { get; set; }
    }

    public class ProductKeyDTO
    {
        public int Id { get; set; }
    }
}

Command Line Options

# Interactive mode (default)
dinocsharp

# Batch mode with default config file
dinocsharp --multiple

# Batch mode with custom config file
dinocsharp --multiple --config=./my-config.json

# Help
dinocsharp --help

# Version
dinocsharp --version

Advanced Usage

Custom Namespace Structure

{
  "namespace": "MyCompany.ProjectName.WebAPI",
  "outputPath": "./src/Areas/API/Controllers",
  "defaultRoles": ["SuperAdmin", "Admin", "User", "Guest"],
  "controllers": [
    {
      "name": "Product",
      "roles": ["SuperAdmin", "Admin", "User"]
    }
  ]
}

Role-Based Access Examples

# Generate controller for specific roles only
# When prompted, select only needed roles:
# ? Select roles: SuperAdmin, Admin (deselect User, Guest)

Integration with ASP.NET Core Project

# Navigate to your ASP.NET Core project
cd MyWebAPI

# Generate controllers in the correct location
dinocsharp
# ? Output path: ./Controllers
# ? Namespace: MyWebAPI.Controllers

Tips & Best Practices

  1. Consistent Naming: Use PascalCase for controller names (Product, UserProfile, OrderItem)

  2. Namespace Convention: Follow your project's namespace structure

    "namespace": "CompanyName.ProjectName.API"
  3. Role Management: Plan your roles before generation

    "defaultRoles": ["Admin", "Manager", "User", "Guest"]
  4. Output Structure: Organize by feature

    Controllers/
    ├── Products/     # Product management
    ├── Orders/       # Order management  
    └── Users/        # User management
  5. Batch Processing: Use config files for multiple controllers

    # Create controllers-config.json first, then:
    dinocsharp --multiple