All Projects → BerndWessels → Preact Redux Isomorphic

BerndWessels / Preact Redux Isomorphic

Licence: mit
preact-redux-isomorphic PWA SPA SSR best practices and libraries in under 80kB page size (for live demo click the link below)

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Preact Redux Isomorphic

React Firebase Starter
Boilerplate (seed) project for creating web apps with React.js, GraphQL.js and Relay
Stars: ✭ 4,366 (+5036.47%)
Mutual labels:  graphql, seo, boilerplate, ssr, spa
Awes Io
Awes.io // boilerplate based on Vue, Nuxt, TailwindCSS plus Laravel as a backend. 🤟
Stars: ✭ 599 (+604.71%)
Mutual labels:  boilerplate, pwa, ssr, spa
Webiny Js
Enterprise open-source serverless CMS. Includes a headless CMS, page builder, form builder and file manager. Easy to customize and expand. Deploys to AWS.
Stars: ✭ 4,869 (+5628.24%)
Mutual labels:  graphql, aws, lambda, spa
React App
Create React App with server-side code support
Stars: ✭ 614 (+622.35%)
Mutual labels:  graphql, isomorphic, boilerplate, ssr
Productivity Frontend
Productivity Application - Kanban Style Productivity Management Application with Customizable Boards, Lists and Cards to Make You More Productive.
Stars: ✭ 234 (+175.29%)
Mutual labels:  webpack2, pwa, react-router, spa
Ssr Sample
A minimum sample of Server-Side-Rendering, Single-Page-Application and Progressive Web App
Stars: ✭ 285 (+235.29%)
Mutual labels:  graphql, pwa, ssr, spa
React Redux Styled Hot Universal
react boilerplate used best practices and focus on performance
Stars: ✭ 147 (+72.94%)
Mutual labels:  webpack2, isomorphic, boilerplate, react-router
Preact Starter
Webpack3 boilerplate for building SPA / PWA / offline front-end apps with Preact
Stars: ✭ 384 (+351.76%)
Mutual labels:  boilerplate, pwa, spa, preact
React Storefront
Build and deploy e-commerce progressive web apps (PWAs) in record time.
Stars: ✭ 275 (+223.53%)
Mutual labels:  pwa, ssr, spa, preact
Project Webcube
Continuously updated JS infrastructure for modern web dev
Stars: ✭ 141 (+65.88%)
Mutual labels:  graphql, isomorphic, boilerplate, react-router
React Storefront
React Storefront - PWA for eCommerce. 100% offline, platform agnostic, headless, Magento 2 supported. Always Open Source, Apache-2.0 license. Join us as contributor ([email protected]).
Stars: ✭ 292 (+243.53%)
Mutual labels:  pwa, ssr, spa, preact
Laravel Vuejs.com
Laravel and VueJs Blog, using Laravel nova, GraphQL, NuxtJs, Apollo and ...more
Stars: ✭ 54 (-36.47%)
Mutual labels:  graphql, pwa, ssr, spa
Falcon
DEITY Falcon - Progressive Web App library for any type of website. Fully Open Source, Platform Agnostic and headless. OSL3.0. Supports Magento 2 PWA storefront, Wordpress PWA and BigCommerce PWA Storefront. Built with ReactJS, NodeJS and GraphQL. Join our community and become a contributor at https://slack.deity.io
Stars: ✭ 501 (+489.41%)
Mutual labels:  graphql, pwa, spa
React Starter Kit
React Starter Kit — front-end starter kit using React, Relay, GraphQL, and JAM stack architecture
Stars: ✭ 21,060 (+24676.47%)
Mutual labels:  graphql, boilerplate, ssr
Pup
The Ultimate Boilerplate for Products.
Stars: ✭ 563 (+562.35%)
Mutual labels:  graphql, boilerplate, ssr
Redux Webpack Es6 Boilerplate
A starter project for modern React apps with Redux
Stars: ✭ 566 (+565.88%)
Mutual labels:  webpack2, boilerplate, react-router
React Router Server
Server Side Rendering library for React Router v4.
Stars: ✭ 443 (+421.18%)
Mutual labels:  webpack2, ssr, react-router
Hackernews
HackerNews clone built with Nuxt.js
Stars: ✭ 758 (+791.76%)
Mutual labels:  isomorphic, pwa, ssr
React Static Complete Website
A complete website built using React JS, With SEO, Code Splitting, Pre-rendering, gzip and more.
Stars: ✭ 16 (-81.18%)
Mutual labels:  webpack2, react-router, spa
Thinkful Workshop React Redux Node Mongodb Webpack2
Stars: ✭ 12 (-85.88%)
Mutual labels:  webpack2, boilerplate, pwa

preact-redux-isomorphic

Overview

This is an opinionated isomorphic preact and redux starter-kit.

It includes all your favourite libraries and can be as little as 24kB but most likely less than 80kB for the client to load your entire app! It depends on how many of the great stuff you actually need for your app.

The goal is to use the same code to achieve

  • a PWA (progressive web app)
  • a SPA (single page application) that can be serverless and hosted on a CDN
  • a SSR (server-side rendered) app with SEO (search engine optimization) support
  • a serverless SSR (running in AWS Lambda and static resources in AWS S3)

Latest and greatest

preact v7

preact is react in only 3kB

We also added preact-compat in case you need it, otherwise just get rid of it.

react-router v4

Routing done right with components. ConnectedRouter on the client and StaticRouter on the server allow for perfect isomorphic routing.

redux v3 and ramda

Single immutable state, reducers and actions to structure and master even the biggest apps.

Use rambda to mutate state - this allows your state to be POJO (Plain Old JavaScript Objects) and make development so much more fun.

rxjs v5

Reactive programming of your actions allows for easy composition of even the most complex async action stream flows. This can replace all the other redux middleware you used so far.

react-intl v2

Internationalization that uses standards and works client and server-side. With support for all the stuff you need like genderization, pluralization, date and time.

There are even some helper scripts to export/import PO files to communicate with your translators.

npm run po:export

This will extract all translations from your code and merge them into PO files. It will NOT override already existing translations but only add new translations to the PO files. You then send the PO files to your translator and he will use his tools to only translate the new untranslated translations.

npm run po:import visa

This will import all translations from the PO files within the given whitelabel. You do this after you received all translations back from the translator and before you build.

Whitelabel

If you are building just for your own company, then just have only a single whitelabel and that's totally fine.

But we also want to enable you to build for multiple whitelabels. This allows you to have different translations for different whitelabels. It is a very common thing in enterprise applications and translations really differ between whitelabels (believe me).

webpack v2 with HMR (hot module replacement)

Obviously the latest and greatest webpack with all the bells and whistles to achieve highly optimized builds.

server-side rendering without the need for preact-render-to-string

With a huge thanks to @developit we can now run the preact app on the server without the need for complex pre-render state calculations and render-to-string.

This gives us very clean code that is almost identical on server and client-side and performs great.

You can find all the details here.

PWA (progressive web app) Service Worker

100/100 Lighthouse rating if you decide to use this repo to build a PWA.

Otherwise just get rid of the service worker at the end of index.client.js.

preact-mdc (material design components)

Isomorphic modular lightweight preact material design based on the material-components-web sass styles.

Replace it with your own front-end components if you like. Just make sure they are isomorphic.

Normalized GraphQL Entity Redux State

You can replace this easily with whatever data fetching technology you like but we really encourage you to embrace GraphQL.

If you are using GraphQL and Redux you are most likely to normalize any GraphQL Query into a normalized entity store.

To make this as simple and easy to use as possible we provide a script that can extract all GraphQL Entities from a given GraphQL Endpoint and automatically create the Entity Reducers for you.

You run this script initially and then whenever the GraphQL Schema is about to change.

Usage
Override

If you don't make any manual changes to any of the Entity Reducers you can just run

npm run graphql:override

This will generate and override your Entity Reducers automatically and you are ready to go.

Merge

If you are extending the Entity Reducers with additional functionality you must run

npm run graphql:merge

This will generate all the Entity Reducers in the scripts/graphql/generated folder.

You can now manually merge the generated

...Reducer.js files into src/entities

and

types.json file into src/graphql

without losing any of the extensions you've previously added to the Entity Reducers.

Getting started

Preparations

  • Either provide your own ssl certificates of change the code to use http instead of https!
  • To get a response from the GraphQL API you need to run your own GraphQL server, adjust the query and create the Entity Reducers (see above for details)! Otherwise just replace it with your ordinary REST APIs.
  • Fork and clone this repo.
  • npm install

npm run-commands in package.json

You might want to change the following parameters within the dev and build run-commands:

  • BASEURL will be injected into the index.html and the router history
  • PORT is the port to be used by the development server
  • HOST is the host to be used by the development server
"build:client": "cross-env NODE_ENV=production BABEL_ENV=production TARGET=web BASEURL=/ webpack",
"build:server": "cross-env NODE_ENV=production BABEL_ENV=production TARGET=node BASEURL=/ webpack",
"dev": "cross-env NODE_ENV=development TARGET=web BASEURL=/ PORT=8080 HOST=localhost webpack-dev-server --inline --hot --progress",
"dev:secure": "cross-env NODE_ENV=development TARGET=web BASEURL=/ PORT=8080 HOST=my-domain.com webpack-dev-server --inline --hot --progress --https",

SSL

You can run development with http or https. Production is served only with https.

To do so you have to provide your own SSL certificates as certificates/domain.key and certificates/domain.cert.

Make sure you don't check those in to GIT!!!

Development

npm run dev runs the development version via http

npm run dev:secure runs the development version via https in which case you have to provide your own ssl certificate in the certificates folder.

Production

npm run build

node dist/server/main

This serves via https and requires you to provide your own certificates since it is intended to be for production.

Server Side Rendering (SSR)

The server will only render and serve the site to the client when the ROOT_STATE_READY_TO_RENDER action has been dispatched.

This example dispatches this action once the first GraphQL Query had a successful response.

You can replace that easily with your own custom logic. Just make sure you dispatch the ROOT_STATE_READY_TO_RENDER action when you are ready to render and serve the site to the client.

Serverless SSR on AWS

To build for a real serverless SSR just run npm run build:serverless

  • This will give you a client folder.
    • Create a S3 bucket that will host your static resources.
    • Create a subfolder called _ within that bucket.
    • Copy everything within the client folder into the _ subfolder in the S3 bucket.
  • This will also give you the server files.
    • Create a Lambda function.
    • Zip the index.js and client folder together into an archive and upload it into your Lambda function.
  • Now create a CloudFront Distribution with 2 origins.
    • The default origin will point to the API Gateway Endpoint that calls the Lambda Function.
    • The resource origin uses the _ path to point to the S3 static resources bucket.

If you have no idea what all this is or you like more details, please contact me. I have terraform scripts that build all of this infrastructure automatically.

Contributing

You are very welcome to report issues, PRs and become a contributor.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].