- a React Native (v0.59.9) application (in "ejected" mode to allow using dependencies that rely on native code)
- a clear directory layout to provide a base architecture for your application
- Redux (v4.0.1) to help manage state
- Redux Persist (v5.10.0) to persist the Redux state
- Redux Sagas (v1.0.2) to separate side-effects and logic from state and UI logic
- React Navigation (v3.6.0) with a
NavigationService
to handle routing and navigation in the app, with a splash screen setup by default - reduxsauce (v1.0.1) to facilitate using Redux
- axios to make API calls (v0.19.0)
- prettier and eslint preconfigured for React Native
The boilerplate includes an example (displaying fake user data) from UI components to the saga. The example is easy to remove so that it doesn't get in the way.
App/Components
: presentational componentsApp/Containers
: container components, i.e. the application's screensApp/Assets
: assets (image, audio files, ...) used by the applicationApp/Navigators
: react navigation navigatorsApp/Sagas
: redux sagasApp/Services
: application services, e.g. API clients
For more information on each directory, click the link and read the directory's README.
To create a new project using the boilerplate:
- clone this repository
- remove the previous git history:
rm -rf .git/
- install the npm dependencies by running
yarn
- rename the React Native project to your own project name:
yarn run rename -- <YourProjectName>
(the default name isBoilerplate
)
Assuming you have all the requirements installed, you can setup and run the project by running:
yarn install
to install the dependenciesrun:android
to run the Android application (remember to start a simulator or connect an Android phone)run:ios
to run the iOS application (remember to start a simulator or connect an iPhone phone)
If your applicaiton fails to start after using the yarn run rename
command, please take a look at this issue
We looked into existing boilerplates before starting this project, and while many of them are awesome, we did not find what we were looking for.
The most popular is mcnamee's Starter Kit, which is unfortunately limited by Expo and misses Redux Saga.
If we look at the rest (and ignore unmaintained projects), many popular boilerplates are too opinionated: they include 3rd party services or very strong architecture choices that we are not comfortable with. To name a few: Snowflake runs with a Hapi Server running on Redhat OpenShift, Hasura's boilerplate uses Hasura's SaaS for authentication, Apollo's StarterKit is targeted at GraphQL using Apollo, the Meteor Boilerplate targets Meteor…
Finally some did not contain the architecture we are looking for (the separation of concerns with Redux, Sagas, etc.), for example re-start.
One interesting exception is Ignite IR Boilerplate "Andross", but after consideration we decided not to use it because of the large amount of unnecessary code/components it provided.