@mtopcu/rn-boilerplate
v0.1.12
Published
π Modern React Native boilerplate with Redux Toolkit, RTK Query, React Navigation, TypeScript, and comprehensive testing setup. Perfect starter template for production-ready apps.
Maintainers
Readme
π React Native Boilerplate Template
A modern, production-ready React Native template that provides a solid foundation for your mobile app development. Built with industry best practices and the latest tools.
π οΈ Built With
β‘ Quick Start
Create a new React Native project using this template:
npx @react-native-community/cli init MyApp --template @mtopcu/rn-boilerplateTable of Contents
π― Features
- ποΈ Modern Architecture: Built with Redux Toolkit and RTK Query
- π§ Navigation: React Navigation v6 with type safety
- π¨ TypeScript: Full TypeScript support for better development experience
- π§ͺ Testing: Jest and React Native Testing Library setup
- π± Cross-platform: iOS and Android support
- π§ Developer Tools: ESLint, Prettier, and pre-commit hooks
- π Production Ready: Optimized for deployment
- π¦ State Management: Redux Toolkit with async thunks
- π API Integration: RTK Query for efficient data fetching
- π Type Safety: Comprehensive TypeScript configuration
Installation
Prerequisites
Make sure you have the following tools installed on your system before running the project:
- Node.js
- Yarn (optional, npm can also be used)
- React Native CLI
Steps
- Create a new React Native project using the following command:
npx @react-native-community/cli init MyApp --template @mtopcu/rn-boilerplate- Navigate to the project directory:
cd MyApp- Set up environment configuration:
cp .env-example .envUpdate the
.envfile with your configuration values.Start the Metro server:
npx react-native start- Run the project on an emulator or a physical device:
npx react-native run-android
# or
npx react-native run-iosUsage
This boilerplate allows you to quickly add new features and extend the existing structure. The main file structure is described below:
Project Structure
src/
βββ App.tsx
βββ components/
β βββ index.ts
βββ provider/
β βββ ReduxProvider.tsx
β βββ index.ts
βββ router/
β βββ Router.tsx
β βββ index.ts
β βββ Navigators/
β βββ MainNavigator.tsx
β βββ index.ts
βββ screens/
β βββ HomeScreen/
β β βββ HomeScreen.tsx
β β βββ HomeScreen.test.ts
β β βββ index.tsx
β βββ index.ts
βββ services/
β βββ api.ts
β βββ baseQuery.ts
β βββ index.ts
βββ store/
β βββ store.ts
β βββ index.ts
β βββ slices/
β βββ authSlice.ts
β βββ index.ts
βββ ...π Libraries & Tools
Core Dependencies
- React Navigation - Type-safe navigation for React Native
- Redux Toolkit - Modern Redux state management
- RTK Query - Powerful data fetching and caching
Development Tools
- TypeScript - Static type checking for JavaScript
- ESLint - Code linting and formatting rules
- Prettier - Code formatting
- Jest - JavaScript testing framework
- React Native Testing Library - Simple testing utilities
Configuration
- React Native Config - Environment variable management
- Metro - JavaScript bundler for React Native
- Yarn - Package manager with workspaces support
API Configuration
The API configuration is managed through RTK Query and stored in the src/services/api.ts file. You can:
- Change the API base URL in your environment configuration
- Add new endpoints to the API slice
- Configure custom base queries in
src/services/baseQuery.tsFor more information, visit the RTK Query documentation.
Roadmap & Future Features
- π Redux Persist - State persistence for better user experience
- π Storybook - Component development and testing environment
- π§ͺ E2E Testing - End-to-end testing with Detox or Appium
- π€ Code Generation - Scripts to generate components, screens, and slices
- π Dark Mode - Theme switching support
- π Internationalization - Multi-language support
- π± Push Notifications - Firebase/native push notification setup
Contributing
Contributions are welcome! Feel free to open an issue or submit a pull request if you have any improvements or new features to add.
