0.0.3-alpha • Published 2 years ago

@searpro/create-react v0.0.3-alpha

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

React + Redux-toolkit + TypeScript + Vite - Starter kit šŸ”„

This is a customized version of the official Vite react-ts preset

FEATURES

āœ… Zero configuration redux application state.

āœ… Configuration management for different environments

āœ… HTTP helper with customized fetcher function with Axios.

āœ… Ready to use application router with react-router-dom

āœ… Sample code for pages and components.

āœ… Some vscode plugin recommendations for ESLint and prettier.

āœ… Pre-commit hooks for linting.

āœ… Pre-configured cypress test suite.

āœ… Working example of a component utilizing REST API with http helper and redux store.

šŸš€ And few other goodies.

Pre-requisites

nodejs >=18.18.0
vscode [recommended]

Getting started

$ npx @searpro/create-react <your-app-name>
.....
.....
$ cd <your-app-name> && npm run dev

Running the application

DEVELOPMENT
$ npm run dev

BUILD
$ npm run build

LINT
$ npm run lint 
$ npm run lint:fix #to fix lint errors

TEST
$ npm test

Application Structure

react-vite-redux-starter [folder structure]
ā”œā”€ā”€ index.html
ā”œā”€ā”€ public
│   └── [assets to be kept in public]
ā”œā”€ā”€ cypress
│   └── [cypress test specs]
└── src
    ā”œā”€ā”€ global.d.ts [global types]
    ā”œā”€ā”€ store
    │   └── [redux store related files]
    ā”œā”€ā”€ config
    │   ā”œā”€ā”€ environments
    │   │   └── [env-specific configurations. dev/qa/stg/prod etc]
    │   ā”œā”€ā”€ endpoints.ts  [api endpoints/paths with http method]
    │   └── index.ts [configuration entry point] 
    ā”œā”€ā”€ hooks
    │   └── [react custom hooks]
    ā”œā”€ā”€ pages
    │   ā”œā”€ā”€ [Main pages/container components]
    │   ā”œā”€ā”€ Users
    │   │   ā”œā”€ā”€ Users.tsx
    │   │   └── [css and other assets can also be added]
    │   └── Home
    │       └── Home.tsx
    └── components
        ā”œā”€ā”€ [Re-usable components]
        ā”œā”€ā”€ Button
        │   ā”œā”€ā”€ Button.tsx
        │   └── [assets/css etc can go here]
        ā”œā”€ā”€ Header
        │   └── Header.tsx
        └── Footer
            └── Footer.tsx

FURTHER READING..

For customizing Vite build, check out https://vitejs.dev/guide/

For more information on Redux-Toolkit: https://redux-toolkit.js.org/usage/usage-with-typescript

For more information on Cypress: https://docs.cypress.io/guides/component-testing/overview

For customizing Axios: https://axios-http.com/docs/req_config

✌