Skip to content

Instantly share code, notes, and snippets.

@psamim
Last active June 10, 2017 05:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save psamim/9d6c7d699d17b0baa39c8cfe364d20f9 to your computer and use it in GitHub Desktop.
Save psamim/9d6c7d699d17b0baa39c8cfe364d20f9 to your computer and use it in GitHub Desktop.

Directory Layout

.
├── /components/                # Shared or generic UI components
│   ├── /Button/                # Button component
│   ├── /Layout/                # Website layout component
│   ├── /Link  /                # Link component to be used insted of <a>
│   └── /...                    # etc.
├── /core/                      # Core framework
│   ├── /history.js             # Handles client-side navigation
│   ├── /router.js              # Handles routing and data fetching
│   └── /store.js               # Application state manager (Redux)
├── /node_modules/              # 3rd-party libraries and utilities
├── /pages/                     # React components for web pages
│   ├── /about/                 # About page
│   ├── /error/                 # Error page
│   ├── /home/                  # Home page
│   └── /...                    # etc.
├── /public/                    # Static files such as favicon.ico etc.
│   ├── /dist/                  # The folder for compiled output
│   ├── favicon.ico             # Application icon to be displayed in bookmarks
│   ├── robots.txt              # Instructions for search engine crawlers
│   └── /...                    # etc.
├── /test/                      # Unit and integration tests
├── /utils/                     # Utility and helper classes
│── main.js                     # React application entry point
│── package.json                # The list of project dependencies and NPM scripts
│── routes.json                 # This list of application routes
│── run.js                      # Build automation script, e.g. `node run build`
└── webpack.config.js           # Bundling and optimization settings for Webpack

Getting Started

Step 1. Make sure that you have Node.js v6 or newer installed on your machine.

Step 2. Install:

$ cd <<APP>>
$ npm install                   # Install project dependencies listed in package.json

Step 3. Compile and launch your app by running:

$ node run                      # Same as `npm start` or `node run start`

You can also test your app in release (production) mode by running node run start --release or with HMR and React Hot Loader disabled by running node run start --no-hmr. The app should become available at http://localhost:3000/.

How to Deploy

If you need just to build the project without publishing it, run:

$ node run build                # Or, `node run build --release` for production build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment