CLI tool for generating FastAPI project boilerplate
Project description
AI Planet CLI
AI Planet CLI is a powerful command-line tool for generating FastAPI project boilerplate with best practices baked in. It helps you quickly scaffold a production-ready FastAPI application with the right structure and components.
Features
- Project Generation: Create a new FastAPI project with the recommended structure
- Component Management: Add, remove, and generate components for your project
- Database Migrations: Manage database migrations with Alembic
- Development Server: Run your FastAPI application in development or production mode
- Docker Support: Generate Docker configuration and run your app in containers
Installation
pip install aiplanet
Project Structure
The CLI generates a project with the following structure:
my_project/ # Project root
├── my_project/ # Main package directory
│ ├── __init__.py # Package initialization with version
│ ├── constants/ # Application constants
│ ├── core/ # Core functionality
│ │ ├── config.py # Application configuration
│ │ ├── database.py # Database connection
│ │ ├── security.py # Authentication and authorization
│ │ └── logging.py # Logging configuration
│ ├── exceptions/ # Custom exceptions
│ ├── jobs/ # Background jobs
│ ├── middleware/ # Middleware components
│ ├── models/ # SQLAlchemy models
│ ├── routers/ # API endpoints
│ │ ├── v1/ # API version 1
│ │ │ ├── public/ # Public endpoints
│ │ │ └── private/ # Authenticated endpoints
│ ├── schemas/ # Pydantic schemas
│ ├── services/ # Business logic
│ └── utils/ # Utility functions
├── tests/ # Tests directory
├── migrations/ # Alembic migrations
├── main.py # Application entry point
├── pyproject.toml # Poetry configuration
├── alembic.ini # Alembic configuration
├── README.md # Documentation
└── .gitignore # Git configuration
Usage
Creating a New Project
aiplanet build project my_project --docker --github-actions
Options:
--docker: Include Docker configuration--github-actions: Include GitHub Actions workflow--pre-commit: Include pre-commit hooks--minimal: Create a minimal project
Adding Components
aiplanet add service user
aiplanet add model user
aiplanet add schema user
aiplanet add route user
Generating Complete Modules
aiplanet gen module user --with-middleware --with-exception
Managing Database Migrations
aiplanet migrate init
aiplanet migrate create "create users table"
aiplanet migrate upgrade head
Running the Application
# Development server
aiplanet run dev
# Production server
aiplanet run prod --workers 4
# Docker
aiplanet run docker
Component Types
- Service: Business logic services
- Model: SQLAlchemy database models
- Schema: Pydantic schemas for request/response
- Route: API endpoints (routers)
- Job: Background jobs/tasks
- Middleware: ASGI middleware components
- Const: Constant definitions
- Utils: Utility functions
- Exception: Custom exception classes
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
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
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 aiplanet-1.0.0.tar.gz.
File metadata
- Download URL: aiplanet-1.0.0.tar.gz
- Upload date:
- Size: 39.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ffb5a9945cf3e51acdc80947c46a6869315e064f493b5811e87384dc364dda8
|
|
| MD5 |
c196ab2c44250eb797d7adf5ccd57183
|
|
| BLAKE2b-256 |
ab8d515c0444339cd0bf3099306916f2920c05ce8924084a8542a5b4057d4f27
|
File details
Details for the file aiplanet-1.0.0-py3-none-any.whl.
File metadata
- Download URL: aiplanet-1.0.0-py3-none-any.whl
- Upload date:
- Size: 53.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88413527bf525dd1dbe86fb83b38d7d57052ecc85fdf23946fef71bee7638d01
|
|
| MD5 |
f092a1e1ffbb41bdaeee72b47dc1c855
|
|
| BLAKE2b-256 |
85a97ae0a721aeb6c126c5571c1f4400c3cc85f30b35a432ca3a10f7923edc96
|