npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

express-react-boilerplate

v4.2.1

Published

Express react boilerplate

Downloads

39

Readme

Features

Requirements

Structure

.
├── public                      # Express server static path
│   ├── assets                  # All favicon resources
│   ├── locales                 # All of i18n resources
│   └── robots.txt              # A robots.txt file tells search engine crawlers which pages or files the crawler can or can't request from your site.
├── src                         # App source code
│   ├── api                     # All of restful API
│   ├── client                  # Client scope
│   │   ├── app                 # App root component
│   │   ├── assets              # Assets (e.g. images, fonts etc.)
│   │   ├── components          # Reusable components
│   │   ├── pages               # Page components
│   │   ├── stories             # UI components with Storybook
│   │   ├── themes              # App-wide style
│   │   ├── vendor              # 3rd libraries for client
│   │   └── index.js            # App bootstrap and rendering (webpack entry)
│   ├── middlewares             # All of express middleware
│   ├── model                   # Data transfer object
│   ├── mongo                   # MongoDB configuration
│   ├── secure                  # All of security (e.g passport configuration, jsonwebtoken etc.)
│   ├── store                   # Store configuration for both client and server side
│   ├── tools                   # Project related configurations
│   │   ├── jest                # Jest configurations
│   │   ├── webpack             # Webpack configurations
│   │   ├── hooks.js            # Assets require hooks
│   │   └── postcss.config.js   # PostCSS configuration
│   ├── types                   # All of type for flow
│   ├── utils                   # App-wide utils
│   ├── config.js               # Configuration entry point loaded from .env file
│   ├── i18n.js                 # I18next configuration
│   ├── index.js                # App entry point
│   ├── routes.js               # Routes configuration for both client and server side
│   └── server.js               # Express server
│── .babelrc                    # Babel configuration.
│── .env-cmdrc.json             # All of environments configuration.
│── .eslintrc.json              # Eslint configuration.
│── .flowconfig                 # Flow type configuration.
└── .prettierrc.json            # Prettier configuration.

Installation

$ yarn global add express-react-boilerplate
# or (sudo) npm install -g express-react-boilerplate

Getting Started

1. Usage:

$ erb-gen --help

  Usage: erb-gen [options]

  Options:
    -v, --version      output the version number
    -d, --dir <type>   project's directory. (default: ".")
    -n, --name <type>  project's name. (default: "express-react-boilerplate")
    -h, --help         output usage information

  Examples:
    $ erb-gen
    $ erb-gen --name example

2. Install dependencies:

$ cd <your_project>

$ yarn
# or npm install

3. Run it:

$ yarn dev
# or npm run dev

Build

$ yarn build
# or npm run build

NOTE: You can change environment variables in .env-cmdrc.json file.

Scripts

| Script | Description | | ------------- | ------------------------------------------------------------------------------------- | | dev | Start the development server. | | dev --serve | Start the development server and open browser. | | start | Start the production server. | | build | Remove the previous bundled files and bundle it (include client & server) to dist/. | | wp | Bundle client to dist/. | | analyze | Visualize the contents of all your bundles. | | storybook | Start the storybook server. | | test | Run testing. | | eslint | Find problems in your JavaScript code. |

Enable/Disable offline

  • In src/tools/webpack/webpack.config.prod.js:

    if (isDev) {
      ...
    } else {
      plugins = [
        ...,
        // Comment this plugin if you want to disable offline.
        new OfflinePlugin({
          autoUpdate: true,
          appShell: '/',
          relativePaths: false,
          updateStrategy: 'all',
          externals: ['/'],
        })
      ]
    }
  • At the end of src/client/index.js:

    if (!__DEV__) {
      require('offline-plugin/runtime').install(); // Comment this line if you want to disable offline.
    }

Supported Browsers

By default, the generated project supports all modern browsers. Support for Internet Explorer 9, 10, and 11 requires polyfills. For a set of polyfills to support older browsers, use react-app-polyfill.

$ yarn add react-app-polyfill
# or npm install --save react-app-polyfill

You can import the entry point for the minimal version you intend to support to ensure that the minimum language features are present that are required to use in your project. For example, if you import the IE9 entry point, this will include IE10 and IE11 support.

Internet Explorer 9

// This must be the first line in <PROJECT_ROOT>/src/client/app/index.js
import 'react-app-polyfill/ie9';
import 'react-app-polyfill/stable';

// ...

Internet Explorer 11

// This must be the first line in <PROJECT_ROOT>/src/client/app/index.js
import 'react-app-polyfill/ie11';
import 'react-app-polyfill/stable';

// ...

CSS variables

By default, the generated project supports all modern browsers. Support for Internet Explorer 9, 10, and 11 requires polyfills. For a set of polyfills to support older browsers, use css-vars-ponyfill.

// In <PROJECT_ROOT>/src/client/vendor/index.js
import cssVars 'css-vars-ponyfill';
// ... your css/scss files.
cssVars({
  silent: !__DEV__,
  ..., // https://jhildenbiddle.github.io/css-vars-ponyfill/#/?id=options
});

Type Checking For Editor

Contributors

Special Thanks

License

MIT License

Copyright (c) 2019 Huỳnh Trần Đăng Khoa

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.