🚀

Creating a REST API with DDD

May 16, 2025

Building a REST API with Clean Architecture and Domain-Driven Design

Introduction

  • Series on building a web API from scratch.
  • Focus on Clean Architecture and Domain-Driven Design.
  • Product: Dinner hosting platform (similar to Uber/Airbnb).

Lecture Overview

  • Videos are self-contained.
  • Introduction to the product and setup project.
  • Concepts: Clean Architecture, Domain Driven Design (DDD).
  • Initial project setup includes authentication.

Product Concept

  • Dinner hosting platform: turn your home into a restaurant.
  • Similar concepts to Uber and Airbnb.
  • Consideration of data structures: title, description, pictures, etc.

Clean Architecture

  • Core concepts: domain at the center with infrastructure on the outside.
  • Replaceable infrastructure without altering core logic.
  • Jason Taylor’s Clean Architecture model used.
  • Core components: Domain, Application, Infrastructure, API.

Tools and Libraries

  • Libraries: Mapster, Mediator, Fluent Validation, etc.
  • Concepts: CQRS, Repository, Unit of Work.
  • IDE: Visual Studio Code with .NET ecosystem.
  • CLI tools and commands for setup and development.

Setting Up the Solution

  • Creation of solution and projects (API, Contracts, Infrastructure, Application, Domain).
  • .NET CLI used for project setup.
  • Dependency management between projects.

Development Environment

  • Use of Visual Studio Code.
  • REST client extension for HTTP requests.
  • Setting up requests: Register and Login endpoints.

API Development

  • Defined Register and Login endpoints.
  • Use of dependency injection for services.
  • Implemented Authentication service in the Application layer.

Dependency Injection

  • Separation of dependencies for each layer.
  • Application and Infrastructure layers handle their own dependencies.

Code Cleanup

  • Removed unnecessary code from templates.
  • Built a minimal startup configuration.

Project Execution

  • Built and ran the project successfully.
  • Tested endpoints using REST client.
  • Configuration of HTTP request templates.

Future Videos

  • Introduction of JWT token generator and password hasher.
  • Separation of concerns between Application and Infrastructure layers.

Conclusion

  • Emphasis on educational content.
  • Encouragement to follow along with the series.
  • Acknowledgment of contributors and thanks to viewers.

Additional Notes

  • Visual infographics available on LinkedIn and Twitter.
  • Source code available on Patreon.