# Backend Architecture

## Purpose

Define backend organisation.

---

# Preferred Structure

Example:

Application

├── Features

├── Domain

├── Infrastructure

├── Services

├── API

---

# Responsibilities

## API Layer

Handles:

- HTTP requests.
- Authentication.
- Validation.
- Responses.

Should not contain business logic.

---

## Application Layer

Handles:

- Workflows.
- Business operations.
- Coordination.

---

## Domain Layer

Contains:

- Entities.
- Rules.
- Business concepts.

---

## Infrastructure

Handles:

- Database.
- External APIs.
- File storage.
- AI providers.

---

# Rule

Controllers should remain thin.