All Projects → ShadOoW → web-starter-kit

ShadOoW / web-starter-kit

Licence: other
An opinionated starter kit with styled-system, graphql-hooks, mobx and nextjs (PWA)

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to web-starter-kit

Next Starter
Next.js Starter using GraphQL, MobX (Next.js, TypeScript, Babel, Express.js, Apollo Client, React Apollo, React Apollo Hooks, GraphQL Codegen, MobX, mobx-state-tree, styled-components, next-optimized-images, Serverless Framework, AWS Lambda, Dotenv)
Stars: ✭ 90 (+429.41%)
Mutual labels:  styled-components, mobx, nextjs
Gank
🦅 Gank api base △ next.js (react&ssr)
Stars: ✭ 122 (+617.65%)
Mutual labels:  pwa, mobx, nextjs
Coderplanets web
the most sexiest community for developers, build with React, Mobx/MST, GraphQL, Styled-Components, Rxjs, Ramda ... and ❤️
Stars: ✭ 314 (+1747.06%)
Mutual labels:  styled-components, mobx, nextjs
RocketLaunches
Rocket launches, a simple site to let you know what is the next rocket launch.
Stars: ✭ 13 (-23.53%)
Mutual labels:  pwa, styled-components, nextjs
currency-converter
💰 Easily convert between 32 currencies
Stars: ✭ 16 (-5.88%)
Mutual labels:  pwa, styled-components, nextjs
Ssr Sample
A minimum sample of Server-Side-Rendering, Single-Page-Application and Progressive Web App
Stars: ✭ 285 (+1576.47%)
Mutual labels:  pwa, styled-components, server-side-rendering
React Storefront
Build and deploy e-commerce progressive web apps (PWAs) in record time.
Stars: ✭ 275 (+1517.65%)
Mutual labels:  pwa, nextjs, server-side-rendering
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 (+1617.65%)
Mutual labels:  pwa, nextjs, server-side-rendering
Universal Native Boilerplate
Build apps for every native platform with React and React Native
Stars: ✭ 131 (+670.59%)
Mutual labels:  pwa, server-side-rendering
Nextjs Pwa
Build a PWA with Next.JS
Stars: ✭ 132 (+676.47%)
Mutual labels:  pwa, nextjs
Pup
The Ultimate Boilerplate for Products.
Stars: ✭ 563 (+3211.76%)
Mutual labels:  graphql-client, styled-components
Nextjs Pwa Graphql Sql Boilerplate
Next.js serverless PWA with GraphQL (Apollo) + Postgres SQL boilerplate
Stars: ✭ 125 (+635.29%)
Mutual labels:  pwa, nextjs
rebass
⚛️ React primitive UI components built with styled-system.
Stars: ✭ 7,844 (+46041.18%)
Mutual labels:  styled-components, styled-system
Example Storefront
Example Storefront is Reaction Commerce’s headless ecommerce storefront - Next.js, GraphQL, React. Built using Apollo Client and the commerce-focused React UI components provided in the Storefront Component Library (reactioncommerce/reaction-component-library). It connects with Reaction backend with the GraphQL API.
Stars: ✭ 471 (+2670.59%)
Mutual labels:  graphql-client, nextjs
Next Offline
make your Next.js application work offline using service workers via Google's workbox
Stars: ✭ 1,306 (+7582.35%)
Mutual labels:  pwa, nextjs
gatsby-starter-redux-saas
An Gatsby starter for Saas products. Uses redux and apollo and a graphql token auth backend.
Stars: ✭ 18 (+5.88%)
Mutual labels:  graphql-client, styled-system
Meteor Apollo Starter Kit
Meteor, Apollo, React, PWA, Styled-Components boilerplate
Stars: ✭ 91 (+435.29%)
Mutual labels:  pwa, styled-components
Productivity Frontend
Productivity Application - Kanban Style Productivity Management Application with Customizable Boards, Lists and Cards to Make You More Productive.
Stars: ✭ 234 (+1276.47%)
Mutual labels:  graphql-client, pwa
react-ssr-hydration
Example of React Server Side Rendering with Styled Components and Client Side Hydration
Stars: ✭ 15 (-11.76%)
Mutual labels:  styled-components, server-side-rendering
server-authentication-next.js
No description or website provided.
Stars: ✭ 103 (+505.88%)
Mutual labels:  nextjs, server-side-rendering

Open CircleCI build page Open demo application Current version of NextJs Current version of NextJs

Demo

Starter Kit

A starter kit for a next js project.

Motivation

I love react, but I also love pages that load fast (static sites), this is my attempt at getting the best of both worlds (or as much as possible).

Enter nextjs with SSR and Hydration. Read More if you are unfamiliar with the idea.

Note that for maximum performance, you may want to look at Partial hydration techniques, and remove some dependencies.

CSS

From my experience working as frontend dev, CSS is always the black sheep of the web stack, most people underestimate it and tend to avoid learning it, it doesn't help that browser encourage you to write bad CSS, "if it works, then it most be correct" is the dominant mindset in most teams.

CSS is not simple nor is it boring, it is fun and alive, new tools and techniques are always emerging, without a basic understanding of the fundamentals, this techniques will not help you write better css.

The fundamental struggle in CSS is always the same, we need to write code that makes sense to humans, to allow maintainability, but we need to write code that is performent to speed up the time it takes for the page to load on the user's device.

One good news though is that not every website needs aggressive CSS optimization, most of the time we do have room for improving maintainability.

Many patterns have emerged to solve this fundamental struggle:

Atomic CSS (ex: https://acss.io/)

This technique is one of the best when writing CSS as CSS, by creating a class for each CSS property, we can reuse code everywhere, it also improves readability of HTML

<div class='box'>
    Hello
</div>

vs

<div class='flex flex-align-center flex-jusfity-center'>
    Hello
</div>

As a developer I can tell what is the layout of the div in the second example just by looking at the HTML, while in the first example I would need to find the .box class to get the same information.

We could use a scale (0, 5px, 10px, 20px...) to standardize spaces and allow css reusability (padding-0, padding-0-5, padding-1, padding-2...), but for this to work, the designer and the programmer need to be fully synced and work hand in hand, which is not always possible.

This technique also supports media queries.

<div class='none flex-m'>
    This div will have display: none, on mobile and display: flex on medium and above
</div>

This is possible, because media queries are usually standardized by most designers.

Finally if for some reason something can't be atomic, then you can always use good old css, because atomic css will improve performance as long as the property is used twice or more in the same page, you can also mix and match <div class='menu flex'>

.flex{display:flex}

This class has 19 chars, which is already better than using display:flex twice (20 chars).

CSS in JS

CSS in JS is trying to solve a new problem, namely CSS encapsulation, recently browsers and client side view libraries have embraced the concept of components, either as a standard, or simulated with javascript.

The problem with ShadowDom encapsulation (standard) is that it does it job properly, shadow dom component are fully encapsulated, but we do actually still want global css, for exmple, an <input> reset should be set only once per website.

Simulated encapsulation works by automatically generating a unique ID that is then added to the component and the css, to simulate the desired behavior, this is more flexible as we can still use css the normal way, imagine you are using a third party library that asks you to add a css file to your index.html, with the simulated approach, you can still do that.

On the topic of optimization/maintainability, CSS in JS can lead to some bad code if the developer doesn't have a good understanding of CSS, but if used in the right way, theoratically they should be no difference from manually optimized CSS, as any optimization done by a human could technically be done by a transpiler, the transpiler could in theory detect opportunities for optimization and create reusable classes, as the technology matures, this should reach the point where it makes no sense to do optimization at the developer level, similar to how we trust typescript to generate efficient javascript code.

Styled System

CSS in JS, is not just about writing css in a javascript file, it is a new way of thinking that opens new possibilities, and this is the reason it is worth the effort to learn, once our CSS becomes Javascript, anything is possible (imagine sass's varibles/mixins but even better). Instead of just writing our CSS and Component as 2 independent blocks of code, we can make our CSS fully part of the components by taking advantage of component's props, default props, typechecking and so on....

What if instead of doing this:

import styled from 'styled-components';

const Box = styled.button`
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 2rem;
`
const MyComponent = () =>
    <Box>Hello</Box>

We did this:

import { Flex }  from 'layout';

const MyComponent = () =>
    <Flex alignItems='center' justifyContent='center' px='2rem'>
        Hello
    </Flex>

Instead of just writing css as needed, we can write reusable components that can be used for layouting, typography...

We could use booleans to enable specific behaviors, the component's state could be used to style our jsx.

import { Text }  from 'typography';

const MyComponent = () =>
    <Text bold capitalize error={hasError}>Hello</Text>

Styled system can also handle variants.

import { Button }  from 'common';

const MyComponent = () =>
    <Button size='small'>Hello</Button>

Conclusion

I initially had some reserve toward CSS in JS, that made me want to stick to my battle tested patterns, but after I discovered Style System, I managed to overcome all my initial assumptions and I came to realize the benefits and especially the potential of this new approach, I hope I was able to share with you some of my enthusiasm.

Mobx

Implemented based on this repo nextjs-with-mobx

Work in Progress...

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

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].