• Stars
    star
    4,508
  • Rank 9,472 (Top 0.2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 9 years ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Boilerplate (seed) project for creating web apps with React.js, GraphQL.js and Relay

React Starter Kit for Firebase Β  a.k.a. Serverless Edition
Build Status Dependabot 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 Discord Β |Β  We're hiring!

Β Β Β Β 


This project was bootstrapped 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.)
β”‚   β”‚   β”œβ”€β”€ mutations/             # GraphQL mutations
β”‚   β”‚   β”œβ”€β”€ queries/               # The top-level GraphQL query fields
β”‚   β”‚   β”œβ”€β”€ templates/             # HTML templates for server-side rendering
β”‚   β”‚   β”œβ”€β”€ types/                 # 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
β”‚   β”‚   β”œβ”€β”€ db.js                  # PostgreSQL database client (Knex.js)
β”‚   β”‚   β”œβ”€β”€ relay.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
β”‚   β”œβ”€β”€ relay.js                   # Relay factory method for browser environment
β”‚   β”œβ”€β”€ 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

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 (backup.sql):

$ 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 <name>            # 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=local or --env=dev (default) flag) then apply it to your test or prod database instance using --env=test or --env=prod command argument.

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)

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.

Backers

Β Β Β Β Β Β Β Β Β Β Β Β Β Β 

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!

More Repositories

1

react-starter-kit

The web's most popular Jamstack front-end template (boilerplate) for building web applications with React
TypeScript
22,653
star
2

graphql-starter-kit

πŸ’₯ Monorepo template (seed project) pre-configured with GraphQL API, PostgreSQL, React, and Joy UI.
TypeScript
3,835
star
3

Folder-Structure-Conventions

Folder / directory structure options and naming conventions for software projects
1,882
star
4

universal-router

A simple middleware-style router for isomorphic JavaScript web apps
TypeScript
1,704
star
5

isomorphic-style-loader

CSS style loader for Webpack that is optimized for isomorphic (universal) web apps.
JavaScript
1,274
star
6

aspnet-starter-kit

Cross-platform web development with Visual Studio Code, C#, F#, JavaScript, ASP.NET Core, EF Core, React (ReactJS), Redux, Babel. Single-page application boilerplate.
JavaScript
1,160
star
7

node-sqlite

SQLite client wrapper around sqlite3 for Node.js applications with SQL-based migrations API written in Typescript
TypeScript
901
star
8

react-app

Create React App with server-side code support
JavaScript
613
star
9

babel-starter-kit

🐠 Babel Starter Kit is a project template for authoring and publishing JavaScript libraries
JavaScript
552
star
10

react-decorators

A collection of higher-order ReactJS components
JavaScript
230
star
11

node-starter-kit

Node.js / GraphQL project template pre-configured with TypeScript, PostgreSQL, login flow, transactional emails, unit tests, CI/CD workflow.
TypeScript
164
star
12

static-site-starter

Static Website Starter Kit (static site generator) powered by Gulp, Jade, Bootstrap, LESS and BrowserSync. It can automatically deploy your website to GitHub Pages via Travis CI.
JavaScript
135
star
13

angular-vs

AngularJS + ASP.NET Web Api + TypeScript - Single Page Application (SPA) Starter Kit for Visual Studio
JavaScript
127
star
14

AspNet.Identity

Entity Framework (EF) Database-First Providers, Database Schema and Samples for ASP.NET Identity 2.0
C#
122
star
15

cloudflare-starter-kit

Template (boilerplate) repository for scaffolding Cloudflare Workers projects
TypeScript
110
star
16

AngularJS-SPA-Template

AngularJS SPA Template for Visual Studio is a project skeleton for a simple single-page web application (SPA) built with AngularJS, Bootstrap, and ASP.NET (MVC, Web Api, SignalR).
CSS
104
star
17

hyperapp-render

Render Hyperapp to an HTML string with SSR and Node.js streaming support.
JavaScript
103
star
18

web-auth-library

Authentication library for the browser environment using Web Crypto API
TypeScript
98
star
19

fsharp-starter-kit

Cross-platform web development with Visual Studio Code, C#, F#, JS, ASP.NET Core, EF Core, React (ReactJS), Babel and Webpack. Demo =>
JavaScript
88
star
20

TDAmeritrade

TD Ameritrade Client Library for .NET. Helps developers integrate custom solutions with the TD Ameritrade Trading Platform.
C#
76
star
21

amibroker

AmiBroker .NET SDK - An open source plug-in project template and community plug-ins for AmiBroker
C#
69
star
22

knex-types

Generate TypeScript definitions (types) from a PostgreSQL database schema.
TypeScript
63
star
23

hyperapp-starter

Boilerplate and tooling for authoring modern web applications with Hyperapp and Node.js.
JavaScript
61
star
24

react-component-starter

Skeleton project template for a stand-alone React component. NOTE: This project is currently NOT maintained. You may want to check https://github.com/kriasoft/babel-starter-kit instead
JavaScript
50
star
25

app-starter-kit

A front-end web application template based on HTML5 Boilerplate and enhanced with LESS style sheets and Gulp.js build system (a newer promising alternative to Grunt.js)
JavaScript
45
star
26

SPA-Seed.Front-end

A single-page application (SPA) project template (aka SPA seed project), which has a pre-configured build system, JavaScript bundling and dependency resolution, unit and integration test runners, minimization and optimization for production deployments.
CSS
40
star
27

react-page-context

React Page Context allows to manage document's title, description and other meta tags, as well as <link> and <script> elements from inside regular React components via context.page context variable
JavaScript
40
star
28

market-data

KriaSoft Market Data Server - A local database server with quotes and trade-related data associated with equity, fixed-income, financial derivatives, currency, and other investment instruments.
35
star
29

ASP.NET-Solution

ASP.NET solution / project template for a typical web application, pre-configured with Git, Gulp.js (or Grunt), NuGet and StyleCop development tools. It is well suited for building a single-page web application (SPA).
CSS
32
star
30

site-sdk

Web Application Starter Kit (aka Site SDK) is a solution / project template for building ambitious web applications on top of the AngularJS, ASP.NET Web Api, Entity Framework, Enterprise Library, and Windows Azure. Need help? Email me at [email protected]
JavaScript
27
star
31

pre-render

Convert a single-page app (SPA) into a fully pre-rendered functional website before deploying it to a CDN
JavaScript
25
star
32

image-resizing

Node.js backend (middleware) for dynamic image manipulation needs (transform, resize, optimize)
TypeScript
23
star
33

cloudflare-client

Lightweight universal Cloudflare API client library for Node.js, Browser, and CF Workers
TypeScript
22
star
34

terraform-starter-kit

Getting started with Terraform
HCL
18
star
35

docker-node-ci

The Docker image based on the official "node" image optimized for a CI environment
18
star
36

node-pg-client

Promise-based wrapper for `node-postgres` library designed for easy use with ES7 async/await.
JavaScript
16
star
37

webpack-middleware

Run Webpack compiler as Express.js/Browsersync middleware
JavaScript
16
star
38

graphql-api-examples

Code examples for GraphQL Start (tutorial) ⁠— How to build a GraphQL API on Node.js stack
JavaScript
10
star
39

MembershipDatabase

Membership database seed project created with SQL Server Data Tools (SSDT) for building a custom ASP.NET Identity / Membership solution for a typical web application using Database First development approach
10
star
40

SPA-Seed.Front-end.AngularJS

A single-page application (SPA) project template based on AngularJS
CSS
9
star
41

envars

Securely load environment variables (configuration settings) from .env files with support of Google Secret Manager.
JavaScript
9
star
42

cloudflare-ips

The list of CloudFlare IPs (IP ranges) to be used in the "trust proxy" (behind proxy) configurations
JavaScript
8
star
43

hyperapp-tools

Build automation tools for Hyperapp projects
JavaScript
7
star
44

jwt-passport

Passport.js framework that uses JWT for sessions
JavaScript
7
star
45

create-dns-record

Create DNS Record Action for GitHub
JavaScript
7
star
46

create-data-api

Project template for authoring data API backends with PostgreSQL, Redis, Passport.js and GraphQL.
JavaScript
6
star
47

component-routing

Component-based routing archiecture for single-page applications (SPA)
6
star
48

monorepo-example

Tips and tricks for setting up monorepo project structure for a typical web application.
JavaScript
5
star
49

rsb.kriasoft.com

Create React App + Relay Modern (DEMO)
JavaScript
5
star
50

delete-dns-record

Delete DNS Record Action for GitHub
JavaScript
5
star
51

reactstarter.com

React Starter Kit Homepage
CSS
4
star
52

check-version

Check Version Action for GitHub
JavaScript
4
star
53

restart

Restart Node.js app in development mode
JavaScript
4
star
54

data

Extensions library for Microsoft Entity Framework 4.2
C#
4
star
55

graphqlstart.com

GraphQL Start (tutorial) ⁠— How to build a GraphQL API on Node.js stack
4
star
56

react-components

Reusable React components
CSS
4
star
57

docker-gcloud

Google Cloud SDK bundled with Kubernetes CLI (kubectl)
3
star
58

AspNet

ASP.NET Identity Database is a SQL database project template (SSDT) which can be used to create a custom ASP.NET Identity / Membership provider using Database-First development approach.
C#
3
star
59

validator-fluent

Validation library for JavaScript/TypeScript with a strongly typed fluent API
TypeScript
2
star
60

core

KriaSoft Core Library - A collection of helper classes and utilities.
C#
2
star
61

kriasoft.github.io

CSS
2
star
62

bundle-webpack-plugin

Webpack plugin for emitting additional application bundles for Node.js, SSR, Cloudflare Workers, etc.
JavaScript
1
star
63

Diffbot

Diffbot Client Library for .NET - helps to extract article information (title, date, author, preview image etc.) for articles and blog posts with the Diffbot.com service.
C#
1
star
64

yeoman-generator

Yeoman Generator Starter Kit is a project template (boilerplate) for authoring Yeoman generators with modern JavaScript syntax (ES2015+) via Babel
JavaScript
1
star
65

simple-oauth2-clients

OAuth 2.0 clients for Google, Apple, Facebook, GitHub and other identity providers.
JavaScript
1
star
66

create-hyperapp-starter

The easiest way to start a new web application using Hyperapp.
JavaScript
1
star