Giter VIP home page Giter VIP logo

app-skeleton's Introduction

Riot App Skeleton

The Zesty.io Riot App Skeleton is our starting point for front end applications. Our hope is that we can expose internally learnings to the Riot community.

Getting Started

1) Create an app/config.js file

This is the configuration file for the application. You should include things such as; your environment, api endpoints, vendor access tokens, etc... This is a javascript module which exports each value as a constant. The configuration file is ignored in .gitignore this ensures your secret keys are not accidentally committed to a repository. So don't be surprised when you don't see your changes in the git status

Example config.js File

export const ENV = 'DEV'
export const API = 'https://YOUR-SERVICE.zesty.localdev'
export const VENDOR_SECRET = '123ABC'

2) Start The Application

Run the application locally with this command. Accepts cli arguments env

$bash build.sh --env development

This bash script orchestrates all build steps irregardless of language. If adding a new build step, dependency or language it must ultimately be configured to run via this bash script.

Developing

gulp manages our application build. External dependencies are managed by npm. It is ran on a local server with nodejs via the glup-connect module.

We are writing our JavaScript as ES6 modules which are transpiled via babel then bundled with browserify for client delivery.

Code style is enforced with standard (// TODO automate standard reporting) and an .editorconfig file. Before committing any code ensure your editor is configured to use the .editorconfig or your pull requests will be rejected.

Routing: Grapnel

Our routing is implemented with the Grapnel library. The router is in charge of starting our redux state machine and providing the created store to riot components which then pass the store to their children. It supports both hashchange and pushState.

State: redux

We are using redux for our state management.

View: riotjs

We've chosen riotjs to be our view layer. Riot components should be written as stateless as possible. Each component should ideally only do 2 things;

  1. subscribe to store changes and update
  2. dispatch user actions

Services

Services are implemented from a delegate prototype Service object. We write a service implementation for each of our micro services.

Dependencies

  • moment (Time Normalizing Lib)

Polyfills

  • es6-promise (Polyfill)
  • whatwg-fetch (Polyfill)
  • Object.assign

Testing

We use the tape testing module which uses the TAP standard for tests and output the results into faucet for some pretty test results. Riot tags are tested by loading the tag file and running it through the riot.render method which returns HTML. Then assertions can be ran against the HTML string.

// TODO possibly load the HTML with JSDom to have a dom we can run integration tests against with something like nightmare to ensure our events handle and return expected results.

Reporting

We have integrated segment.io into our application codebase so we can capture app usage statistics to measure engagement and learn what application features users enjoy most. To configure segment you will need to add your secret key to the app/config.js file.

export const SEGMENT_SECRET = 'YOUR_SECRET_KEY'

app-skeleton's People

Contributors

perguth avatar shrunyan avatar

Stargazers

 avatar  avatar

Watchers

 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.