Skip to main content
Follow these organizational patterns to keep your codebase clean and maintainable.

Directory structure

The Starter Kit follows Next.js App Router conventions:

Component organization

Category-based structure

ui/ - Base UI primitives from Radix UI
components/ui/button.tsx
generic/ - Domain-agnostic reusable components
components/generic/info-box.tsx
project/ - Application-specific components
components/project/header.tsx

File naming conventions

Components: PascalCase
Pages: lowercase (Next.js convention)
Utilities and libraries: kebab-case
Configuration: kebab-case with .config.ts suffix

Server vs Client Components

Default to Server Components

app/dashboard/page.tsx

Use “use client” sparingly

components/theme-switcher.tsx

Extract client logic

Server Actions organization

Group by feature

Reusable helper pattern

lib/api-helpers.ts

Type definitions

Collocate with usage

components/project-card.tsx

Shared types in lib/types/

lib/types/api.ts

Configuration management

Centralized app config

config/app.config.ts

Environment-based config

config/mode.config.ts

Import organization

Consistent import order

Use path aliases

tsconfig.json

Code style

Function vs const for components

Early returns

Documentation

Component documentation

components/card.tsx

Inline comments (sparingly)

Next steps

Testing

Testing best practices

Performance

Performance optimization