Boilerplate (seed) project for creating web apps with React.js, GraphQL.js and Relay
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.
Just clone the repo, update environment variables in
.env.localfile, 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.
In order to re-compile GraphQL fragments, run
yarn relay --watch(in watch mode).
While the app is in development, you can use a simplified migration workflow by creating a backup of your existing database, making changes to the existing migration file (see
migrations/20180101000000_initial.js), re-apply the migration and restore data from the backup file (
$ yarn db-backup --env=dev # Or, yarn db-backup --env=test $ yarn db-reset-dev # Or, yarn db-reset-test
Upon deployment to production, switch to normal migration workflow:
$ yarn db-change # Create a new database migration file $ yarn db-migrate --env=dev # Migrate database to the latest version
HINT: Test your migration thoroughly with a local instance of the DB first (by using
--env=dev(default) flag) then apply it to your
proddatabase instance using
Other helpful database scripts:
$ yarn db-version --env=dev # Print the version number of the last migration $ yarn db-rollback --env=dev # Rollback the latest migration $ yarn db-restore --env=dev # Restore database from backup.sql $ yarn db-seed --env=dev # Seed database with test data $ yarn db --env=dev # Open Knex.js REPL shell (type ".exit" for exit) $ yarn psql --env=dev # Open PostgreSQL shell (type "\q" for exit)
$ 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.
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
masterbranch 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.
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.
:mortarboard: React for Beginners and ES6 Training Course by Wes Bos
:greenbook: React: Up & Running: Building Web Applications by Stoyan Stefanov (Aug, 2016)
:greenbook: Getting Started with React by Doel Sengupta and Manu Singhal (Apr, 2016)
:greenbook: You Don't Know JS: ES6 & Beyond by Kyle Simpson (Dec, 2015)
Copyright © 2015-present Kriasoft. This source code is licensed under the MIT license found in the LICENSE.txt file.