blueromans/baseapp
๐ Production-ready React Native boilerplate with Auth, Redux Toolkit, TypeScript, and modern UI components. Save weeks of setup time!
BaseApp - React Native Starter Template
A production-ready React Native boilerplate with authentication, navigation, state management, and modern UI components pre-configured. This boilerplate provides a solid foundation for building scalable React Native applications with best practices and commonly needed features already implemented.
Why Use This Boilerplate?
This boilerplate saves weeks of development time by providing:
- Pre-built Authentication Flow: Skip the tedious auth setup with ready-to-use screens
- Production-Ready Architecture: Scalable folder structure following best practices
- Modern State Management: Redux Toolkit setup with persistence out of the box
- Type Safety: Full TypeScript configuration with strict type checking
- Performance Optimized: FlashList, Reanimated, and MMKV for blazing fast performance
- Developer Experience: ESLint, Prettier, and Husky pre-configured
- Cross-Platform Ready: Tested on both iOS and Android devices
Features
- Authentication Flow: Ready-to-use SignIn/SignUp screens with form validation
- Navigation: Tab navigation with nested stack navigators using React Navigation
- State Management: Redux Toolkit with Redux Persist for offline storage
- Internationalization: i18next integration for multi-language support
- Storage: MMKV for high-performance local storage
- UI Components:
- Reusable templates (ListTemplate, HeaderTemplate)
- Theme support with light/dark mode
- Keyboard-aware scroll views
- High-performance lists with FlashList
- Developer Experience:
- TypeScript configured
- ESLint and Prettier setup
- Husky git hooks for code quality
- Import sorting automation
Tech Stack
- React Native 0.81.4
- React Navigation v7
- Redux Toolkit & Redux Persist
- React Native Reanimated v4
- React Native Skia for graphics
- MMKV for storage
- i18next for internationalization
- TypeScript
What's Included in the Boilerplate
Pre-built Screens
- SignIn Screen: Email/password authentication with validation
- SignUp Screen: User registration with form validation
- Tab Screens (4): Example screens demonstrating different UI patterns
- Tab1: Basic content screen
- Tab2: List with pull-to-refresh using FlashList
- Tab3: Form inputs and keyboard handling
- Tab4: Settings and preferences
UI Components Library
- Atoms: Button, Text, TextInput, Icon, Spacer
- Molecules: Card, Header, ListItem, LoadingIndicator
- Templates: HeaderTemplate, ListTemplate for consistent layouts
Configured Libraries
- Navigation: Tab navigation with nested stacks
- State Management: Redux slices for auth, user, and app state
- Storage: MMKV for encrypted local storage
- Animations: Reanimated for smooth 60fps animations
- Graphics: Skia for advanced graphics rendering
- Forms: Keyboard-aware scroll view for better UX
- Lists: FlashList for high-performance lists
Project Structure
src/
โโโ components/ # Reusable UI components
โ โโโ atoms/ # Basic building blocks
โ โโโ molecules/ # Composite components
โ โโโ templates/ # Page templates
โโโ config/ # App configuration
โ โโโ api.config.ts # API endpoints
โ โโโ app.config.ts # App settings
โโโ constants/ # App constants
โโโ hooks/ # Custom React hooks
โ โโโ useTheme.ts # Theme hook
โ โโโ useStorage.ts # Storage hook
โโโ i18n/ # Internationalization
โ โโโ locales/ # Translation files
โโโ navigation/ # Navigation configuration
โ โโโ navigators/ # Stack, Tab, Auth navigators
โ โโโ types.ts # Navigation types
โโโ screens/ # Screen components
โ โโโ auth/ # Authentication screens
โ โโโ main/ # Main app screens
โโโ services/ # API and external services
โ โโโ api/ # API client setup
โโโ store/ # Redux store configuration
โ โโโ slices/ # Redux slices
โ โโโ index.ts # Store configuration
โโโ themes/ # Theme definitions
โ โโโ colors.ts # Color palette
โ โโโ fonts.ts # Typography
โ โโโ spacing.ts # Spacing system
โโโ types/ # TypeScript type definitions
โโโ utils/ # Utility functions
โโโ storage.ts # Storage utilities
โโโ validation.ts # Form validation
Quick Start Guide
Using This Boilerplate
- Clone and rename your project:
git clone <repository-url> MyAwesomeApp
cd MyAwesomeApp- Update project name:
- Change
nameinpackage.json - Update app name in
app.json - For iOS: Update display name in
ios/BaseApp/Info.plist - For Android: Update app name in
android/app/src/main/res/values/strings.xml
- Install and run:
npm install
cd ios && pod install && cd ..
npm run ios # or npm run androidGetting Started
Prerequisites
- Node.js 18+ and npm/yarn
- Xcode 15+ (for iOS development)
- Android Studio (for Android development)
- CocoaPods (for iOS dependencies)
Installation
- Clone the repository:
git clone <repository-url>
cd BaseApp- Install dependencies:
npm install
# or
yarn install- Install iOS dependencies (macOS only):
cd ios
bundle install
bundle exec pod install
cd ..Running the App
Start Metro Bundler
npm start
# or
yarn startRun on iOS
npm run ios
# or
yarn iosRun on Android
npm run android
# or
yarn androidAvailable Scripts
npm run start # Start Metro bundler
npm run ios # Run on iOS simulator
npm run android # Run on Android emulator
npm run lint # Run ESLint
npm run format # Format code with Prettier
npm run test # Run tests
npm run sort-imports # Sort imports in TypeScript filesDevelopment Workflow
Adding New Screens
- Create your screen component in
src/screens/ - Add navigation types in
src/navigation/types.ts - Register screen in appropriate navigator
State Management
The app uses Redux Toolkit with the following structure:
- Store configuration in
src/store/ - Create slices for different features
- Use Redux Persist for data persistence
Theming
- Theme definitions in
src/themes/ - Light and dark mode support
- Access theme via
useTheme()hook
Internationalization
- Translation files in
src/i18n/locales/ - Use
useTranslation()hook for translations - Language switching support built-in
Component Architecture
The project follows Atomic Design principles:
- Atoms: Basic building blocks (Button, Text, Input)
- Molecules: Composite components (Card, ListItem)
- Templates: Page layouts (ListTemplate, HeaderTemplate)
- Screens: Complete application screens
Boilerplate Scripts
The boilerplate includes helpful scripts in the scripts/ directory:
- sort-imports.cjs: Automatically organizes imports
- init.sh: Initial setup script for new projects
Code Quality
Pre-commit Hooks
The project uses Husky to run checks before commits:
- Linting with ESLint
- Code formatting with Prettier
- Import sorting
Troubleshooting
Common Issues
- iOS Build Fails: Make sure you've run
pod installin theiosdirectory - Metro Bundler Issues: Clear cache with
npx react-native start --reset-cache - Android Build Issues: Clean build with
cd android && ./gradlew clean - Module Resolution: Delete
node_modulesand reinstall
Development Tips
- Use Fast Refresh for instant updates (enabled by default)
- Press
Rtwice on Android orCmd+Ron iOS simulator to reload - Use React Native Debugger for advanced debugging
For more detailed troubleshooting, see the React Native Troubleshooting page.
Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Customization Guide
Changing Theme Colors
Edit src/themes/colors.ts to customize your app's color palette:
export const colors = {
primary: '#007AFF',
secondary: '#5856D6',
// Add your custom colors
};Adding New Screens
- Create screen in
src/screens/your-feature/ - Add to navigation in
src/navigation/navigators/ - Update types in
src/navigation/types.ts
Configuring API Endpoints
Update src/config/api.config.ts:
export const API_CONFIG = {
BASE_URL: 'https://your-api.com',
TIMEOUT: 10000,
};Adding Redux Slices
- Create slice in
src/store/slices/ - Add to root reducer in
src/store/index.ts - Use with
useSelectoranduseDispatchhooks
Performance Optimization Tips
- Use
FlashListinstead ofFlatListfor large lists - Implement lazy loading for heavy screens
- Use
React.memofor expensive components - Enable Hermes for Android (already configured)
- Use MMKV for storage instead of AsyncStorage
Resources
- React Native Documentation
- React Navigation
- Redux Toolkit
- React Native MMKV
- FlashList
- React Native Reanimated
- React Native Skia
Boilerplate Maintenance
This boilerplate is actively maintained. To update to the latest versions:
npm update
cd ios && pod update && cd ..Support
For issues and feature requests, please use the GitHub issue tracker.
Credits
Built with โค๏ธ using React Native and the amazing open-source community.