FastAPI with clean architecture
Project description
FastAPI with Clean-Architecture
클린 아키텍처 구조를 적용한 FastAPI.
Clean Architecture 구조 및 역할
흐름
interfaces -> application -> domain -> infrastructure
설명
- 클린 아키텍처의 핵심은 관심사의 분리로 유지보수와 확장성을 높일 수 있다.
| Layer | Description |
|---|---|
| Interface | 사용자/외부 입력을 Application의 유즈케이스에 연결하는 레이어 |
| Application | 사용자 시나리오(usecase) 및 비즈니스 로직을 실행하는 레이어 |
| Domain | 핵심 비즈니스 규칙 및 엔티티를 정의하는 레이어 |
| Infrastructure | 외부 시스템(DB, API 등)과의 연동 및 구현을 담당하는 레이어 |
예시 by github copilot
- Interface: 사용자가 회원가입 폼을 제출하면, API 엔드포인트에서 입력 데이터를 받아 Application 레이어로 전달합니다.
- Application: 회원가입 유즈케이스를 실행하며, 입력값 검증, 비밀번호 암호화, 도메인 객체 생성, 트랜잭션 관리 등을 처리합니다.
- Domain:
User엔티티와 회원가입 관련 비즈니스 규칙(예: 이메일 중복 체크, 비밀번호 정책 등)을 정의합니다. - Infrastructure: DB에 사용자 정보를 저장하고, 이메일 인증을 위해 외부 메일 서비스와 연동합니다.
기본 사용법
- fastapi-setup 으로 프로젝트 초기화할 수 있습니다.
fastapi-setup
- --help 를 통해 명령어를 확인할 수 있습니다.
python3 manage.py --help
커스텀 명령어 추가 방법
{PROJECT_DIR}/managements/commands/아래 Command 를 상속받아 명령어를 추가할 수 있습니다.
python3 manage.py {command_name}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fastapi_clean_archi-0.7.1.tar.gz
(13.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastapi_clean_archi-0.7.1.tar.gz.
File metadata
- Download URL: fastapi_clean_archi-0.7.1.tar.gz
- Upload date:
- Size: 13.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3939532736d4b2776b8d6f4977266b9bd90bda1b435faaf463d64c8385567159
|
|
| MD5 |
ead80ae93e7585cc3ef2047252c32d3e
|
|
| BLAKE2b-256 |
7070617a71fd709acb1f0078b6c2b2f3b99216a97e82b4a08d349b0392a9f3bc
|
File details
Details for the file fastapi_clean_archi-0.7.1-py3-none-any.whl.
File metadata
- Download URL: fastapi_clean_archi-0.7.1-py3-none-any.whl
- Upload date:
- Size: 20.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4896f3f3783e2a3abb87249306e2b76f53bbbe8489fd22e9547911a44af82d9f
|
|
| MD5 |
0a2397cc291f2bee5b6fdc383bbe22a9
|
|
| BLAKE2b-256 |
8baac71b92f07493d1e12ae6cd2ad3d782d779065770e0d8dfcd9f31eba112b8
|