claudegoodies
Command

api-endpoints

From davila7

Create comprehensive FastAPI endpoints with proper structure, validation, and documentation.

Install

/api-endpoints

Facts

Status
Actively maintained
Last commit

Source preview

The instructions Claude Code reads when this command runs.

# FastAPI Endpoints Generator

Create comprehensive FastAPI endpoints with proper structure, validation, and documentation.

## Purpose

This command helps you quickly create FastAPI endpoints with Pydantic models, dependency injection, and automatic API documentation.

## Usage

```
/api-endpoints
```

## What this command does

1. **Creates API endpoints** with proper HTTP methods
2. **Adds Pydantic models** for request/response validation
3. **Implements dependency injection** for database and auth
4. **Includes error handling** and status codes
5. **Generates automatic documentation** with OpenAPI

## Example Output

```python
# main.py
from fastapi import FastAPI, Depends, HTTPException, status
from fastapi.middleware.cors import CORSMiddleware
from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
from sqlalchemy.orm import Session
import uvicorn

from app.database import get_db, engine
from app.models import models
from app.routers import auth, users, posts, comments
from app.core.config import settings

# Create database tables
models.Base.metadata.create_all(bind=engine)

# Initialize FastAPI app
app = FastAPI(
    title="Blog API",
    description="A comprehensive blog API built with FastAPI",
    version="1.0.0",
    docs_url="/docs",
    redoc_url="/redoc"
)

# Add CORS middleware
app.add_middleware(
    CORSMiddleware,
    allow_origins=settings.ALLO
View full source on GitHub →

Other slash commands