| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A powerful .NET tool designed to streamline backend API development by automatically generating controllers with CRUD endpoints for your entities. Build production-ready APIs in minutes, not hours.
Dappi consists of three main components working together to provide a complete API development solution:
Get up and running with Dappi in under 5 minutes:
# Install the CLI tool
dotnet tool install --global Dappi.Cli --prerelease
# Create a new project
dappi init --name MyApi --path ./MyApi --use-prerelease
# Navigate to your project
cd MyApi
# Configure your database connection in appsettings.json
# Then start your API
dappi startNote: Currently all Dappi packages are in preview. Once stable versions are released, you can omit the --prerelease flag.
dotnet tool install --global Dappi.Cli --prereleaseAdd the source generator to your existing project:
<PackageReference Include="Dappi.SourceGenerator" Version="*-*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>Or use the CLI:
dotnet add package Dappi.SourceGenerator --prereleasedotnet add package Dappi.HeadlessCms --prereleaseThe Headless CMS package provides additional content management capabilities for your Dappi-generated APIs.
Note: All packages are currently in preview. The --prerelease flag will be unnecessary once stable versions are available.
dappi init --name <PROJECT-NAME> --path <OUTPUT-DIRECTORY> --use-prereleaseCreates a new Dappi project with all necessary boilerplate code.
dappi startStarts your API server with hot reload enabled.
Define your entities using the [CCController] attribute to automatically generate CRUD controllers:
using Dappi.SourceGenerator;
[CCController]
public class Book
{
public int Id { get; set; }
public string Title { get; set; }
public string Author { get; set; }
public DateTime PublishedDate { get; set; }
public decimal Price { get; set; }
}This automatically generates a controller accessible at /api/book/ with the following endpoints:
[CCController]
public class Book
{
public int Id { get; set; }
public string Title { get; set; }
public string Author { get; set; }
public string ISBN { get; set; }
public DateTime PublishedDate { get; set; }
public decimal Price { get; set; }
public bool IsAvailable { get; set; }
}[CCController]
public class Product
{
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string SKU { get; set; }
public decimal Price { get; set; }
public int StockQuantity { get; set; }
public string Category { get; set; }
public string[] Tags { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
}# Get all books with pagination
GET /api/book?page=1&pageSize=10
# Filter books by author
GET /api/book?author=Tolkien
# Sort books by price (descending)
GET /api/book?sortBy=price&sortOrder=desc
# Create a new book
POST /api/book
{
"title": "The Hobbit",
"author": "J.R.R. Tolkien",
"isbn": "978-0547928227",
"publishedDate": "1937-09-21T00:00:00Z",
"price": 12.99,
"isAvailable": true
}Configure your PostgreSQL connection in appsettings.json:
{
"Dappi": {
"PostgresConnection": "Host=localhost;Database=myapi;Username=postgres;Password=password"
}
}Filter by any property of your entity:
# Single filter
GET /api/book?author=Tolkien
# Multiple filters
GET /api/book?author=Tolkien&isAvailable=true
# Date range filtering
GET /api/book?publishedDate>=2020-01-01&publishedDate<=2023-12-31Efficient pagination with customizable page sizes:
# Basic pagination
GET /api/book?page=1&pageSize=10
# Large result sets
GET /api/book?page=5&pageSize=50Sort by any field in ascending or descending order:
# Sort by title (ascending)
GET /api/book?sortBy=title
# Sort by price (descending)
GET /api/book?sortBy=price&sortOrder=desc
# Multiple sort criteria
GET /api/book?sortBy=author,publishedDate&sortOrder=asc,descThe CCUI.Dappi Angular project provides a modern web interface for managing your Dappi-generated APIs:
To work with the Angular UI:
# Navigate to the Angular project
cd CCUI.Dappi
# Install dependencies
npm install
# Start development server
npm start
# Build for production
npm run buildWe welcome contributions from the community! Whether you're fixing bugs, improving documentation, or adding new features, we appreciate your help.
Follow these steps to set up the project locally for development.
git clone https://github.com/codechem/dappi.git
cd dappiMake sure you have the following installed on your machine:
💡 Recommended: run PostgreSQL in a Docker container (see step 3)
💡 Recommended Node.js version: 16+
To quickly set up a PostgreSQL instance using Docker, run:
docker run --name DappiPostgres -d \
-p 5432:5432 \
-e POSTGRES_PASSWORD=admin \
-e POSTGRES_USER=postgres \
postgres:alpineThis will:
You can connect to this database using your app or a tool like DBeaver with:
Restore and build the .NET solution:
cd templates/MyCompany.MyProject.WebApi/
dotnet restore
dotnet buildCreate migrations and update the database:
dotnet ef migrations add initial
dotnet ef database updateStart the application
dotnet runIf you're contributing to the UI part of the project:
cd CCUI.DAPPI
npm install
npm run start:devIf you have questions or need guidance:
Thank you for helping improve DAPPI! 🚀
| Back | FazBrowse Home | New Git URL |