React-Starter-Kit – Open Source Universal React Redux GraphQL Boilerplate
github.com
github.com
With so much fragmentation in tooling and constant churn, it's often discouraging to start any new project.
I've been using Parcel because of its zero-config functionality, and it always amazes me how much boilerplate it actually takes care of for you behind the scenes. It's a lot.
Reminds me of the early days of the Spring Framework in Java when the entire language required sacrificing goats to get all the XML configuration, environment variables, and boilerplate code right. I checked up on the project last year and was pleasantly surprised to find Spring Boot made the process as simple as Rails.
And as a personal note I think you should switch to TypeScript and Styled Components.
https://www.youtube.com/user/99baddawg/playlists
Last year he did a very basic slack clone which has both graphql server and client (on Node) https://www.youtube.com/watch?v=0MKJ7JbVnFc&list=PLN3n1USn4x...
Lately he is heavily into Typescript and he has put together a series on how to put together a Typescript graphql server https://www.youtube.com/watch?v=2eWIr6bbons&list=PLN3n1USn4x...
Currently he is putting together a series on Full stack Airbnb clone which has both Graphql server and client (on Node) using Typescript and packaging using yarn workspaces.
I would highly recommend all these series from a learning perspective. If you just want to get started and learn later, you can download the code from the referenced github repos for each series.
Edit: Watching his series has also peaked my interest in Vim
Diving back into Node though, just so I can get my current portfolio up to par and job-ready, it makes me realize how broken this whole process is.
It seems like bi-annually, either Node.js is changing, Webpack is changing, React is changing, or possibly all three have changed. What you learned just a year ago has been modified and 'updated', usually with configuration and API changes. This leads to a whole slew of new articles and tutorials and boilerplate GitHub projects being created, only to be somewhat legacy less than a year down the road.
Then the plugins you have to learn, all of which separately might have configuration and API changes from one version to the next... Then you have to learn server side rendering because all of this is built for the client, so it's time to incorporate some weird page loading query string hacks to get that working...
All of this feels like it's just one hack put on top of another, to try and achieve what browsers have been doing since the 90's, just without reloading the page.
I think the updates to JavaScript in ES6 like arrow functions, classes, the spread operator, etc are great, but even this I could see going down the C++ route of just trying to add every single feature a programmer can think of to the language.
This is why I prefer Go so heavily. The core language keywords and features have not really changed since its inception. I hope one day this can all be condensed and simplified, much like Go is doing for backend languages.
It would be extremely helpful to document why the configs are the way they are. See this long twitter thread on what I discovered by ejecting create-react-app configs: https://twitter.com/dmitriid/status/908677755046449154
Some highlights:
- Because of course you need to write your own webpack message formatter
- Because of course you have to manually set up listeners for SIGINT and SIGTERM to tear down the dev server
- Because of course you have to manually write a module resolution helper that basically replicates node's resolution mechanism
- Because of course dev server spits tons of crap, so you silence it and manually write a custom message emitter
- Because of course you have to write your own error overlay for a dev server
- Because of course you have to pretend your structured folders are flat for some tools, and you have to write manual overrides
etc. etc. etc.
Simply because some poor soul spent countless hours and never documenting the journey we have the crappy tools that we have. All these horrendously inane configs should not be hidden behind a wrapper, but called out, created as issues and fixed.
Because it took the webpack team several years to even acknowledge that simplified configs with default values are a good thing. I mean, in 2017 they said that webpack will always be crap because it can't provide defaults because "that's how Javascript is": https://twitter.com/dmitriid/status/920542261020160000
etc. etc. etc. etc.
Also why choose Redux over Apollo or Relay if it's intended to be used with GraphQL? Did you document your choice?
Each time I look at these bootstrap/start-kit/boilerplate projects to start a new project I get frustrated by the intertwined client & server code, deps & config.
Actually I’m using react with js-data for a rest backend. I have made some simple forms and list components that abstract a lot of communication with the server.
I wish create-react-app was the only one way to start a React project, but it has its own limits:
- not intended for server-side React apps
- not intended for React components library
- not intended to be used with TypeScript but Flow (could change with the next major version tho)
Still, there are already so many alternatives, some of them just reinventing the wheel. Do we really need another one? I'm not sure.
- https://github.com/facebook/create-react-app (50k stars)
- https://github.com/react-boilerplate/react-boilerplate (19k stars)
- https://github.com/kriasoft/react-starter-kit (18k stars)
- https://github.com/davezuko/react-redux-starter-kit (10k stars)
- https://github.com/insin/nwb (3k5 stars, support Preact & Inferno & components libraries)
- https://github.com/zeit/next.js (26k stars, server-side support, very opinionated)
- and so on… just type "react boilerplate/starter/toolkit" on google. Most of them are out-of-date and not maintained, making the process of choosing one ever more overwhelming.
Microsoft maintains the Typescript plugin. Works great.
Also why they include Redux? It's not like adding Redux manually is that long or difficult. I guess some guy who doesn't want Redux will just fork this one and publish his own React-TypeScript boilerplate but including MobX, or some other state management library, or none. So another one…
Some of these experiments will not stand the test of time, they'll be replaced by other things. Create-React-App is a great starter kit for React but you answered your own question: it doesn't cover all use cases.
Bring on more starter kits, more libs, more frameworks, more languages, more experimentation and innovation because that's how we discover new paradigms that improve productivity, performance, etc.
Software development is still a super young field and if we think we've already figured out the "best way" to make it, we're kidding ourselves.