Skip to content

ojhanik/assistant

Repository files navigation

Hexagonal Architecture API

This project implements a FastAPI application using the Hexagonal Architecture (Ports and Adapters) pattern.

Project Structure

project/
├── constants/           # Constants, enums, schema definitions
├── domains/             # Business domains
│   └── domain_name/     # Specific domain
│       ├── application/ # Incoming ports/adapters (controllers)
│       ├── core/        # Domain logic & outgoing ports (interfaces)
│       │   ├── model/   # Domain models and entities
│       │   └── port/    # Interface definitions
│       │       ├── incoming/ # Incoming ports (use cases/services)
│       │       └── outgoing/ # Outgoing ports (repositories/clients)
│       ├── domain_infrastructure/ # Outgoing adapters (implementations)
│       └── deployment/  # Deployment configuration
│       └── router.py    # Domain API routes
├── infrastructure/      # Technical adapters (DB, external APIs)
├── utils/               # Shared utilities (logging, error handling)
│   ├── common_utils.py  # Common utility functions
│   ├── exception.py     # Exception handling classes
│   ├── logger.py        # Logging configuration
│   └── response.py      # API response formatter
├── .gitignore           # Git ignore file
├── api_server.py        # FastAPI server with health check
└── requirements.txt     # Project dependencies

Getting Started

Prerequisites

  • Python 3.10 or higher
  • pip

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/hexagonal-api.git
cd hexagonal-api
  1. Create a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt

Running the API

python api_server.py

The API will be available at http://localhost:8080

API Endpoints

  • GET /health - Health check endpoint
  • GET /readiness - Readiness check endpoint
  • GET /api/health - Health domain endpoint

About

Assistant project with FastAPI backend

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors