Root Structure
Source Directory Structure
Thesrc/ directory contains all application source code:
Directory Breakdown
app/
File-based routing powered by Expo Router. Routes are automatically generated from the file structure.Route Groups
Parentheses() create route groups without adding to the URL:
Dynamic Routes
Brackets[] create dynamic route segments:
Layout Files
_layout.tsx files define shared layouts for route groups:
app/_layout.tsx
components/
Reusable UI components organized by function:Component Naming
- Use PascalCase for component files:
FormField.tsxorform-field.tsx - Export components with PascalCase:
export function FormField() - Use descriptive names that indicate purpose
components/form-field.tsx
services/
API services handle all backend communication:Service Pattern
Each service follows a consistent structure:- interface.ts - Type definitions
- [name].service.ts - Service implementation
- Uses base
http.service.tsfor requests
services/auth/auth.service.ts
modules/
Feature-specific logic organized by domain:types/
TypeScript type definitions and enums:Type Naming Conventions
- Interfaces and types use PascalCase:
User,ShipmentDetails - Enums use PascalCase:
ShipmentStatus - Enum values use SCREAMING_SNAKE_CASE:
IN_TRANSIT,DELIVERED
types/shipment.types.ts
lib/
Third-party library configurations and wrappers:utils/
Utility functions and helpers:Utility Naming
- Use descriptive, action-oriented names
- Group related utilities in the same file
- Export individual functions, not default exports
utils/currency.ts
hooks/
Custom React hooks:Hook Naming
- All hooks start with
use:useThemeColor,useAuth - Use kebab-case for filenames:
use-theme-color.ts - Platform-specific hooks use extensions:
.ios.ts,.android.ts,.web.ts
constants/
App-wide constants and configuration:File Naming Conventions
General Rules
- Use kebab-case for file and folder names:
user-profile.tsx - Use PascalCase for component exports:
UserProfile - Use descriptive names that indicate file purpose
- Add
.ios,.android,.webextensions for platform-specific files
Examples
Module Organization
Feature-First Structure
Organize by feature when complexity increases:Shared vs. Feature-Specific
- Shared (
components/,hooks/,utils/): Used across multiple features - Feature-specific (
modules/,features/): Used within a single feature
Import Path Aliases
The project uses@/ alias for imports:
tsconfig.json:
Best Practices
1. Keep Components Small
Break large components into smaller, focused pieces:2. Colocate Related Files
Keep related files close together:3. Use Index Files for Clean Exports
types/index.ts
4. Separate Business Logic from UI
Next Steps
- Styling - Learn about the styling system
- Configuration - Configure app settings
- Environment Setup - Set up your development environment