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

cra-template-cwg-react

v1.1.1

Published

Create react app starter with Redux, React Router with Private Route, Lodash, Axios Interceptor everything pre-configured

Downloads

14

Readme

GitHub license GitHub stars GitHub issues

CWG React Starter

Pre-configured and Ready to use React Starter App. To save time in settings things up for new project. Almost everything needed is already configured. Just clone and start developing without wasting time in doing same stuffs for every project

You can use it with Create React App as Template

npx create-react-app <app-name> --template cwg-react

Read detailed explanation here

Overview

Things included in this starter app

  • Folder Structure
  • Axios Interceptor
  • Redux with Redux-Thunk
  • Router with Private Route
  • Confugured for SCSS/SASS
  • Eslint & Prettier
  • Pre-commit Hook
  • Absolute Imports

Please follow this import style for better code readability

Folder Structure

Big and extensive React application should have well planned and organized project structure. Best way is to use a mix of strategies to achieve better results as I am going to describe next.

Top level project architecture (which is under src/ folder) should be organized by type. No files should be here, just folders. This way it will be clear and understandable. Similar to a home where you have a foundation, walls, roof and etc. Under these walls are rooms, but may be you don't want to go there if you have some work outside like for instance painting walls. Having files in here adding mess. We should keep it clear like this:

- src/
  - main/
  - modules/
  - library/
  - resources/

Main Folder : This folder is for main configurations such as Redux Create Store, Axios Instance and Routes

- src/main/
  - axios/
    - index.js
  - routes
    - index.js
    - PrivateRoute.js
  - store/
    - index.js
    - mainReducer.ts

Modules Folder : This folder is for Modules/Features of our app, we can treat this as containers. Each module/feature will have all its related files in same folder. We may have some module related components which we will be placing inside frames folder and components which are used in more than one module we will keep in common/components to share across the application. Reason for keeping all related files in same folder to increase maintainability and searchability.

- src/modules/
  - Dashboard/
    - index.jsx
    - dashboardStyles.scss
    - dashboardActions.js
    - dashboardConstants.js
    - dashboardReducer.js
    - frames/
      - HeaderFrame/
        - index.jsx
        - headerFrameStyles.scss
      - CoolFrame/
        - inex.jsx
        - coolFrameStyles.scss

Library Folder : This folder will keep all our helpers and common files which will be shared across the application. We have 2 major folder in this common and utilities. If you want to create some api services you can keep it in api folder inside library folder.

- src/library/
  - common
    - components
      - Header
        - index.jsx
        - styles.scss
      - Dropdown
        - index.jsx
        - styles.scss
    - actions
      - AuthActions.js
    - constants
      - StoreConstant.js
      - ImagesConstants.js
      - URLConstants.js
    - reducers
      - AuthReducer.js
  - utilities
    - Validators.js
    - Storage.js
  - api - (optional folder as per requirement create this)
    - AuthApiService.js

Resources Folder : This folder will be used to keep all our static resources such as images, styles (mixins, variable etc), seeds, fonts etc. In current starter pack fonts and seed folder is not created, you can add them as per your need.

- src/resources/
  - images/
    - logo.svg
  - styles/
    - variables.scss
    - mixins.scss
  - fonts/
    - Roboto.ttf
  - seed/
    - country.json

Imports Style

Order should be as below

Imports from node_modules

Absolute Imports

Relative Imports

example:

import React from "react";
import { uniqBy } from "lodash";

import AppNavbar from "library/common/components/AppNavbar";

import "./style.scss";