create-vite-rtk-app
v1.0.1
Published
Create a Vite React app with Redux Toolkit, Axios, React Router, and a sample async API flow.
Maintainers
Readme
create-vite-rtk-app
Create a ready-to-use Vite React application with Redux Toolkit, an async thunk API flow, Axios, and React Router.
The generated app includes a small users example powered by JSONPlaceholder, so you can run the project and immediately see Redux async state management in action.
Features
- Vite + React
- Redux Toolkit store and feature slice
createAsyncThunkAPI flow with loading, success, and error states- React Redux hooks and Provider setup
- Reusable Axios instance
- React Router with a shared layout and 404 route
- Refresh, retry, and clear user actions
- Clean, beginner-friendly feature folder structure
- No separate
redux-thunkdependency; Redux Toolkit includes thunk middleware
Requirements
- Node.js 20.19 or newer
- npm 10 or newer
Usage
Create a project:
npm create vite-rtk-app my-appThen start the development server:
cd my-app
npm run devThe target directory must not already exist.
Local testing with npm link
From this package directory:
npm linkMove to the directory where you want to create the test app, then run:
create-vite-rtk-app my-appWhen you are finished testing, you can remove the global link:
npm unlink -g create-vite-rtk-appGenerated folder structure
src/
app/
store.js
assets/
components/
features/
users/
usersSlice.js
Users.jsx
hooks/
layouts/
MainLayout.jsx
pages/
Home.jsx
About.jsx
NotFound.jsx
routes/
AppRoutes.jsx
services/
api.js
utils/
App.jsx
main.jsxInstalled packages
The CLI first creates the Vite React project and installs its standard dependencies. It then installs:
@reduxjs/toolkit
react-redux
axios
react-router-domredux-thunk is intentionally not installed separately because
configureStore from Redux Toolkit includes thunk middleware by default.
Publish to npm
Before publishing, update the package version if needed and verify that the package name is available. Then run:
npm login
npm publish --access publicAfter publishing, anyone can create an app with:
npm create vite-rtk-app my-appLicense
MIT
