Git Product home page Git Product logo

react-shop's Introduction

Mobile WEB e-shop. Demo

Motivation

  • try modern tech stack
  • share code between platforms as much as possible
  • use great tooling (IDE , Debuggers, DevTools, linters, code formatters)
  • front-end - JS on any platform (React), common back-end. GraphQL - to bind both

Long term idea

Create shop example for ANY platform with shared front-end and single common back-end

Smells like future front-end!

IMAGE ALT TEXT HERE

Tech stack

Front-end

Back-end

How to install

  1. Install Yarn
  2. Clone git project and cd to it with command git clone https://github.com/ArtemSerga/react-shop.git && cd react-shop
  3. Copy .env.default file to .env with command cp .env.default .env. This will be your local settings
  4. Install packages by running yarn install
  5. Start project with yarn start
  6. Open in Chrome http://localhost:3000/, inspect window (from menu View -> Developer -> Developer Tools) and enable mobile device simulator in DevTools

Architecture

One React component - one self-contained directory

/MyComponent
  /MyComponent.tsx
  /myQuery.gql  # GraphQL query. Named like "GraphQl root query field". Can be multiple per directory
  /styles.css  # local-scoped styles with CSS-Modules
  /my-icon.svg  # some media. Can be multiple per directory
  /readme.md  # component-related docs

Tools

GraphiQL

An in-browser IDE for exploring GraphQL API. Try this query (when opened press Prettify and play button)

Graphql Voyager

Interactive GraphQL schema (e-shop demo)

React DevTools

  1. In Chrome install React DevTools extension
  2. After that, you will have "React" tab in Debug Toolbar

Redux DevTools

  1. In Chrome install Redux DevTools extension
  2. After that, you will have "Redux" tab in Debug Toolbar

Apollo DevTools

  1. In Chrome install Apollo DevTools extension
  2. After that, you will have "Apollo" tab in Debug Toolbar

Why

  • subjectively handles this stack better (even than WebStorm)
  • you can fully and quickly configure it with steps below

If you DON'T use it - automatically install all extensions and configure it

  1. Install VSCode and open project's directory via menu File -> Open...
  2. Install extension Settings Sync
    • in menu select View -> Extensions to open extensions sidebar
    • type Settings Sync and install it
  3. Download extensions and keybindings
    • in menu select View -> Command Palette and run command "Sync : Download Settings". After this step all happens automatically and your VSCode will be ready for work
  • NOTE: If you don't need keybindings like IntelliJ IDEA uninstall this extension

Already use it

  • to prevent rewriting your own settings - you can try it with VSCode Insiders
  • or just look at list of recommended extensions
  • or do nothing, mandatory extensions are mentioned below
  • before webpack building, TS => JS compilation happens automatically, so you don't need to run it manually
  • VSCode
    • to watch and conveniently solve TS errors via PROBLEMS section (in menu View -> Problems) select in menu View -> Command Palette... and type command "Tasks: Run Build Task"

Linters and code formatters

Tslint to lint TS

  • to run manually for all project via terminal yarn run tslint
  • VSCode
    • install TsLint extension
    • for opened files it automatically show errors in PROBLEMS section (in menu View -> Problems)
    • to see all project problems select in menu Go -> Go to File... and type task tslint

Prettier code formatter

  • TSLint for linting, Prettier for code formatting
  • in this project all TypeScript, JS, CSS, GraphQL and JSON files are formatted using Prettier
  • VSCode

Stylelint to lint CSS

  • Stylelint for linting, Prettier for code formatting
  • to run manually for all project select in menu Go -> Go to File... and type "task stylelint"
  • VSCode
    • install stylelint extension
    • for opened files it automatically shows errors in PROBLEMS section (select in menu View -> Problems)
    • for code formatting use Prettier described above

JSON formatter

  • Also use Prettier described above

MarkDown linter and tools

  • every React component has own directory, so it's a good place to describe it with readme.md
  • VSCode
  • based on React, written in TypeScript
  • dozens of features
  • subjectively one of the most mature UI library
  • cross-platform support:
  • intensively developed by Alibaba

Related projects

  • react-native-shop - same e-shop example, tech stack and back-end, but for Android and iOS using React Native
  • react-cross-platform - online e-shop demo for Mobile WEB, Android, iOS platforms

react-shop's People

Contributors

artemserga avatar ivansultan avatar vitalikparshin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.