Back to the catalog

fastapi

Enables several FastAPI and Python-related commands and context.

Open source Open in the app JSON README (API)

About

Enables several FastAPI and Python-related commands and context.

Details

Kind
Plugins
Topic
No topic detected
Publisher
sanjarbek17
Origin
gemini
Category
ferramentas
Version
0.1.0
Last push
2026-04-23T11:46:17Z
Repository state
ativo
Added
2026-08-30 14:13:39
Updated
2026-08-30 14:13:39
Origin id
sanjarbek17/gemini-fastapi-extension

README

# Gemini FastAPI Extension

A comprehensive extension for Google Gemini (Antigravity) that provides expert-level FastAPI development rules, commands, and project structures.

This extension is designed to help you build high-performance, maintainable, and modern APIs with FastAPI, Python, and SQLModel.

## ๐Ÿš€ Features

- **Standardized Project Structures**: Automatically initialize simple (component-based) or modular (feature-based) FastAPI project layouts.
- **Migration Helper**: Reconstruct an existing project structure into a modular one automatically.
- **AI Expert Rules**: Pre-configured guidelines for dependency injection, type hinting, pydantic 2.0, and async/await best practices.
- **Smart Commands**:
  - `init-structure`: Bootstrap a new FastAPI project structure.
  - `init-modules-structure`: Bootstrap or migrate a FastAPI project into a modular (feature-based) structure.
  - `create-model`: Generate SQLModel database models quickly.
  - `create-schema`: Generate Pydantic request/response schemas.
  - `add-endpoint`: Quickly add new API endpoints with routers.
  - `add-to-main`: Helper to register routers in the main application.
  - `create-crud`: Generate a full module (models, schemas, service, router) with CRUD operations.

## ๐Ÿ“ฆ Installation

To use this extension, copy this directory into your Gemini extensions folder or point your Gemini configuration to this directory.

```bash
# Clone the repository
git clone git@github.com:Sanjarbek17/gemini-fastapi-extension.git
```

## ๐Ÿ›  Usage

Once the extension is active, you can use the commands directly in your Gemini chat.

Example command:
> "Use the fastapi extension to initialize a new project structure."

## ๐Ÿ“‚ Project Structure

This extension suggests and automates the following structure:
```text
.
โ”œโ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ api/
โ”‚   โ”‚   โ””โ”€โ”€ v1/
โ”‚   โ”‚       โ”œโ”€โ”€ api.py          # Main router including all routers
โ”‚   โ”‚       โ””โ”€โ”€ endpoints/      # Individual feature routers
โ”‚   โ”œโ”€โ”€ core/
โ”‚   โ”‚   โ”œโ”€โ”€ config.py           # Settings (Pydantic Settings)
โ”‚   โ”‚   โ””โ”€โ”€ security.py         # Auth utilities
โ”‚   โ”œโ”€โ”€ db/
โ”‚   โ”‚   โ”œโ”€โ”€ session.py          # Engine and session creation
โ”‚   โ”‚   โ””โ”€โ”€ base.py             # Base class for models
โ”‚   โ”œโ”€โ”€ models/                 # DB models (SQLModel/SQLAlchemy)
โ”‚   โ”œโ”€โ”€ schemas/                # Pydantic schemas (Request/Response)
โ”‚   โ”œโ”€โ”€ crud/                   # CRUD utility functions
โ”‚   โ””โ”€โ”€ main.py                 # FastAPI app initialization
โ”œโ”€โ”€ tests/                      # Pytest directory
โ”œโ”€โ”€ .env                        # Environment variables
โ”œโ”€โ”€ alembic/                    # DB migrations
โ””โ”€โ”€ pyproject.toml              # Dependencies (Poetry/Pip/Ruff config)
```

## ๐Ÿ“œ FastAPI Best Practices Included

- **Type Hints**: Mandatory for Pydantic validation and auto-docs.
- **SQLModel**: Combined ORM and Pydantic models to reduce duplication.
- **Dependency Injection**: Heavy use of `Depends()` for cleaner logic.
- **Modern Libraries**: Recommends `sqlmodel`, `pydantic-settings`, and `httpx`.

---

Developed by [Sanjarbek17](https://github.com/Sanjarbek17).

More