Skip to main content

A command-line tool for generating FastAPI projects with different architectural patterns

Project description

FastAPI CLI Generator

🚀 A command-line tool for quickly creating FastAPI projects with different architectural patterns.

中文文档 | English Documentation

Features

  • 🏗️ Two Architecture Patterns: Functional layered vs Modular architecture
  • 🎯 Interactive CLI: User-friendly interface with Chinese support
  • 📁 Complete Project Structure: Templates based on best practices
  • Ready to Use: Generated projects can run immediately

Installation

pip install fastapi-cli-generator

Quick Start

Interactive Mode (Recommended)

fastapi-create

Command Line Mode

# Create with specific template
fastapi-create create my-project --template module
fastapi-create create my-project --template function

# List available templates
fastapi-create list-templates

Usage

Basic Usage

# Create project (interactive mode)
fastapi-create my-project

# Specify template type
fastapi-create my-project --template module
fastapi-create my-project --template function

List Available Templates

fastapi-create list-templates

Architecture Patterns

1. Modular Architecture (module) - Recommended

Organize code by business domains, each module contains complete MVC structure:

my-project/
├── src/
│   ├── core/                 # 核心配置
│   ├── modules/              # 业务模块
│   │   ├── auth/             # 认证模块
│   │   ├── users/            # 用户管理
│   │   └── items/            # 项目管理
│   └── shared/               # 共享工具
├── tests/                    # 测试文件
└── requirements.txt

2. Functional Layered Architecture (function)

Organize code by technical layers:

my-project/
├── src/
│   ├── api/v1/endpoints/     # API端点
│   ├── core/                 # 核心配置
│   ├── db/repositories/      # 数据库操作
│   ├── models/               # 数据模型
│   ├── services/             # 业务逻辑
│   └── utils/                # 工具函数
├── tests/                    # 测试文件
└── requirements.txt

Develop

# 克隆项目
git clone <repository-url>
cd fastapi_proj_template

# 安装开发依赖
pip install -r requirements-dev.txt

# 安装为可编辑包
pip install -e .

# 运行测试
python test_generation.py

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastapi_cli_generator-0.2.0.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastapi_cli_generator-0.2.0-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_cli_generator-0.2.0.tar.gz.

File metadata

  • Download URL: fastapi_cli_generator-0.2.0.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for fastapi_cli_generator-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c55755f8f04482512696fee7518be09dbc4fba4a5351d8f498bcc5c39ffb08bb
MD5 19e025dca8e9eb91fee68002212414cd
BLAKE2b-256 044aab6a9a1d7d49e82f3456b82e9de88100f1b746bcb29debd5eeb3b2b12e67

See more details on using hashes here.

File details

Details for the file fastapi_cli_generator-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_cli_generator-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cb7391730aff6da72ecc7970964eb556b680b5e4f28cb35532f05fa26b56bcbe
MD5 0544a9c7748e1f192c4608e5e2cca75d
BLAKE2b-256 9a8ed12ca29b804e8244dcb03abb29bfeae28eb033ebbef1da39bac2024ad86b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page