CLI tool for generating FastAPI boilerplate code using the Fastgear library
Project description
FastGear CLI
A powerful CLI tool to bootstrap FastAPI projects powered by the FastGear library โ with best practices, pre-configured templates, and modern development tools out of the box.
๐ฏ What is FastGear CLI?
FastGear CLI is the official command-line companion for the FastGear library. It streamlines the creation of FastAPI projects by generating a complete, production-ready project structure with:
- Pre-configured FastGear integration for accelerated API development
- FastAPI application scaffolding with best practices
- Modern Python project setup with type hints and validation
Note: Projects generated by FastGear CLI are designed to work seamlessly with the FastGear library, which provides utilities, patterns, and abstractions to supercharge your FastAPI development.
โจ Features
- ๐ FastAPI Project Setup - Create production-ready FastAPI projects in seconds
- โก FastGear Integration - Pre-configured to use the FastGear library
- ๐ณ Docker Support - Optional Docker configuration with Dockerfile and docker-compose
- ๐ค AI Agent Tools - Integrate AI-powered development tools (GitHub Copilot)
- ๐ CI/CD Integration - Pre-configured CI/CD pipelines (GitHub Actions)
- ๐ฆ Modern Dependencies - Uses
uvfor fast, reliable dependency management - ๐ Dry-Run Mode - Preview files before creation
- โ Type-Safe - Full type hints and Pydantic models
- ๐งช Test Coverage - Comprehensive test suite with pytest
๐ Requirements
- Python 3.13+
- uv (recommended for dependency management)
๐ง Installation
Using uv (recommended)
uv pip install fastgear-cli
Using pip
pip install fastgear-cli
From source
git clone https://github.com/hmarcuzzo/fastgear-cli.git
cd fastgear-cli
uv pip install -e .
๐ Quick Start
Create a new project in the current directory:
fg init
Create a project in a specific directory:
fg init /path/to/project
Preview what files would be created (dry-run):
fg init --dry-run
# or
fg init -n
๐ Usage Examples
Basic Project Creation
$ fg init
? Project name: my-awesome-api
? Project title: My Awesome API
? Use Docker? Yes
? Use AI agent tools? No
? Use CI/CD pipeline? Yes
? Select CI/CD provider: GitHub Actions
๐ฆ Generating uv.lock...
๐ Project 'my-awesome-api' created successfully!
Your new FastAPI project is ready with FastGear pre-configured!
Dry-Run Mode
Preview the project structure before creating files:
$ fg init --dry-run
? Project name: my-awesome-api
? Project title: My Awesome API
? Use Docker? Yes
๐ Dry run mode - no files created
Files that would be created:
โโโ ๐ my-awesome-api
โโโ ๐ docker
โ โโโ ๐ Dockerfile
โ โโโ ๐ docker-compose.yml
โโโ ๐ src
โ โโโ ๐ my_awesome_api
โ โโโ ๐ __init__.py
โ โโโ ๐ main.py # FastAPI app with FastGear
โโโ ๐ tests
โ โโโ ๐ __init__.py
โ โโโ ๐ test_main.py
โโโ ๐ .dockerignore
โโโ ๐ .gitignore
โโโ ๐ pyproject.toml # Includes FastGear dependency
โโโ ๐ README.md
Total: 12 file(s)
Custom Directory
Create a project in a specific location:
fg init ~/projects/new-api
Add Components to an Existing Module
Create an entity:
fg add entity user --path src/modules/user
Create a service and inject a repository explicitly:
fg add service user --path src/modules/user \
--repository-path src.modules.user.repositories.UserRepository
Create a repository and choose interactively whether to inject an entity:
fg add repository user --path src/modules/user
Create a full module and choose components interactively:
fg add module user --path src/modules
Create a module non-interactively:
fg add module user --path src/modules \
--module-components entity,repository,service,controller
Preview created files without writing:
fg add module user --path src/modules --module-components service,controller --dry-run
๐ฏ Commands
init
Initialize a new FastAPI project with FastGear.
Usage:
fg init [DIRECTORY] [OPTIONS]
Arguments:
DIRECTORY- Target directory (default: current directory)
Options:
--dry-run,-n- Show what files would be created without creating them--help- Show help message
Interactive Prompts:
- Project name - The name of your project (used for directory and package names)
- Project title - Human-readable project title
- Use Docker? - Include Docker configuration files
- Use AI agent tools? - Include AI development tools configuration
- Use CI/CD pipeline? - Include continuous integration/deployment setup
- Select CI/CD provider - Choose your CI/CD platform (if enabled)
add
Add components to an existing project/module.
Usage:
fg add [ELEMENT_TYPE] [ELEMENT_NAME] [OPTIONS]
Element types:
entityrepositoryservicecontrollermodule
Arguments:
ELEMENT_TYPE- Component type to generateELEMENT_NAME- Component/module name (normalized to snake_case)
Common options:
--path,-p- Base directory where files are generated (default: current directory)--use-folders/--no-use-folders- Generate in folders (entities/,services/, etc.) or flat files--dry-run,-n- Preview output without writing files
Dependency options:
--entity-path- Entity import path used byrepository--repository-path- Repository import path used byservice--service-path- Service import path used bycontroller
Module option:
--module-components- Comma-separated list formodule:entity,repository,service,controller
๐ 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 fastgear_cli-0.4.3.tar.gz.
File metadata
- Download URL: fastgear_cli-0.4.3.tar.gz
- Upload date:
- Size: 104.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69f7a06c7eaed0789fafdb2fbbd6175c27d4ef615e3ea749c47aa79309b173c2
|
|
| MD5 |
5a806d0e32146408892971be19bb2eb1
|
|
| BLAKE2b-256 |
680d814dd80ae6850bcc50ff1997da4f58b44d83cf78022e31acf34d72dff8a1
|
File details
Details for the file fastgear_cli-0.4.3-py3-none-any.whl.
File metadata
- Download URL: fastgear_cli-0.4.3-py3-none-any.whl
- Upload date:
- Size: 64.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
242fa2dec0e9851107adc5c863a660d6f22ae8209bf402e6c1911a99b68aa4d4
|
|
| MD5 |
a76509360e5c1c82a1c55a2c222f500e
|
|
| BLAKE2b-256 |
50f353be33d274189dd7e1b8e68b9945a311d51bb60e97034bea7ebe6906a514
|