Universal React+GraphQL starter kit: React 16, Apollo 2, MobX, Emotion, Webpack 4, GraphQL Code Generator, React Router 4, PostCSS, SSR
src/data/state.ts
src/lib/mobx.ts
, with helper functions for dehydration and feeding state context to React via <StateProvider>
<StateConsumer>
, which takes a function and passes it local state; automatically re-renders React children when state is mutatedincrement()
function on statesrc/lib
; removes redundant src/apollo
src/queries
src/mutations
<Global>
typescripts()
to src/lib/stats.ts
, for finding related .js
files to bootstrap on initial HTML render (wip toward adding cached, per-request vendor files)src/views/ssr.tsx
component to produce a map of <script>
tags instead of taking a js
vardotenv
issuecss-loader
options for v2.1.0createKoaHandler
tslint.json
(in favour of Prettier)@types
packages to devDependenciesnetlify.toml
for static SPA compatibilitynetlify.toml
, for one-click deployment to Netlify
.nvmrc
, for specifying Node.js v10.11 for NVMsubscription
queries.env
file for managing environment variablesGRAPHQL
variable to .env
, to specify GraphQL server/endpointWS_SUBSCRIPTIONS
variable to .env
, to enable/disable WebSocketsnpm run static
mode, for building a client-only static bundlesrc/views/index.html
template for static bundlingsrc/runner/app.ts
to allow static compilation@babel/core