Skip to content

Repository files navigation

✅ Todo CRUD API (.NET 8 + EF Core + SQLite)

A minimal RESTful API for managing todo items using ASP.NET Core Minimal APIs, Entity Framework Core, and SQLite.


🚀 Features

  • Create, Read, Delete Todo items
  • Uses Entity Framework Core for persistence
  • SQLite as lightweight database
  • Clean and minimal code structure
  • Auto-migration support on startup

🛠️ Tech Stack


📦 Getting Started

🔧 How to Run This Project

Follow these steps to run the project on your local machine:

  1. Clone the Repository
git clone https://github.com/yourusername/todo-minimal-api.git
cd todo-minimal-api
  1. Install EF Core CLI (if not installed)
dotnet tool install --global dotnet-ef
  1. Restore Project Dependencies
dotnet restore
  1. Apply Database Migrations
dotnet ef migrations add InitialCreate

Then apply the migration:

dotnet ef database update

⚠️ If the migration already exists, you can skip the add InitialCreate step.

  1. Run the API
dotnet run

The app will start on http://localhost:5000 or another port shown in your terminal.


📬 API Endpoints

Method Endpoint Description
GET / Get all todos
GET /todo/{id} Get a todo by ID
POST /todo Create a new todo
DELETE /todo/{id} Delete a todo by ID

🗃️ Sample Todo Model

{
  "id": 1,
  "name": "Finish .NET API",
  "duedate": "2025-04-01T00:00:00",
  "isComplete": false
}

📁 Project Structure

📁 TodoCRUD/
├── Program.cs              # Minimal API and endpoints
├── Todo.cs                 # Model class
├── TodoDbContext.cs        # EF Core DB context
├── Migrations/             # EF Core migration files
└── README.md               # Project documentation

✅ To Do / Improvements

  • Add update (PUT/PATCH) endpoint
  • Add input validation
  • Add unit tests

🤝 License

MIT License. Use freely in your own projects!


✨ Credits

Created by Asela Priyadarshana

About

A minimal .NET 8 Web API for managing todo items using ASP.NET Core, Entity Framework Core, and SQLite. Includes auto-migrations and clean CRUD endpoints.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Used by

Contributors

Languages