Ana içeriğe geç
Teknoloji

API-First Nedir?

API-first, bir uygulamayı tasarlarken önce API'sini (endpoint'ler, data shape, auth) sonra UI'sini tasarlama yaklaşımı. UI bir 'consumer' — aynı API'yi web, mobile app, IoT cihaz, partner integration kullanabiliyor. JAMstack'in temel prensiplerinden biri.

Geleneksel yaklaşım: UI önce — formlar tasarlanıyor, sonra bu formlara uyacak DB yapısı, sonra API endpoints. Sorun: UI değişirse API + DB yeniden tasarlanmalı. Mobile uygulama eklemek için API'nin sıfırdan yazılması gerekiyor.

API-first yaklaşım: önce data model + API contracts tasarlanıyor (OpenAPI/Swagger ile). Sonra UI bu API'yi 'consumer' olarak kullanıyor. Mobile uygulama, partner integration, B2B portal — hepsi aynı API'den besleniyor.

API-first örneği: ```yaml # OpenAPI spec paths: /api/products: get: summary: List products parameters: - name: category, in: query, schema: { type: string } - name: limit, in: query, schema: { type: integer, default: 20 } responses: '200': description: List of products content: application/json: schema: { $ref: '#/components/schemas/Product' } ```

Bu spec'ten: - Backend (Node.js, Python, vs.) endpoint implemente ediyor - Frontend (Next.js) API consumer'ı yazılıyor - Mobile app (React Native) aynı API'yi kullanıyor - Üçüncü taraf entegrasyon (B2B partner) aynı API'ye request atıyor

API-first avantajları: 1. Multi-channel — aynı veri, çoklu kullanıcı arayüzü 2. Parallel development — backend + frontend + mobile paralel ilerleyebilir 3. Test friendly — API contracts ile mock + unit test kolay 4. Documentation — Swagger UI otomatik doc üretiyor 5. Versioning — /api/v1, /api/v2 ile breaking change yönetimi

DevPixel'in 2026 projelerinin %90'ı API-first — Next.js API routes + Firestore + tip-güvenli API client (auto-generated zod schemas).

DevPixel Yaklaşımı

DevPixel'in API-first uygulaması: Next.js API routes + Zod input validation + TypeScript domain types (Project, Ticket, Invoice). Aynı API'yi hem müşteri portali (web), hem mobile app, hem admin dashboard kullanıyor. Versioning: /portal/api/v1, future v2 için breaking changes hazır.

İlgili terimler