This is a "real-world" example and is deployed to demo.react-redux-firebase.com. Project was based on the output of generator-react-firebase
, which generates a full project starter with react-redux-firebase
included.
-
Install dependencies:
npm install
-
Start Development server:
npm start
While developing, you will probably rely mostly on npm start
; however, there are additional scripts at your disposal:
npm run <script> |
Description |
---|---|
start |
Serves your app at localhost:3000 . HMR will be enabled in development. |
build:dev |
Same as build but overrides NODE_ENV to "development". |
build:prod |
Same as build but overrides NODE_ENV to "production". |
lint |
Lint all .js files. |
lint:fix |
Lint and fix all .js files. Read more on this. |
- Route protection using
redux-auth-wrapper
- Data input/validation using
redux-form
- Async & Sync route loading
- Real CI and Deployment settings (including
prod
andstage
environments) - Using different instances of Firebase based on environment
The application structure presented in this boilerplate is fractal, where functionality is grouped primarily by feature rather than file type. Please note, however, that this structure is only meant to serve as a guide, it is by no means prescriptive. That said, it aims to represent generally accepted guidelines and patterns for building scalable applications. If you wish to read more about this pattern, please check out this awesome writeup by Justin Greenberg.
.
├── bin # Build/Start scripts
├── config # Project and build configurations
├── server # Express application that provides Webpack middleware
│ └── main.js # Server application entry point
├── src # Application source code
│ ├── index.html # Main HTML page container for app
│ ├── main.js # Application bootstrap and rendering
│ ├── components # Global Reusable Presentational Components
│ ├── containers # Global Reusable Container Components
│ ├── layouts # Components that dictate major page structure
│ ├── routes # Main route definitions and async split points
│ │ ├── index.js # Bootstrap main application routes with store
│ │ └── Home # Fractal route
│ │ ├── index.js # Route definitions and async split points
│ │ ├── assets # Assets required to render components
│ │ ├── components # Presentational React Components
│ │ ├── container # Connect components to actions and store
│ │ ├── modules # Collections of reducers/constants/actions
│ │ └── routes ** # Fractal sub-routes (** optional)
│ ├── static # Static assets (not imported anywhere in source code)
│ ├── store # Redux-specific pieces
│ │ ├── createStore.js # Create and instrument redux store
│ │ └── reducers.js # Reducer registry and injection
│ └── styles # Application-wide styles (generally settings)
- Starting out with react-redux-starter-kit is an introduction to the components used in this starter kit with a small example in the end.
Build code before deployment by running npm run build:prod
.
- Login to Firebase (or Signup if you don't have an account) and create a new project
- Install cli:
npm i -g firebase-tools
- Login:
firebase login
Note: The next steps automatically through config set in the .travis.yml
. Use firebase login:ci
to generate a token and set it to FIREBASE_TOKEN
within your travis config.
- Build Project:
npm run build
- Confirm Firebase config by running locally:
firebase serve
- Deploy to firebase:
firebase deploy