Coder Social home page Coder Social logo

react-sphere's Introduction

react-sphere

Maintenance Status NPM version

A boiler plate for building product for multiple platforms (mobile, desktop and VR) with single codebase. It explains an architecture for building sites and apps for multiple platforms, for geographical regions(internationalization with a capability of changing themes) and flexible for building whitelabel sites/apps.

Advantages of react-sphere

  • Follow adaptive design You can implement the adaptive design for each device types like mobile, desktop and VR
  • Multiple sites / apps Able to build multiple sites and apps like B2B, whitelabel sites / apps and also tragetting geographical regions by country wise. (eg: French, Arabic) by inheriting or overriding the templates of global app / site (.com)

Idea

Idea inspired from Leland Richardson talk on Chain React 2017: React as a Platform

Getting Started

  • Install react native If you haven't installed react native on your machine, follow these steps from React Native till Create new Application
  • Install react-sphere as Gobal
    $ npm install -g react-sphere
    
  • Create your project
    $ react-sphere init project_name
    
    Alternate way:
    react-native init project_name --template sphere
    cd project_name/
    node scripts/addDevDependencies.js
    
  • After initializing the project, its all react-native and react. you can use react-native / react commands

Usage

  • Configure the sites in .babelrc file, like below.
    {
      "presets": [
        "react-native"
      ],
      "plugins": [
        ["transform-inline-environment-variables"],
        ["variable-path-resolver", {
          "envName": "SITE",
          "vars": {
            "m-fr": {"Device": "Mobile", "Site": "Fr" },
            "m-com": {"Device": "Mobile", "Site": "Com"},
            "d-fr": {"Device": "Desktop", "Site": "Fr" },
            "d-com": {"Device": "Desktop", "Site": "Com"},
            "default": {"Device": null, "Site": "Com"}
          }
        }]
      ]
    }
  • Running a web application (Webpack dev server)
    • SITE=m-com yarn web // For running your global mobile site
    • SITE=m-fr yarn web // french mobile site
    • SITE=d-com yarn web // global desktop site
    • SITE=d-fr yarn web // french desktop
    • To switch between sites, you may need to clear the compiler cache, for that you can use below command
      react-sphere switch m-fr web
      
  • Running react-native app
    • react-native run-ios // For running your global mobile app
    • To change to french app, stop the existing bundling terminal and run below script and reload your app.
      SITE=m-fr yarn start --reset-cache
      
  • Produciton build (web sites)
    • SITE=m-com yarn build
    • SITE=m-fr yarn build
    • yarn build:all // this will create builds for your sites mentioned in the .babelrc file
  • Production build (mobile apps)

Major Dependency

Similar Projects

IDE

VScode users can start the project as

SITE=m-fr code project_name  

Create VScode Alias

react-sphere's People

Stargazers

Shameem avatar

Watchers

Shameem avatar James Cloos 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.