Skip to content

feat: FastAPI için modern cursor rule ekle (example-structures)#12

Open
tugkanboz wants to merge 1 commit into
mainfrom
auto/daily-update-fastapi-example-structure
Open

feat: FastAPI için modern cursor rule ekle (example-structures)#12
tugkanboz wants to merge 1 commit into
mainfrom
auto/daily-update-fastapi-example-structure

Conversation

@tugkanboz

Copy link
Copy Markdown
Owner

Ne eklendi?

example-structures/fastapi/.cursor/rules/api-patterns.mdc — FastAPI projeleri için modern, context-aware bir Cursor Rules dosyası.

Kapsanan konular

  • Proje yapısı: routers/, schemas/, services/, dependencies/, core/ ayrımı
  • Pydantic v2 şemaları: from_attributes (orm_mode yerine), model_dump(exclude_unset=True), EmailStr, Field validasyonları
  • APIRouter organizasyonu: prefix, tags, HTTP durum sabitleri (status.HTTP_*)
  • Dependency Injection: Depends() ile paylaşımlı DB oturumu ve kimlik doğrulama
  • Async SQLAlchemy: AsyncSession, async_sessionmaker, lifespan context manager
  • Service layer: İş mantığını router'dan ayıran sınıf bazlı servis deseni
  • pydantic-settings: .env tabanlı Settings yönetimi
  • Test: pytest + httpx.AsyncClient + ASGITransport + dependency override örneği
  • Key rules: async def, response_model, exclude_unset, hata yönetimi kuralları

Güncellenen dosyalar

  • example-structures/STRUCTURE-OVERVIEW.md — FastAPI bölümü ve "Getting Started" listesi eklendi

Neden FastAPI?

Mevcut example-structures/ klasörü Next.js, React TypeScript, Cypress ve Selenium Python'u kapsıyor; Python backend için hiç örnek yoktu. FastAPI, Python ekosisteminin en popüler async web framework'ü olup özellikle LLM/AI backend uygulamalarında yaygın kullanılıyor. Eklenen kural dosyası diğer .mdc örnekleriyle birebir aynı formatı izliyor.


Generated by Claude Code

example-structures/ klasörüne FastAPI için modern .mdc cursor rule eklendi.
Kapsanan konular:
- Proje klasör yapısı (routers, schemas, services, dependencies, core)
- Pydantic v2 şemaları (from_attributes, model_dump, EmailStr, Field)
- APIRouter organizasyonu ve HTTP durum kodları
- Async SQLAlchemy oturumu ile Depends() dependency injection
- Service layer pattern (iş mantığını router'dan ayırma)
- pydantic-settings ile Settings yönetimi
- pytest + httpx AsyncClient ile async test yazımı
- Key rules (async def, PATCH için exclude_unset, response_model vb.)

STRUCTURE-OVERVIEW.md de yeni FastAPI bölümü ve "Getting Started" listesi güncellendi.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants