Skip to content

mofalih64/asp-net-docker-restful

Repository files navigation

🚀 ASP.NET Core RESTful API Skeleton

A lightweight starter template for building production-ready RESTful APIs with ASP.NET Core 9, including:

  • ✅ Entity Framework Core + PostgreSQL (done)
  • ✅ Authentication & RBAC Authorization (JWT-ready structure) (in progress)
  • ✅ Request Validation using FluentValidation (in progress)
  • ✅ Simple CRUD controller example (done)
  • ✅ Dockerfile + Docker Compose (backend + Postgres + pgAdmin) (done)
  • ✅ clean structure ready to extend (in progress)

📦 Features Included

🔹 RESTful API Structure

Basic CRUD controller to demonstrate routing, DTOs, models, and service structure.

🔹 FluentValidation

Centralized validation for incoming API requests.

🔹 Authentication & Authorization

Skeleton structure to plug in:

  • JWT tokens
  • Admin/user roles
  • Auth middleware

🔹 Docker Support

Runs using Docker Compose with:

  • Backend service
  • PostgreSQL database
  • pgAdmin for DB management

🚀 Running the Project

Local (without Docker)

dotnet restore
dotnet ef database update
dotnet run

With Docker Compose

docker compose up --build

Backend runs on: http://localhost:8080
Postgres on: localhost:5433 (or 5432 inside Docker)
pgAdmin on: http://localhost:3060

🗄️ Database Configuration

Configured via appsettings.json or environment variables:

Host=database;Port=5432;Database=library_db;Username=library_user;Password=library_password;

📁 Project Structure

/Controllers      → API endpoints
/Models           → Entities
/Data             → DbContext
/Validators       → FluentValidation
/Auth             → Auth logic structure
Dockerfile
docker-compose.yml

🤝 Purpose of This Repo

This repository serves as a clean skeleton to start any ASP.NET Core backend project with:

  • Auth/authz foundations
  • Validation
  • Dockerized environment
  • CRUD examples
  • EF Core setup

You can clone it as a starting point for new services or learning.

📋 What I Can Generate For You

  • ✅ A clean app structure
  • ✅ Recommended folder structure
  • ✅ Auth/login/register implementation
  • ✅ Ready-to-use JWT logic
  • ✅ Ready-to-use migrations setup and db connections
  • ✅ Ready-to-use docker and docker compose setup

Just tell me!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors