A comprehensive, production-ready React Native template with modern architecture, internationalization, and developer-friendly code generation.
# Create new project
npx react-native init MyApp --template react-native-template-modern-stack
# Navigate to project
cd MyApp
# Run the app
npm run ios # iOS
npm run android # Android
- ✅ Modular architecture - Feature-based organization with clear separation
- ✅ TypeScript - Full type safety throughout the app
- ✅ Path aliases - Clean imports with
@/
prefix - ✅ Screen/Container pattern - Business logic separated from UI
- ✅ Redux Toolkit - Modern Redux with minimal boilerplate
- ✅ React Query (TanStack) - Server state management with caching
- ✅ Typed hooks -
useAppSelector
&useAppDispatch
- ✅ Custom hooks - Reusable logic in shared and module-specific hooks
- ✅ MMKV - Lightning-fast native storage
- ✅ Encrypted storage - Secure storage for sensitive data (tokens, user data)
- ✅ Storage utilities - Easy-to-use storage service with hooks
- ✅ Persistent preferences - Theme, language, and user settings
- ✅ 3 Languages - English, French, Arabic with native translations
- ✅ RTL Support - Complete right-to-left layout for Arabic
- ✅ Language switching - Beautiful language selection interface
- ✅ RTL-aware components - Automatic layout adaptation
- ✅ Locale formatting - Date, number, and currency formatting
- ✅ 25+ Currencies - Major world currencies with proper symbols
- ✅ Currency formatting - Professional price display with locale support
- ✅ Exchange utilities - Currency conversion and calculation helpers
- ✅ Compact formatting - Smart formatting (1.5M, 2.3K) for large numbers
- ✅ Formik integration - Powerful form management
- ✅ Yup validation - Schema-based validation with i18n messages
- ✅ Custom form hooks - Reusable form logic with validation helpers
- ✅ Real-time validation - Instant feedback with proper error handling
- ✅ React Navigation v6 - Latest navigation patterns with TypeScript
- ✅ React Native Bootsplash - Native splash screen
- ✅ Safe Area Context - Proper safe area handling
- ✅ SVG Support - Scalable vector graphics
- ✅ Theme system - Light/dark theme with persistence
- ✅ Comprehensive code generators - 8+ Plop generators for rapid development
- ✅ ESLint & Prettier - Integrated code formatting and linting
- ✅ Pre-commit hooks - Automated code quality checks
- ✅ VS Code integration - Optimized settings and extensions
- ✅ TypeScript support - Full type checking and IntelliSense
- ✅ Module generators - Complete feature modules in seconds
- ✅ Hook generators - API, storage, form, and basic hooks
- ✅ Component generators - Functional, stateful, and prop-based components
- ✅ Fastlane integration - Automated iOS and Android deployments
- ✅ TestFlight deployment - Automated iOS beta distribution
- ✅ Google Play deployment - Automated Android app publishing
- ✅ GitHub Actions - Complete CI/CD pipeline included
- ✅ Code signing - Match integration for iOS certificates
- ✅ Build automation - Cross-platform build scripts
src/
├── core/ # Core app configuration
│ ├── config/ # React Query, app configuration
│ ├── constants/ # Colors, spacing, typography, storage keys
│ ├── libs/ # i18n, HTTP client, external lib configs
│ ├── locales/ # Translation files (en, fr, ar)
│ ├── navigation/ # Root navigation setup
│ └── store/ # Redux store configuration
├── shared/ # Shared resources across modules
│ ├── components/ # Reusable UI components (Button, Input, RTL components)
│ ├── hooks/ # Shared hooks (useApi, useStorage, useI18n, useCurrency)
│ ├── screens/ # Shared screens (Home, etc.)
│ └── services/ # Shared services (storage, HTTP client)
└── modules/ # Feature modules
├── auth/ # Authentication module
│ ├── containers/ # Pure UI components (WelcomeContainer, LoginContainer)
│ ├── screens/ # Business logic (WelcomeScreen, LoginScreen)
│ ├── hooks/ # Auth hooks (useAuth, useLoginForm)
│ ├── navigation/ # Auth navigation stack
│ ├── services/ # Auth API services
│ └── state/ # Auth Redux slice
└── profile/ # Profile module
├── containers/ # Pure UI (ProfileContainer, LanguageContainer)
├── screens/ # Business logic (ProfileScreen, LanguageScreen)
├── hooks/ # Profile hooks (useProfile, useTheme)
├── navigation/ # Profile navigation stack
├── services/ # Profile API services
└── state/ # Profile Redux slice
-
useApi
- Generic API operations with React Query integration -
useStorage
- MMKV storage operations (regular & secure) -
useI18n
- Internationalization with RTL support -
useCurrency
- Currency formatting and conversion -
useAppState
- App lifecycle management -
useNetworkStatus
- Network connectivity monitoring
-
useAuth
- Complete authentication state and actions -
useLoginForm
- Login form with Formik + Yup validation
-
useProfile
- Profile data management with API integration -
useTheme
- Theme switching with persistence
Handle all business logic, state management, and side effects:
// ProfileScreen.tsx - Business Logic
export const ProfileScreen: React.FC = () => {
const {user, logout} = useAuth();
const {theme, toggleTheme} = useTheme();
const {t} = useI18n();
const navigation = useNavigation();
const handleLanguagePress = () => {
navigation.navigate('Language');
};
const handleLogout = () => {
Alert.alert(t('profile.logout'), t('profile.logoutConfirm'), [
{text: t('common.cancel'), style: 'cancel'},
{text: t('profile.logout'), style: 'destructive', onPress: logout},
]);
};
return (
<ProfileContainer
user={user}
theme={theme}
onToggleTheme={toggleTheme}
onLanguagePress={handleLanguagePress}
onLogout={handleLogout}
/>
);
};
Focus solely on presentation with no business logic:
// ProfileContainer.tsx - Pure UI
interface ProfileContainerProps {
user: User | null;
theme: 'light' | 'dark';
onToggleTheme: () => void;
onLanguagePress: () => void;
onLogout: () => void;
}
export const ProfileContainer: React.FC<ProfileContainerProps> = ({
user,
theme,
onToggleTheme,
onLanguagePress,
onLogout,
}) => {
const {t, currentLanguage} = useI18n();
return (
<SafeAreaView style={styles.container}>
{/* Pure UI implementation */}
</SafeAreaView>
);
};
# Interactive generator menu
npm run generate
# or
npm run g
# Specific generators
npm run g:module # Complete module with all files
npm run g:screen # Screen + container pair
npm run g:component # Reusable UI component
npm run g:hook # Custom hook (API, storage, form, basic)
npm run g:service # API service (basic or CRUD)
npm run g:slice # Redux Toolkit slice
npm run g:navigator # Navigation (stack, tab, drawer)
npm run g:feature # Quick: screen + container + hook
Creates a complete feature module:
npm run g:module
# Name: products
# Include hooks: Yes
# Include components: No
Generated structure:
src/modules/products/
├── containers/ProductsContainer.tsx
├── screens/ProductsScreen.tsx
├── hooks/
│ ├── useProducts.ts
│ └── index.ts
├── navigation/ProductsNavigator.tsx
├── services/productsService.ts
├── state/productsSlice.ts
└── index.ts
- Basic - Simple hook with loading/error states
- API - React Query integration with CRUD operations
- Storage - MMKV storage with persistence
- Form - Formik + Yup validation with i18n
- Functional - Simple stateless component
- With Props - Component with TypeScript interface
- With State - Component with local state management
Carefully chosen languages showcasing different script systems and directions:
// useI18n hook with RTL support
import {useI18n} from '@/shared/hooks';
const MyComponent = () => {
const {
t, // Translation function
currentLanguage, // Current language code
isRTL, // RTL detection
getTextAlign, // RTL-aware text alignment
getFlexDirection, // RTL-aware flex direction
changeLanguage, // Language switching
} = useI18n();
return (
<View style={{flexDirection: getFlexDirection()}}>
<Text style={{textAlign: getTextAlign()}}>
{t('auth.login.title')}
</Text>
</View>
);
};
Supported Languages:
- 🇺🇸 English (en) - Left-to-Right, Latin script
- 🇫🇷 French (fr) - Left-to-Right, Latin script with accents
- 🇸🇦 Arabic (ar) - Right-to-Left, Arabic script
Full right-to-left layout support for Arabic:
// RTL-aware components
import {RTLText, RTLView} from '@/shared/components';
const RTLComponent = () => {
return (
<RTLView direction="auto">
<RTLText align="auto">
Automatically adapts to current language direction
</RTLText>
</RTLView>
);
};
RTL Features:
- ✅ Automatic layout direction - Flex direction reverses for RTL
- ✅ Text alignment - Text aligns right for Arabic
- ✅ RTL-aware components - RTLText and RTLView
- ✅ Layout helpers - getTextAlign() and getFlexDirection()
- ✅ Visual indicators - RTL badges and direction hints
- ✅ Native RTL support - I18nManager integration
Professional language switching interface:
🇺🇸 English ✓ (if selected)
Left-to-Right
[LTR]
🇫🇷 Français
Gauche à Droite
[LTR]
🇸🇦 العربية
من اليمين إلى اليسار
[RTL] ← RTL indicator
// useCurrency hook
import {useCurrency} from '@/shared/hooks';
const PriceComponent = () => {
const {
formatCurrency, // $99.99
formatCurrencyCompact, // $1.5M
parseCurrency, // Parse currency strings
convertCurrency, // Currency conversion
defaultCurrency, // User's preferred currency
availableCurrencies, // All available currencies
changeCurrency, // Change default currency
} = useCurrency();
return (
<View>
<Text>{formatCurrency(99.99, 'USD')}</Text> {/* $99.99 */}
<Text>{formatCurrencyCompact(1500000, 'EUR')}</Text> {/* €1.5M */}
<Text>Current: {defaultCurrency}</Text> {/* USD */}
</View>
);
};
Supported Currencies:
- Americas: USD, CAD, BRL, MXN
- Europe: EUR, GBP, CHF, SEK, NOK, DKK, PLN, CZK, HUF, RUB
- Asia: JPY, CNY, KRW, INR, SGD, HKD
- Others: AUD, NZD, ZAR, TRY, AED, SAR
- ✅ Precise calculations - Using currency.js for accuracy
- ✅ Symbol mapping - Proper currency symbols (€, £, ¥, etc.)
- ✅ Multiple formats - Symbol only, code only, or both
- ✅ Compact notation - Smart formatting (1.5M, 2.3K)
- ✅ Conversion utilities - Exchange rate calculations
- ✅ Locale-aware - Formatting based on user's locale
// useLoginForm hook with i18n validation
export const useLoginForm = ({onSubmit}) => {
const {t} = useI18n();
const loginSchema = Yup.object().shape({
email: Yup.string()
.email(t('auth.validation.emailInvalid'))
.required(t('auth.validation.emailRequired')),
password: Yup.string()
.min(6, t('auth.validation.passwordMinLength', {count: 6}))
.required(t('auth.validation.passwordRequired')),
});
const formik = useFormik({
initialValues: {email: '', password: ''},
validationSchema: loginSchema,
onSubmit,
});
const getFieldError = (fieldName) => {
return formik.touched[fieldName] && formik.errors[fieldName]
? formik.errors[fieldName]
: undefined;
};
return {formik, getFieldError, isFormValid: formik.isValid && formik.dirty};
};
- ✅ Real-time validation - Instant feedback as user types
- ✅ Internationalized errors - Error messages in user's language
- ✅ Custom validation hooks - Reusable form logic
- ✅ Field-level errors - Granular error handling
- ✅ Form state management - Loading, dirty, valid states
// Button with loading and variant support
<Button
title={t('auth.login.signIn')}
onPress={handleLogin}
loading={isLoading}
variant="primary"
disabled={!isFormValid}
/>
// Input with validation and i18n
<Input
label={t('auth.login.email')}
value={email}
onChangeText={setEmail}
error={getFieldError('email')}
placeholder={t('auth.login.emailPlaceholder')}
keyboardType="email-address"
/>
// useTheme hook with persistence
const {theme, toggleTheme, setTheme} = useTheme();
// Theme persists across app sessions
// Integrates with Redux and MMKV storage
npx react-native init MyApp --template react-native-template-modern-stack
cd MyApp
The template includes an interactive setup script that runs automatically:
🚀 React Native Modern Template - App Setup
This script will help you customize your app name and bundle identifier.
ℹ Current app name: ModernReactNativeApp
Do you want to customize the app name and bundle ID? (y/N): y
Enter your app name (e.g., "My Awesome App"): My Shopping App
Enter your bundle ID (e.g., "com.company.myapp"): com.mycompany.shoppingapp
📋 Summary:
App Name: My Shopping App
Bundle ID: com.mycompany.shoppingapp
Proceed with these changes? (Y/n): y
What gets customized:
- 📱 App display name - What users see on their device
- 📦 Bundle identifier - Unique ID for iOS and Android (com.company.app)
- 🔧 Project files - Updates all configuration files automatically
- 🧹 Cleanup - Cleans build caches and prepares for development
Run setup anytime:
npm run setup # Interactive app customization
npm run rename # Same as setup
// Update API configuration
// src/core/libs/httpClient.ts
const API_BASE_URL = 'https://your-api-url.com/api';
// Update storage encryption (production)
// src/shared/services/storage.ts
const ENCRYPTION_KEY = 'your-production-encryption-key';
# Generate a complete products module
npm run g:module
# Name: products
# Include hooks: Yes
# Generate a settings screen
npm run g:screen
# Name: Settings
# Module: profile
# With container: Yes
# Setup Fastlane for automated deployments
npm run setup:fastlane
# Configure your credentials in .env.fastlane
# Then deploy to beta
npm run deploy:beta
# Or deploy to production
npm run deploy:release
npm run ios # iOS
npm run android # Android
Complete CI/CD pipeline for both iOS and Android:
# Setup Fastlane (interactive)
npm run setup:fastlane
# Development builds
npm run build:ios:dev # Build iOS development IPA
npm run build:android:dev # Build Android development APK
npm run build:dev # Build both platforms
# Beta deployments
npm run deploy:ios:beta # Deploy to TestFlight
npm run deploy:android:beta # Deploy to Play Store Beta
npm run deploy:beta # Deploy both platforms
# Production deployments
npm run deploy:ios:release # Deploy to App Store
npm run deploy:android:release # Deploy to Play Store
npm run deploy:release # Deploy both platforms
Automated deployment pipeline included:
- Push to main → Automatic beta deployment
- Git tags (v*) → Automatic production deployment
- Manual dispatch → Custom deployments
Setup:
- Configure GitHub Secrets (Apple ID, certificates, etc.)
- Push to main branch
- Apps automatically deploy to TestFlight and Play Store Beta
- 📱 iOS: TestFlight → App Store
- 🤖 Android: Internal Testing → Beta → Production
- 🔄 Cross-platform: Deploy both simultaneously
- 📸 Screenshots: Automated screenshot generation
- 🔐 Code Signing: Match integration for iOS certificates
// useAuth hook handles complete auth flow
const {
user,
isAuthenticated,
login,
logout,
initializeAuth,
isLoginPending,
} = useAuth();
// Automatic token management and secure storage
await login({email, password});
// useApi hook with React Query
const {data, isLoading, error, refetch} = useApiQuery(
['users'],
'/users'
);
const createMutation = useApiMutation('/users', 'post');
await createMutation.mutateAsync(userData);
// useStorage hook with MMKV
const [theme, setTheme] = useStorage('theme', 'light');
const [token, setToken] = useSecureStorage('auth_token');
// Automatic persistence and retrieval
// Complete i18n with RTL support
const {t, isRTL, changeLanguage} = useI18n();
// Automatic layout adaptation
<View style={{flexDirection: isRTL ? 'row-reverse' : 'row'}}>
<Text style={{textAlign: isRTL ? 'right' : 'left'}}>
{t('welcome.title')}
</Text>
</View>
Modular testing structure that scales with your app:
src/
├── __tests__/ # Global test setup and utilities
│ ├── setup.ts # Jest configuration and mocks
│ ├── mocks/ # API mocks with MSW
│ └── utils/ # Test utilities and helpers
├── modules/
│ ├── auth/
│ │ └── hooks/__tests__/ # Auth hook tests
│ └── profile/
│ └── hooks/__tests__/ # Profile hook tests
└── shared/
├── hooks/__tests__/ # Shared hook tests
└── utils/__tests__/ # Utility function tests
# Run all tests
npm test
# Watch mode for development
npm run test:watch
# Generate coverage report
npm run test:coverage
# CI/CD testing
npm run test:ci
# Module-specific tests
npm run test:auth # Auth module tests
npm run test:profile # Profile module tests
npm run test:shared # Shared utilities tests
# Test type-specific
npm run test:hooks # All hook tests
npm run test:utils # All utility tests
npm run test:unit # Unit tests
npm run test:integration # Integration tests
- Jest - Test runner and framework
- React Testing Library - Component and hook testing
- MSW (Mock Service Worker) - API mocking
- Redux Mock Store - State management testing
- Custom test utilities - Reusable testing patterns
// Example: useAuth hook test
describe('useAuth', () => {
it('should login successfully', async () => {
const {result} = renderHook(() => useAuth(), {
wrapper: HookWrapper,
});
await act(async () => {
await result.current.login({
email: 'test@example.com',
password: 'password123',
});
});
expect(result.current.isAuthenticated).toBe(true);
});
});
// Example: validation utility test
describe('isValidEmail', () => {
it('should validate correct emails', () => {
expect(isValidEmail('test@example.com')).toBe(true);
expect(isValidEmail('invalid-email')).toBe(false);
});
});
// Example: API integration test with MSW
describe('Auth API', () => {
it('should handle login API call', async () => {
const response = await authService.login({
email: 'test@example.com',
password: 'password123',
});
expect(response.success).toBe(true);
expect(response.data.user).toBeDefined();
});
});
Pre-built utilities for consistent testing:
// Custom render with providers
import {renderWithProviders} from '@/__tests__/utils/test-utils';
const {store, queryClient} = renderWithProviders(
<MyComponent />,
{
initialState: mockState,
}
);
- Global: 70% coverage minimum
- Hooks: 80% coverage minimum
- Utils: 85% coverage minimum
- Critical paths: 90% coverage minimum
- API calls - MSW for realistic API mocking
- Storage - Jest mocks for MMKV
- Navigation - Mock navigation objects
- External libraries - Comprehensive mocks included
Seamless code formatting and linting with zero configuration:
# Format all files
npm run format
# Check formatting
npm run format:check
# Lint code
npm run lint
# Fix linting issues
npm run lint:fix
# Run all quality checks
npm run code-quality
# Fix all issues automatically
npm run code-quality:fix
Automatic code quality enforcement:
# Install git hooks
npm run install-hooks
# Manual pre-commit check
npm run pre-commit
What gets checked:
- ✅ TypeScript type checking
- ✅ ESLint code quality rules
- ✅ Prettier code formatting
- ✅ Tests for modified files
- ✅ Import organization and sorting
Optimized development experience:
- Format on save - Automatic code formatting
- ESLint integration - Real-time error highlighting
- Recommended extensions - Essential VS Code extensions
- Workspace settings - Consistent team configuration
- IntelliSense - Full TypeScript support
-
.prettierrc.js
- Prettier formatting rules -
.eslintrc.js
- ESLint + Prettier integration -
.vscode/settings.json
- VS Code workspace settings -
.vscode/extensions.json
- Recommended extensions
The template includes a powerful post-init script that helps you customize your app:
# Runs automatically after template creation
# Or run manually anytime:
npm run setup
npm run rename
Features:
- 📱 Custom app name - Set your app's display name
- 📦 Bundle ID setup - Configure unique identifier (com.company.app)
- 🔧 Automatic updates - Updates all iOS and Android configuration files
- 🧹 Build cleanup - Cleans caches and prepares for development
- ✅ Validation - Ensures bundle ID follows proper format
Example customization:
App Name: "My Shopping App"
Bundle ID: "com.mycompany.shoppingapp"
✓ iOS bundle identifier updated
✓ Android package name updated
✓ Project files updated
✓ Build caches cleaned
If you prefer manual setup:
# Using react-native-rename directly
npx react-native-rename "Your App Name" -b "com.yourcompany.yourapp"
# Update additional files
# - package.json (name, displayName)
# - app.json (name, displayName)
# Generate API hook
npm run g:hook
# Name: UserProfile
# Location: shared
# Type: api
# Generate storage hook
npm run g:hook
# Name: AppSettings
# Location: shared
# Type: storage
# Add new module
npm run g:module
# Name: notifications
# Include hooks: Yes
# Include components: Yes
# Generate navigator
npm run g:navigator
# Name: Settings
# Module: profile
# Type: stack
- ✅ Separation of concerns - Business logic in screens, UI in containers
- ✅ Custom hooks - Reusable logic extraction
- ✅ Module organization - Feature-based structure
- ✅ Type safety - Full TypeScript integration
- ✅ React Query caching - Intelligent server state management
- ✅ MMKV storage - Lightning-fast native storage
- ✅ Lazy loading - Code splitting and dynamic imports
- ✅ Optimized re-renders - Proper memoization patterns
- ✅ Encrypted storage - Sensitive data protection
- ✅ Token management - Automatic refresh and secure storage
- ✅ Input validation - Schema-based validation with Yup
- ✅ Error boundaries - Graceful error handling
npx react-native start --reset-cache
cd ios && pod install && cd ..
npx react-native run-ios
cd android && ./gradlew clean && cd ..
npx react-native run-android
# Restart the app after changing to RTL language
# RTL changes require app restart for full effect
- Redux Toolkit - Modern Redux patterns
- React Query - Server state management
- MMKV - Fast native storage
- React Navigation - Navigation library
- Formik - Form management
- Yup - Schema validation
- react-i18next - Internationalization
- currency.js - Currency calculations
- Complete architecture - Proven patterns for scalable apps
- Security focused - Encrypted storage and secure token management
- Performance optimized - Fast storage, intelligent caching
- Internationalization - Global-ready with RTL support
- Comprehensive generators - 8+ code generators for rapid development
- Type safety - Full TypeScript integration throughout
- Clear documentation - Extensive examples and best practices
- Modern tooling - Latest versions of all dependencies
- Authentication flow - Complete login/logout with token management
- Profile management - User profiles with theme and language switching
- Form handling - Advanced forms with validation and i18n
- Currency system - Professional price formatting and calculations
- RTL support - Complete right-to-left layout system
- Modular design - Easy to add new features and modules
- Separation of concerns - Clean architecture patterns
- Reusable components - Shared hooks and components
- Maintainable code - Consistent patterns and structure
Perfect for:
- 🌍 International applications with multi-language support
- 💰 E-commerce apps with currency handling
- 🏢 Enterprise applications requiring robust architecture
- 🚀 Rapid prototyping with comprehensive code generation
- 📱 Production apps needing proven patterns and security
Start building your next amazing React Native app today! 🚀✨