Code Monkey home page Code Monkey logo

analytics's Introduction

Zero config and fast installation: Run `npx create-react-app-ts && yarn && yarn start` in your terminal.


GitHub issues GitHub last commit Build Status Analytics

Create Awesome React Application

Opinionated React starter template using TypeScript, Redux, React Router, Redux Saga, SCSS, PostCSS and more, offering PWA and offline capabilities and many more.

Dependencies

In order to use this setup you need to have installed the following dependencies:

  1. Node - min v8.15.0
  2. NPM - min v5.6.0 or
  3. Yarn - min v1.3.2
  4. Bash terminal (Default on OSX/Linux, GitBash or similar on Windows)

One line zero config installation

npx create-react-app-ts && yarn && yarn start

Just a quick note: You should manually create a .gitignore file if you plan on keeping your project in Git.

Download

You can download this setup directly and extract it.

Then navigate to the react-template-ts folder and proceed with the rest of the instructions.

Install

yarn

# or

npm i

Develop

yarn start

# or

npm start

Build

yarn build

# or

npm run build

Lint

yarn lint

# or

npm run lint

Test

yarn test

# or

npm run test

Details

  1. Folder structure:

    ๐Ÿ“ฆ project
    โ”ฃ ๐Ÿ“‚ assets - all fonts, images, videos, translation files, etc
    โ”ฃ โ”ฃ ๐Ÿ“‚ locale - all translations
    โ”ฃ โ”ฃ ๐Ÿ“‚ styles - all shared stylesheets
    โ”ƒ โ”ƒ โ”— ๐Ÿ“œ app.scss - Application's global SCSS entry point
    โ”ƒ โ”ƒ โ”— ๐Ÿ“œ mixins.scss - Application's SCSS mixins
    โ”ƒ โ”ƒ โ”— ๐Ÿ“œ functions.scss - Application's SCSS functions
    โ”ƒ โ”ƒ โ”— ๐Ÿ“œ settings.scss - Application's SCSS settings (variables, etc)
    โ”ฃ ๐Ÿ“‚ components - stateless components
    โ”ฃ ๐Ÿ“‚ containers - statefull components. Each container can export more than one component. An example folder structure is included in (`src/containers/.boilerplate`)
    โ”ฃ ๐Ÿ“‚ i18n - configuration settings for i18n (internationalization)
    โ”ฃ ๐Ÿ“‚ store - The application Redux store
    โ”ฃ โ”ฃ ๐Ÿ“‚ branches - all store branches
    โ”ฃ โ”ฃ	โ”ฃ โ”ฃ ๐Ÿ“‚ $BRANCH - A branch in the Redux store
    โ”ƒ โ”ƒ โ”ƒ โ”— ๐Ÿ“œ enums.ts - Each branch has its own enums
    โ”ƒ โ”ƒ โ”ƒ โ”— ๐Ÿ“œ interfaces.ts - Each branch has its own interfaces
    โ”ƒ โ”ƒ โ”ƒ โ”— ๐Ÿ“œ reducer.ts - The branch reducer
    โ”ƒ โ”ƒ โ”ƒ โ”— ๐Ÿ“œ selectors.ts - The branch selectors (hooks)
    โ”ƒ โ”ƒ โ”ƒ โ”— ๐Ÿ“œ sagas.ts - The branch sagas
    โ”ƒ โ”— ๐Ÿ“œ enums.ts - Store's enums
    โ”ƒ โ”— ๐Ÿ“œ index.ts - Application's main store
    โ”ƒ โ”— ๐Ÿ“œ interfaces.ts - Store's interfaces
    โ”ƒ โ”— ๐Ÿ“œ root-reducer.ts - Application's root reducer
    โ”ƒ โ”— ๐Ÿ“œ sagas.ts - Application's sagas
    โ”ฃ ๐Ÿ“‚ utilities - helpers and utility functions
    โ”— ๐Ÿ“œ app.tsx - Application's main component
    โ”— ๐Ÿ“œ custom.d.ts - Custom type definitions
    โ”— ๐Ÿ“œ index.html - Application's HTML file
    โ”— ๐Ÿ“œ index.tsx - The main entry point
    โ”— ๐Ÿ“œ loadables.tsx - Code split and lazy loaded components
    
  2. Latest EcmaScript support

    • Usage of the latest features in EcmaScript
    • Using TypeScript to transpile to ES5
    • Minification of the bundled file
    • Source maps
  3. Aliases: Checkout the aliases property in the vite.config.ts and tsconfig.json files.

  4. SCSS usage.

  5. Lint your files: ESLint (with TypeScript ESLint installed and configured) and Stylelint included

  6. Tests using Jest and React testing library. The Test environment has been configured so you don't have to

  7. PWA ready - Install as a native app on Android and iOS

  8. Code splitting and lazy loading

  9. i18n included:

    1. add your locales in /src/i18n/locales
    2. add your po files which are based on the translations.pot file located in /src/assets/locale
    3. run yarn locale to generate ${locale}.json file from your ${locale}.po file.
    4. update your UI to reflect the newly added locale
  10. Prerendering - All pages are prerendered based on defined routes. This is included in the build step and needs no additional configuration.

Supported Browsers

This setup uses Browserslist to target browsers.

The default list of supported browsers is listed in the package.json file:

{
	"browserslist": ["> 1%", "last 2 versions"]
}

This means that supported browsers vary based on current usage data and current browser versions.

In general, this setup supports the two most recent versions of all browsers.

Bonus

The start template contains a ready-to-use auth flow with Login, Logout, Sign up and Forgotten password forms with validation included. The auth flow includes also route guarding and redirects based on auth status. Please take a look at the /src/containers/auth folder for more details.

The starting files also include ready-to-use layout components such as Header, Footer, Wrapper, Button, Icon and form Fields.

LICENSE

MIT

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.