Dev Tools · 1h ago
Colocate API Calls in Next.js App Router for Scalable Codebases
A frontend engineer at MTN Nigeria shares a pattern for organizing API calls in Next.js 15 App Router by placing them inside feature directories rather than a global services folder. The approach keeps code navigable even with 30+ feature modules, using a shared typed Axios instance for authentication. Each feature module owns its own api/index.ts file, preventing the maze-like structure of centralized services.
Meridian48 take
This is a practical, battle-tested pattern that addresses a real pain point in large Next.js projects, but its value depends on team discipline to maintain colocation.
Read the full reporting
Colocate Your API Layer: A Next.js App Router Pattern That Scales →
DEV Community
nextjsapi-architecture