Skip to content

Commit 033af8b

Browse files
committed
📝 Update README.md with improved badge formatting and enhanced documentation
1 parent 2173760 commit 033af8b

File tree

1 file changed

+137
-61
lines changed

1 file changed

+137
-61
lines changed

README.md

Lines changed: 137 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
11
# FastAPI CLI
22

3-
<a href="https://github.com/fastapi/fastapi-cli/actions/workflows/test.yml" target="_blank">
4-
<img src="https://github.com/fastapi/fastapi-cli/actions/workflows/test.yml/badge.svg" alt="Test">
5-
</a>
6-
<a href="https://github.com/fastapi/fastapi-cli/actions/workflows/publish.yml" target="_blank">
7-
<img src="https://github.com/fastapi/fastapi-cli/actions/workflows/publish.yml/badge.svg" alt="Publish">
8-
</a>
9-
<a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/fastapi/fastapi-cli" target="_blank">
10-
<img src="https://coverage-badge.samuelcolvin.workers.dev/fastapi/fastapi-cli.svg" alt="Coverage">
11-
<a href="https://pypi.org/project/fastapi-cli" target="_blank">
12-
<img src="https://img.shields.io/pypi/v/fastapi-cli?color=%2334D058&label=pypi%20package" alt="Package version">
13-
</a>
3+
[![Test](https://github.com/fastapi/fastapi-cli/actions/workflows/test.yml/badge.svg)](https://github.com/fastapi/fastapi-cli/actions/workflows/test.yml)
4+
[![Publish](https://github.com/fastapi/fastapi-cli/actions/workflows/publish.yml/badge.svg)](https://github.com/fastapi/fastapi-cli/actions/workflows/publish.yml)
5+
[![Coverage](https://coverage-badge.samuelcolvin.workers.dev/fastapi/fastapi-cli.svg)](https://coverage-badge.samuelcolvin.workers.dev/redirect/fastapi/fastapi-cli)
6+
[![PyPI version](https://img.shields.io/pypi/v/fastapi-cli?color=%2334D058&label=pypi%20package)](https://pypi.org/project/fastapi-cli)
7+
[![Python Versions](https://img.shields.io/pypi/pyversions/fastapi-cli.svg)](https://pypi.org/project/fastapi-cli)
8+
[![License](https://img.shields.io/github/license/fastapi/fastapi-cli.svg)](https://github.com/fastapi/fastapi-cli/blob/main/LICENSE)
9+
[![Downloads](https://static.pepy.tech/badge/fastapi-cli)](https://pepy.tech/project/fastapi-cli)
10+
[![GitHub stars](https://img.shields.io/github/stars/fastapi/fastapi-cli.svg)](https://github.com/fastapi/fastapi-cli/stargazers)
11+
[![Last Commit](https://img.shields.io/github/last-commit/fastapi/fastapi-cli.svg)](https://github.com/fastapi/fastapi-cli/commits)
12+
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
1413

15-
---
14+
FastAPI CLI is a robust command-line interface designed for FastAPI applications. It streamlines both development and production deployments by providing automatic reload capabilities and leveraging Uvicorn's high-performance ASGI server.
1615

17-
**Source Code**: <a href="https://github.com/fastapi/fastapi-cli" target="_blank">https://github.com/fastapi/fastapi-cli</a>
16+
## Key Features
1817

19-
---
18+
- ⚡️ **High Performance** - Built on Uvicorn's lightning-fast ASGI server implementation
19+
- 🔄 **Development Mode** - Automatic reload support for efficient development
20+
- 🚀 **Production Ready** - Production-optimized settings with multi-worker support
21+
- 🔍 **Smart Discovery** - Automatic detection of FastAPI applications
22+
- 🛠️ **Flexible Configuration** - Comprehensive server configuration options
23+
- 💻 **Developer Experience** - Intuitive CLI with clear feedback and logging
2024

21-
Run and manage FastAPI apps from the command line with FastAPI CLI. 🚀
25+
## Installation
2226

23-
## Description
27+
Select the installation option that matches your requirements:
2428

25-
**FastAPI CLI** is a command line program `fastapi` that you can use to serve your FastAPI app, manage your FastAPI project, and more.
29+
```bash
30+
# Complete installation with all features
31+
pip install "fastapi[all]"
2632

27-
When you install FastAPI (e.g. with `pip install "fastapi[standard]"`), it includes a package called `fastapi-cli`, this package provides the `fastapi` command in the terminal.
33+
# Standard installation with Uvicorn
34+
pip install "fastapi[standard]"
2835

29-
To run your FastAPI app for development, you can use the `fastapi dev` command:
30-
31-
<div class="termy">
36+
# Basic installation
37+
pip install fastapi-cli
38+
```
3239

33-
```console
34-
$ fastapi dev main.py
35-
INFO Using path main.py
36-
INFO Resolved absolute path /home/user/code/awesomeapp/main.py
37-
INFO Searching for package file structure from directories with __init__.py files
38-
INFO Importing from /home/user/code/awesomeapp
40+
## Quick Start Guide
3941

40-
╭─ Python module file ─╮
41-
│ │
42-
│ 🐍 main.py │
43-
│ │
44-
╰──────────────────────╯
42+
### Development Environment
4543

46-
INFO Importing module main
47-
INFO Found importable FastAPI app
44+
Start your FastAPI application with development features enabled:
4845

49-
╭─ Importable FastAPI app ─╮
50-
│ │
51-
│ from main import app │
52-
│ │
53-
╰──────────────────────────╯
46+
```bash
47+
fastapi dev main.py
48+
```
5449

55-
INFO Using import string main:app
50+
Development server features:
51+
- Automatic code reloading
52+
- Local development host (127.0.0.1)
53+
- Detailed debugging output
54+
- Enhanced error reporting
5655

56+
```
5757
╭────────── FastAPI CLI - Development mode ───────────╮
5858
│ │
5959
│ Serving at: http://127.0.0.1:8000 │
@@ -65,43 +65,119 @@ INFO Using import string main:app
6565
│ fastapi run │
6666
│ │
6767
╰─────────────────────────────────────────────────────╯
68+
```
6869

69-
INFO: Will watch for changes in these directories: ['/home/user/code/awesomeapp']
70-
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
71-
INFO: Started reloader process [56345] using WatchFiles
72-
INFO: Started server process [56352]
73-
INFO: Waiting for application startup.
74-
INFO: Application startup complete.
70+
### Production Deployment
71+
72+
Launch your application in production mode with optimized settings:
73+
74+
```bash
75+
fastapi run main.py
7576
```
7677

77-
</div>
78+
Production environment features:
79+
- Performance-optimized configuration
80+
- Multi-worker process support
81+
- Public network interface (0.0.0.0)
82+
- Production-grade error handling
7883

79-
That command line program called `fastapi` is **FastAPI CLI**.
84+
## Advanced Configuration
8085

81-
FastAPI CLI takes the path to your Python program and automatically detects the variable with the FastAPI (commonly named `app`) and how to import it, and then serves it.
86+
### Application Discovery System
8287

83-
For production you would use `fastapi run` instead. 🚀
88+
FastAPI CLI implements an intelligent application discovery system with the following search hierarchy:
8489

85-
Internally, **FastAPI CLI** uses <a href="https://www.uvicorn.org" class="external-link" target="_blank">Uvicorn</a>, a high-performance, production-ready, ASGI server. 😎
90+
```
91+
project/
92+
├── main.py # Primary search location
93+
├── app.py # Secondary search location
94+
├── api.py # Tertiary search location
95+
└── app/
96+
├── main.py # Fourth search location
97+
├── app.py # Fifth search location
98+
└── api.py # Sixth search location
99+
```
86100

87-
## `fastapi dev`
101+
### Command Options
102+
103+
#### Development Mode (`fastapi dev`)
104+
```bash
105+
Options:
106+
--host TEXT Host address [default: 127.0.0.1]
107+
--port INTEGER Port number [default: 8000]
108+
--reload Enable auto-reload [default: True]
109+
--root-path TEXT Root path prefix [default: ""]
110+
--app TEXT FastAPI app variable name
111+
--help Show command help
112+
```
113+
114+
#### Production Mode (`fastapi run`)
115+
```bash
116+
Options:
117+
--host TEXT Host address [default: 0.0.0.0]
118+
--port INTEGER Port number [default: 8000]
119+
--workers INTEGER Worker process count
120+
--root-path TEXT Root path prefix [default: ""]
121+
--app TEXT FastAPI app variable name
122+
--help Show command help
123+
```
124+
125+
## Technical Architecture
88126

89-
When you run `fastapi dev`, it will run on development mode.
127+
FastAPI CLI integrates industry-leading components:
90128

91-
By default, it will have **auto-reload** enabled, so it will automatically reload the server when you make changes to your code. This is resource intensive and could be less stable than without it, you should only use it for development.
129+
- **Uvicorn Engine**
130+
- High-performance ASGI server implementation
131+
- Production-grade server capabilities
132+
- WebSocket protocol support
133+
- HTTP/1.1 and HTTP/2 protocol support
92134

93-
By default it will listen on the IP address `127.0.0.1`, which is the IP for your machine to communicate with itself alone (`localhost`).
135+
- **FastAPI Framework**
136+
- Modern Python web framework (Python 3.8+)
137+
- Type hint-based validation
138+
- Automatic OpenAPI documentation
139+
- Built-in async support
140+
- Advanced dependency injection
94141

95-
## `fastapi run`
142+
## Best Practices
96143

97-
When you run `fastapi run`, it will run on production mode by default.
144+
### Development Guidelines
145+
- Use `fastapi dev` for development workflows
146+
- Enable comprehensive logging during debugging
147+
- Leverage automatic API documentation
148+
- Implement proper error handling
98149

99-
It will have **auto-reload disabled** by default.
150+
### Production Guidelines
151+
- Deploy with `fastapi run` and appropriate worker configuration
152+
- Configure network settings based on deployment environment
153+
- Implement security best practices
154+
- Use a production-grade reverse proxy (e.g., Nginx)
100155

101-
It will listen on the IP address `0.0.0.0`, which means all the available IP addresses, this way it will be publicly accessible to anyone that can communicate with the machine. This is how you would normally run it in production, for example, in a container.
156+
## Contributing
102157

103-
In most cases you would (and should) have a "termination proxy" handling HTTPS for you on top, this will depend on how you deploy your application, your provider might do this for you, or you might need to set it up yourself. You can learn more about it in the <a href="https://fastapi.tiangolo.com/deployment/" class="external-link" target="_blank">FastAPI Deployment documentation</a>.
158+
We welcome community contributions! See our [Contributing Guidelines](CONTRIBUTING.md) for:
159+
- Code style requirements
160+
- Development environment setup
161+
- Pull request workflow
162+
- Issue reporting guidelines
163+
164+
## Security
165+
166+
Security is a top priority. Review our [Security Policy](SECURITY.md) for:
167+
- Version support information
168+
- Security update policies
169+
- Vulnerability reporting procedures
170+
- Security best practices
104171

105172
## License
106173

107-
This project is licensed under the terms of the MIT license.
174+
This project is released under the MIT License. See the [LICENSE](LICENSE) file for complete details.
175+
176+
## Resources
177+
178+
- 📚 [Official Documentation](https://fastapi.tiangolo.com/fastapi-cli/)
179+
- 💻 [Source Repository](https://github.com/fastapi/fastapi-cli)
180+
- 🐛 [Issue Tracking](https://github.com/fastapi/fastapi-cli/issues)
181+
- 📦 [PyPI Package](https://pypi.org/project/fastapi-cli)
182+
- 📖 [FastAPI Documentation](https://fastapi.tiangolo.com)
183+
- 🚀 [Uvicorn Documentation](https://www.uvicorn.org)

0 commit comments

Comments
 (0)