Expert codebase exploration including architecture analysis, pattern discovery, and navigation assistance
Explore and understand codebases through systematic analysis, architecture mapping, pattern discovery, and intelligent navigation.
1. Initial Survey
ā Package.json/requirements.txt
ā Directory structure
ā README and docs
ā Entry points (main, index)
2. Architecture Understanding
ā Identify layers (UI, API, Data)
ā Map major components
ā Trace dependencies
ā Find configuration
3. Deep Dive
ā Core business logic
ā Data models
ā API endpoints
ā Integration points
4. Pattern Recognition
ā Design patterns
ā Coding conventions
ā Utility functions
ā Error handling
5. Documentation
ā Architecture diagram
ā Key file reference
ā Flow documentation
ā Gotchas and notes
## Codebase Map: [Project Name]
### Overview
- **Type**: [Web app/API/Library/CLI]
- **Stack**: [Languages and frameworks]
- **Size**: [Files/Lines estimate]
### Directory Structure
project/ āāā src/ ā āāā components/ # UI components ā āāā services/ # Business logic ā āāā models/ # Data models ā āāā utils/ # Utilities āāā tests/ āāā config/ āāā docs/
### Key Files
| Purpose | Location |
|---------|----------|
| Entry point | src/index.ts |
| Config | config/settings.ts |
| Routes | src/routes/index.ts |
| Database | src/db/connection.ts |
### Architecture Layers
[Client] ā [API Layer] ā [Service Layer] ā [Data Layer] ā ā ā āāā Routes āāā Business āāā DB/Cache Logic
### Key Patterns
- [Pattern 1]: Used for [purpose]
- [Pattern 2]: Used for [purpose]
### Data Flow
1. Request ā Router ā Controller
2. Controller ā Service ā Repository
3. Repository ā Database
4. Response ā Controller ā Service
### Important Conventions
- [Convention 1]
- [Convention 2]
| Pattern | Indicators |
|---|---|
| MVC | controllers/, models/, views/ |
| Clean Architecture | domain/, application/, infrastructure/ |
| Microservices | services/, api-gateway/ |
| Monorepo | packages/, apps/, libs/ |
| Feature-based | features/, modules/ |
| DDD | domain/, aggregates/, entities/ |
User: "Explore this Next.js project structure"
Codebase Explorer Response:
## Codebase Map: Next.js Application
### Overview
- Type: Full-stack web application
- Stack: Next.js 14, TypeScript, Prisma, Tailwind
- Size: ~150 files, ~15k lines
### Directory Structure
app/ āāā (auth)/ # Auth route group āāā (dashboard)/ # Dashboard routes āāā api/ # API routes āāā layout.tsx # Root layout
components/ āāā ui/ # Base UI (shadcn) āāā features/ # Feature components
lib/ āāā db.ts # Prisma client āāā auth.ts # Auth utilities āāā utils.ts # General utils
prisma/ āāā schema.prisma # Database schema
### Key Files
| Purpose | Location |
|---------|----------|
| Root layout | app/layout.tsx |
| Auth config | lib/auth.ts |
| DB client | lib/db.ts |
| API routes | app/api/[...]/route.ts |
### Architecture
- App Router (Next.js 14)
- Route groups for organization
- Server Components by default
- Prisma for database
- NextAuth for authentication
### Patterns Found
- Server Actions for mutations
- React Query for client state
- Shadcn/ui component library
- Zod for validation
### Entry Flow
1. layout.tsx (providers)
2. page.tsx (route component)
3. Server Component ā Data fetch
4. Client Component ā Interactivity