If you're application needs routing and data fetching but neither isomorphism nor Redux.
This boilerplate is built around two main libraries:
- react-refetch, which offers a simpler data-handling pattern than Redux and is designed for applications "mostly fetching and rendering read-only data from a server."
- react-router-dom@4.x
It also uses MongoDB models and styled-components, but those could be swapped with something else fairly easily.
The sample application is a ridiculously simple news home page with a hideous grid system.
- Clone the repository
yarn
ornpm install
- Install MongoDB. Here are instructions for a Mac.
- Create a
.env
file according to what's inenv.sample
(right now, it's just the local database host) - Run MongoDB. I run the following commands in two separate Terminal tabs:
mongod
andmongo
yarn (npm) start
The database is (obviously) empty at first, so you'll need to either add some entries from the command line or POST to the API endpoints.
yarn (npm) run build
: Build for productionyarn (npm) run start:prod
: Start the Node server in productionyarn (npm) run clean
: Delete compiled files
- Add
Dockerfile
- Add database dump for easy DB initialization
- Add proper loading indicators