Giter Site home page Giter Site logo

pankajpatel / react-apollo-starter-kit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from saikat/react-apollo-starter-kit

0.0 3.0 0.0 66 KB

A production-ready starter kit for making a React/Apollo application.

License: MIT License

JavaScript 100.00%

react-apollo-starter-kit's Introduction

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.

Stack this kit uses

  • React for frontend development
  • GraphQL for backend API
  • Apollo for backend/frontend data flow management
  • Redux for frontend data management. Apollo integrates with Redux.
  • React-router for clientside routing
  • Aphrodite for styling
  • Express for the server
  • Webpack for development server + hot reloading clientside stuff
  • Nodemon for hot reloading backend code
  • Rollbar for production error handling
  • Minilog for client and server logging
  • Node-foreman for running both the Webpack server and Express server
  • ESLint to keep your Javascript style consistent
  • Babel 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 Apollo network interface that lets you add middleware to handle responses from GraphQL. 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 new app with this kit

  1. Install Node.js.
  2. Clone this starter kit
  3. Change the git remote to point to your new project's repo with git remote set-url origin <new-url>
  4. Change the README and update package.json to reflect the new package name, package license, description, keywords, repository, bugs url, homepage, and author.
  5. Set up an ESLint plugin in your code editor so that you catch coding errors and follow code style guidelines more easily!
  6. Install the redux-devtools-extension in Chrome to get advanced Redux debugging features.
  7. npm install
  8. npm run dev
  9. Navigate to http://localhost:3000 to see your app in action.
  10. Navigate to http://localhost:3000/graphiql to mess around with the GraphQL API.
  11. Start making changes by working in the src directory

Deploying this app to Heroku

  1. Deploy your app to Heroku. Make sure to set the correct environment variables there based on what exists in .env in this project!
  2. Allow Heroku to install build time dependencies from the devDependencies in package.json: Settings -> Config Variables -> Add, KEY: NPM_CONFIG_PRODUCTION, VALUE: false.

react-apollo-starter-kit's People

Contributors

larixer avatar danielfgray avatar

Watchers

Pankaj Patel avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.