Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
saikat
committed
Jul 12, 2016
0 parents
commit b80dd1f
Showing
33 changed files
with
4,666 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"presets": ["react", "es2015", "stage-0"], | ||
"only": ["*.js", "*.jsx"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
NODE_ENV=development | ||
EXPRESS_PORT=8080 | ||
ROLLBAR_ACCESS_TOKEN=set_this_in_production | ||
OUTPUT_DIR=./build | ||
PUBLIC_DIR=./build/client | ||
ASSETS_DIR=./build/client/assets | ||
ASSETS_MAP_FILE=assets.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"extends" : "airbnb", | ||
"parser": "babel-eslint", | ||
"rules": { | ||
"semi": ["error", "never"], | ||
"comma-dangle": ["error", "never"], | ||
"no-alert": ["off"], | ||
"jsx-quotes": ["error", "prefer-single"], | ||
"no-confusing-arrow": ["off"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/node_modules | ||
/build | ||
npm-debug.log | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2016 Saikat Chakrabarti | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: npm start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# React Apollo Starter kit | ||
|
||
This is an opinionated starter kit to start making an Apollo-based app. The goal of this starter kit is to give you an app that is ready for production. This means having proper logging, error handling, testing, bundling, asset management, and everything else out of the box. For a more barebones starter kit, check out [the official Apollo starter kit](https://github.com/apollostack/apollo-starter-kit). | ||
|
||
## Stack this kit uses | ||
* [React](https://facebook.github.io/react/) for frontend development | ||
* [GraphQL](http://graphql.org/) for backend API | ||
* [Apollo](http://apollostack.com) for backend/frontend data flow management | ||
* [Redux](http://redux.js.org/) for frontend data management. Apollo integrates with Redux. | ||
* [React-router](https://github.com/reactjs/react-router) for clientside routing | ||
* [Aphrodite](https://github.com/Khan/aphrodite) for styling | ||
* [Express](http://expressjs.com/) for the server | ||
* [Webpack](https://webpack.github.io/) for development server + hot reloading clientside stuff | ||
* [Nodemon](https://github.com/remy/nodemon) for hot reloading backend code | ||
* [Rollbar](https://rollbar.com) for production error handling | ||
* [Minilog](https://github.com/mixu/minilog) for client and server logging | ||
* [Node-foreman](https://github.com/strongloop/node-foreman) for running both the Webpack server and Express server | ||
* [ESLint](http://eslint.org/) to keep your Javascript style consistent | ||
* [Babel](https://babeljs.io/) to use the latest Javascript language features | ||
|
||
## Other features of this kit | ||
* Automatic asset versioning so that you can aggressively cache your assets in production | ||
* Server side rendering out of the box | ||
* Custom network interface that lets you add middleware to handle responses from GraphQL. GraphQL does not prescribe any specific error contract between the client and server, so this would be a good place to put any error handling that you want to do globally (e.g. unexpected errors from GraphQL, user authorization or authentication errors, etc.). | ||
* Sane handling of unexpected exceptions: | ||
* Calls to log.error in client/server will log the error to the console/stdout and also send it to Rollbar. | ||
* Unexpected exceptions in client-side code (including within asynchronous code): log.error + force refresh the app after an alert to the user | ||
* Unexpected exceptions in non-GraphQL server-side code: log.error + crash the server. In dev, nodemon will wait for changes to restart the server. In production, you should handle restarting the server (e.g. set Heroku to auto-restart dynos on a crash). | ||
* Unexpected exceptions in GraphQL code: log.error. This happens via a response middleware that is easily changeable. | ||
|
||
## Making and deploying a new app with this kit | ||
1. Install [Node.js](https://nodejs.org/). | ||
1. Clone this starter kit | ||
1. Change the git remote to point to your new project's repo with `git remote set-url origin <new-url>` | ||
1. Change the README and update `package.json` to reflect the new package name, package license, description, keywords, repository, bugs url, homepage, and author. | ||
1. [Set up an ESLint plugin in your code editor so that you catch coding errors and follow code style guidelines more easily!](https://medium.com/planet-arkency/catch-mistakes-before-you-run-you-javascript-code-6e524c36f0c8#.oboqsse48) | ||
1. [Install the redux-devtools-extension](https://github.com/zalmoxisus/redux-devtools-extension) in Chrome to get advanced Redux debugging features. | ||
1. `npm install` | ||
1. `npm run dev` | ||
1. Navigate to `http://localhost:3000` to see your app in action. | ||
1. Navigate to `http://localhost:3000/graphql` to mess around with the GraphQL API. | ||
1. Start making changes by working in the `src` directory | ||
1. Deploy your app to [Heroku](https://heroku.com). Make sure to set the correct environment variables there based on what exists in `.env` in this project! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
server: npm run dev-start | ||
webpack: ./dev-tools/babel-run ./webpack/server.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env node | ||
require('babel-register') | ||
require('../' + process.argv[2]) |
Oops, something went wrong.