Skip to content

A Python-based project demonstrating the principles of Hexagonal Architecture (Ports and Adapters) and Domain-Driven Design (DDD). This repository showcases how to design clean, maintainable, and scalable applications by emphasizing domain logic, decoupling dependencies, and enabling testability.

Notifications You must be signed in to change notification settings

HieuTranV/python-hexagonal-ddd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Hexagonal DDD

Table of Contents

Introduction

This project demonstrates the principles of Hexagonal Architecture (Ports and Adapters) and Domain-Driven Design (DDD) using Python. It showcases how to design clean, maintainable, and scalable applications by focusing on domain logic, decoupling dependencies, and enhancing testability.

Installation

To install the core services, clone the repository and install the dependencies:

git clone https://github.com/HieuTranV/python-hexagonal-ddd.git
pip install -r requirements.txt

Usage

Before starting or testing, ensure that the necessary environment variables are loaded. You can do this by sourcing the .env.demo file:

source .env.demo

To test the services:

  1. Ensure that all dependencies are installed as per the Installation section.
  2. Set the PYTHONPATH environment variable to include the current directory:
export PYTHONPATH="$PYTHONPATH:$pwd"
  1. Run the tests using pytest:
pytest

To start the services, use the following command:

uvicorn src.main:app --host 0.0.0.0 --port 8080

This command will start the application using Uvicorn, an ASGI server for Python web applications. The --host 0.0.0.0 option makes the server accessible externally, and --port 8080 specifies the port on which the server will listen.

The services will be available at http://localhost:8080.

About

A Python-based project demonstrating the principles of Hexagonal Architecture (Ports and Adapters) and Domain-Driven Design (DDD). This repository showcases how to design clean, maintainable, and scalable applications by emphasizing domain logic, decoupling dependencies, and enabling testability.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages