Skip to content
Boilerplate (seed) project for creating web apps with React.js, GraphQL.js and Relay
JavaScript HTML Dockerfile
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Update Material UI and other deps (#334) Jul 8, 2019
.github Update VSCode launch configuration Jul 22, 2019
.vscode Refactor GraphQL queries and mutations (#360) Aug 21, 2019
migrations Remove Cache-Control header Mar 17, 2019
public Add GraphQL API endpoint Feb 25, 2018
scripts Use Firebase config; merge GCFs into one (#330) Mar 13, 2019
seeds Refactor open (login) window functionality (#304) May 12, 2018
src Add missing labels to form fields (#360) Aug 21, 2019
.babelrc Remove Styled Components; add .env/.env.production Sep 7, 2018
.editorconfig Add database migrations Feb 27, 2018
.env Integrate Facebook Customer Chat (#331) Mar 16, 2019
.env.production
.env.test Use Firebase config; merge GCFs into one (#330) Mar 13, 2019
.eslintrc Remove Flow (#345) Jul 19, 2019
.gitattributes Integrate Relay Modern and create-react-app (#238) Aug 7, 2017
.gitignore Remove Flow (#345) Jul 19, 2019
.prettierignore Refactor open (login) window functionality (#304) May 12, 2018
.prettierrc Refactor to integrate with Firebase (#271) Dec 16, 2017
LICENSE.txt Integrate Relay Modern and create-react-app (#238) Aug 7, 2017
README.md Refactor GraphQL queries and mutations (#360) Aug 21, 2019
firebase.json Remove Flow (#345) Jul 19, 2019
knexfile.js Use Firebase config; merge GCFs into one (#330) Mar 13, 2019
package.json Refactor GraphQL queries and mutations (#360) Aug 21, 2019
schema.graphql Refactor GraphQL queries and mutations (#360) Aug 21, 2019
storage.rules Refactor to integrate with Firebase (#271) Dec 16, 2017
yarn.lock Refactor GraphQL queries and mutations (#360) Aug 21, 2019

README.md

React Starter Kit for Firebase   a.k.a. Serverless Edition
Build Status Greenkeeper Twitter

React Starter Kit for Firebase is a popular project template (aka, boilerplate) for building modern, scalable web applications with React, Relay, and GraphQL using serverless infrastructure provided by Google Cloud (Cloud SQL, Cloud Functions, CDN hosting, and file storage). It allows you to save time and build upon a solid foundation and design patterns.

View online demo (API, data model)  |  Follow us on Twitter  |  Get FREE support on Telegram  |  We're hiring!


This project was bootstraped with React Starter Kit for Firebase by Kriasoft.

Tech Stack

Also, you need to be familiar with HTML, CSS, JavaScript (ES2015) and React.

Directory Layout

├── build/                         # Compiled output
├── migrations/                    # Database schema migration files
├── node_modules/                  # 3rd-party libraries and utilities
├── public/                        # Static files such as favicon.ico etc.
├── scripts/                       # Automation scripts (yarn update-schema etc.)
├── src/                           # Application source code
│   ├── admin/                     # Admin section (Dashboard, User Management etc.)
│   ├── common/                    # Shared React components and HOCs
│   ├── hooks/                     # React.js hooks and Context providers
│   ├── icons/                     # Icon components
│   ├── legal/                     # Terms of Use, Privacy Policy, etc.
│   ├── misc/                      # Other pages (about us, contacts, etc.)
│   ├── mutations/                 # GraphQL mutations to be used on the client
│   ├── news/                      # News section (example)
│   ├── server/                    # Server-side code (API, authentication, etc.)
│   │   ├── db/                    # Database client
│   │   ├── mutations/             # GraphQL mutations
│   │   ├── queries/               # The top-level GraphQL query fields
│   │   ├── story/                 # GraphQL types: Story, Comment etc.
│   │   ├── templates/             # HTML templates for server-side rendering
│   │   ├── user/                  # GraphQL types: User, UserRole, UserIdentity etc.
│   │   ├── api.js                 # GraphQL API middleware
│   │   ├── app.js                 # Express.js application
│   │   ├── config.js              # Configuration settings to be passed to the client
│   │   ├── Context.js             # GraphQL context wrapper
│   │   ├── createRelay.js         # Relay factory method for Node.js environment
│   │   ├── index.js               # Node.js app entry point
│   │   ├── login.js               # Authentication middleware (e.g. /login/facebook)
│   │   ├── schema.js              # GraphQL schema
│   │   └── ssr.js                 # Server-side rendering, e.g. ReactDOMServer.renderToString(<App />)
│   ├── user/                      # User pages (login, account settings, user profile, etc)
│   ├── utils/                     # Utility functions
│   ├── createRelay.js             # Relay factory method for browser envrironment
│   ├── index.js                   # Client-side entry point, e.g. ReactDOM.render(<App />, container)
│   ├── router.js                  # Universal application router
│   ├── serviceWorker.js           # Service worker helper methods
│   └── theme.js                   # Overrides for Material UI default styles
├── ssl/                           # SSL certificates for connecting to Cloud SQL instance
├── .env                           # Environment variables for local development
├── .env.production                # Environment variables for the production build
├── .env.test                      # Environment variables for the test build
├── graphql.schema                 # GraphQL schema (auto-generated, used by Relay)
└── package.json                   # The list of project dependencies + NPM scripts

Prerequisites

Getting Started

Just clone the repo, update environment variables in .env and/or .env.local file, and start hacking:

$ git clone https://github.com/kriasoft/react-firebase-starter.git MyApp
$ cd MyApp
$ yarn setup                       # Installs dependencies; creates PostgreSQL database
$ yarn start                       # Compile the app and opens it in a browser with "live reload"

Then open http://localhost:3000/ to see your app.

npm start

In order to re-compile GraphQL fragments, run yarn relay or yarn relay --watch (in watch mode).

How to Migrate Database Schema

$ yarn db-change                   # Create a new database migration file
$ yarn db-migrate                  # Migrate database to the latest version
$ yarn db-rollback                 # Rollback the latest migration
$ yarn db-backup --env=prod        # Write database backup to backup.sql
$ yarn db-restore --env=dev        # Restore database from backup.sql
$ yarn db                          # Open PostgreSQL shell (for testing/debugging)

Note: Appending --env=prod or --env=test flags to any of the commands above will load the corresponding database settings for the selected deployment environment from Firebase Config API

How to Test

$ yarn lint                        # Check JavaScript and CSS code for potential issues
$ yarn lint-fix                    # Attempt to automatically fix ESLint warnings
$ yarn test                        # Run unit tests. Or, `yarn test -- --watch`

How to Deploy

$ yarn build                       # Build the in production mode (NODE_ENV=production)
$ yarn deploy-test                 # Deploy the app to TEST environment
$ yarn deploy-prod                 # Deploy the app to PROD environment

For more information refer to the Deployment guide in the project's Wiki.

How to Update

If you keep the original Git history after cloning this repo, you can always fetch and merge the recent updates back into your project by running:

$ git remote add rsk https://github.com/kriasoft/react-firebase-starter.git
$ git checkout master
$ git fetch rsk
$ git merge rsk/master
$ yarn install

NOTE: Try to merge as soon as the new changes land on the master branch in the upstream repository, otherwise your project may differ too much from the base/upstream repo. Alternatively, you can use a folder diff tool like Beyond Compare for keeping your project up to date with the base repository.

How to Contribute

Anyone and everyone is welcome to contribute to this project. The best way to start is by checking our open issues, submit a new issues or feature request, participate in discussions, upvote or downvote the issues you like or dislike, send pull requests.

Learn React.js and ES6

🎓   React for Beginners and ES6 Training Course by Wes Bos
📗   React: Up & Running: Building Web Applications by Stoyan Stefanov (Aug, 2016)
📗   Getting Started with React by Doel Sengupta and Manu Singhal (Apr, 2016)
📗   You Don't Know JS: ES6 & Beyond by Kyle Simpson (Dec, 2015)

Related Projects

  • React App SDK — Create React App modification that unlocks server-side rendering
  • React Starter Kit — Boilerplate and tooling for building isomorphic web apps with React and Relay
  • Node.js API Starter Kit — Boilerplate and tooling for building data APIs with Docker, Node.js and GraphQL

License

Copyright © 2015-present Kriasoft. This source code is licensed under the MIT license found in the LICENSE.txt file.


Made with ♥ by Konstantin Tarkus (@koistya, blog) and contributors 👋 Get in touch!

You can’t perform that action at this time.