fastapi-router-py
/fastapi-router-py
Tworzy routery FastAPI z operacjami CRUD, zależnościami uwierzytelniania i poprawnymi modelami odpowiedzi dla endpointów REST API.
- Autor
- microsoft ↗
- Repozytorium
- skills ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 26.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 3
- Skrypty
- 1
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 26.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
- 1 skrypt w paczce. Przejrzyj je przed instalacją, bo Claude może je uruchomić.
Skrypty: assets/template.py
Co robi i kiedy
Tworzy routery FastAPI z operacjami CRUD, zależnościami uwierzytelniania i poprawnymi modelami odpowiedzi dla endpointów REST API.
Oryginalny opis (EN)
Create FastAPI routers with CRUD operations, authentication dependencies, and proper response models. Use when building REST API endpoints, creating new routes, implementing CRUD operations, or adding authenticated endpoints in FastAPI applications.
Jak działa
- Quick Start
- Authentication Patterns
- Response Models
- HTTP Status Codes
- Integration Steps
- Best Practices
- Reference Files
Podgląd SKILL.md
---
name: fastapi-router-py
description: Create FastAPI routers with CRUD operations, authentication dependencies, and proper response models. Use when building REST API endpoints, creating new routes, implementing CRUD operations, or adding authenticated endpoints in FastAPI applications.
license: MIT
metadata:
author: Microsoft
version: "1.0.0"
---
# FastAPI Router
Create FastAPI routers following established patterns with proper authentication, response models, and HTTP status codes.
## Quick Start
Copy the template from [assets/template.py](assets/template.py) and replace placeholders:
- `{{ResourceName}}` → PascalCase name (e.g., `Project`)
- `{{resource_name}}` → snake_case name (e.g., `project`)
- `{{resource_plural}}` → plural form (e.g., `projects`)
## Authentication Patterns
```python
# Optional auth - returns None if not authenticated
current_user: Optional[User] = Depends(get_current_user)
# Required auth - raises 401 if not authenticated
current_user: User = Depends(get_current_user_required)
```
## Response Models
```python
@router.get("/items/{item_id}", response_model=Item)
async def get_item(item_id: str) -> Item:
...
@router.get("/items", response_model=list[Item])
async def list_items() -> list[Item]:
...
```
## HTTP Status Codes
```python
@router.post("/items", status_code=status.HTTP_201_CREATED)
async def create_item(item: ItemCreate) -> Item:
...
@router.delete("/items/{id}", status_code=status.HTTP_204_NO_CONTENT)
async def delete_item(id: str) -> None:
...
```
## Integration Steps
1. Create router in `src/backend/app/routers/`
2. Mount in `src/backend/app/main.py`
3. Create corresponding Pydantic models
4. Create service layer if needed
5. Add frontend API functions
## Best Practices
1. **Pick `def` or `async def` per endpoint based on whether you call async I/O; do not call blocking I/O from an `async def` handler.**
2. **Manage long-lived resources (DB pools, HTTP clients) in `lifespan` and inject via `Depends`;** use `with`/`async with` for per-request resources.
## Reference Files
| File | Contents |
|------|----------|
| [references/capabilities.md](references/capabilities.md) | Additional non-hero capabilities, operation-group coverage, and production checklists. |
Pliki w paczce (3)
- SKILL.md 2 KB
- assets/template.py 5 KB
- references/capabilities.md 1 KB
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · microsoft/skills | 100 | MIT |
| rootcastleco/rei-skills | 100 | MIT |
Identyczna treść występuje jeszcze w 1 innych folderach na GitHubie. Tu pokazujemy jedną, najlepiej ocenioną kopię.
Migawka bazy z 13.11.2026 · wersja paczki 9acbec041361 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100fastapi-router-creator
Prawdopodobnie tworzy routery FastAPI w ramach rozwoju backendu na podstawie nazwy skilla i kategorii. - 100fastapi
Pomaga budować API w FastAPI: REST, walidacja, zależności, modele Pydantic, wstrzykiwanie zależności i uwierzytelnianie OAuth2 i JWT. - 86fastapi
Pomaga budować projekty FastAPI: REST API, asynchroniczne endpointy, modele Pydantic i usługi backendowe. - 100fastapi-async-patterns
Buduje asynchroniczne API FastAPI z wstrzykiwaniem zależności i wzorcami serwisów, dla typowanych endpointów. - 92crud-endpoints
Podpowiada, gdzie i jak dodać endpoint CRUD w serwerze repozytorium: routery, middleware, ActionsEnum i rejestrację tras. - 95fastapi-validation
Opisuje walidację w FastAPI z modelami Pydantic, do budowy typobezpiecznych API z solidną walidacją żądań i odpowiedzi.