This project demonstrates the implementation of Clean Architecture, Domain-Driven Design (DDD) and SOLID principles in React Native with TypeScript.
- πΊπΈ English - Main documentation
- π§π· PortuguΓͺs (Portuguese) - DocumentaΓ§Γ£o em portuguΓͺs
- Presentation Layer: React Native components and hooks
- Domain Layer: Business logic and entities
- Infrastructure Layer: APIs and external services
- Entities: Post, User
- Value Objects: IDs, timestamps
- Services: postService, postApi
- Repositories: Abstraction for data access
- Single Responsibility: Each class has a single responsibility
- Open/Closed: Extensible without modification
- Liskov Substitution: Well-defined interfaces
- Interface Segregation: Specific interfaces
- Dependency Inversion: Inverted dependencies
- React Native - Mobile framework
- TypeScript - Static typing
- Tanstack React Query - State management and caching
- React Navigation - Navigation
- Lodash - JavaScript utilities
src/
βββ components/ # Reusable components
β βββ ui/ # UI components
β βββ layout/ # Layout components
βββ domain/ # Domain layer
β βββ Post/ # Post domain
β βββ postApi.ts # Infrastructure (API)
β βββ postService.ts # Domain service
β βββ postHooks.ts # React Query hooks
β βββ postListMock.ts # Mocked data
βββ screens/ # Application screens
β βββ app/
β βββ HomeScreen/ # Main screen
βββ types/ # TypeScript types
βββ utils/ # Utilities and hooks
- β Infinite scroll post list
- β Fixed header with title
- β Loading states
- β Error handling
- β Pull to refresh
- β Smart caching with React Query
- β Clear separation of responsibilities
- β Dependency inversion
- β Testability
- β Maintainability
- β Scalability
npm installnpx expo start# Check TypeScript types
npx tsc --noEmit
# Linting (if configured)
npx eslint src/PostItem: Displays an individual postLoadingSpinner: Loading indicatorErrorMessage: Displays errors with retryScreen: Base layout with safe area
HomeScreen: Manages state and business logic
usePosts: Fetches all postsusePost: Fetches post by IDusePostsByUser: Fetches posts by user
useDebounce: Value debouncinguseSearchWithDebounce: Search with debounce
- Consistent colors
- Hierarchical typography
- Standardized spacing
- Reusable components
- Informative loading states
- Friendly error handling
- Clear visual feedback
- Optimized performance
- Path mapping configured
- Strict mode enabled
- Well-defined types
- Optimized cache
- Automatic retry
- Background refetch
- Configured stale time
- React Query for caching
- Optimized FlatList
- useCallback for callbacks
- Component lazy loading
- Console logs for debugging
- Performance profiling
- Memory usage tracking
- Testable components
- Isolated hooks
- Mockable services
- Abstracted APIs
# Android
npx expo build:android
# iOS
npx expo build:iosREADME.md: Main documentation (English)README_EN.md: Portuguese documentation (PortuguΓͺs)
- Clean Architecture
- DDD principles
- SOLID principles
- TypeScript strict
- Component composition
- Conventional commits
- Feature branches
- Code review
- Documentation updates
This project is an educational example of Clean Architecture implementation in React Native.
Developed with β€οΈ following the best software architecture practices.