Version: 1.3.1 (Latest)
b1nd-react-app is a modern React boilerplate template powered by Rsbuild (default) or Vite for rapid development. It includes pre-configured authentication setup with Axios interceptors for seamless API communication. The project structure is extensible and optimized for both development and production environments.
⚡ Rsbuild: 5-10x faster build speed than Webpack (zero-config, zero setup) 🚀 Vite Alternative: Sub-second HMR for alternative bundler choice 🔐 Auth Ready: Built-in token management and axios interceptors 📦 Production Ready: Optimized for both development and production builds 🎯 CLI: Interactive setup with TypeScript/JavaScript and npm/yarn/pnpm/bun support
Create a new project with a single command:
npx b1nd-react-app my-appOr use the current directory:
npx b1nd-react-app .The CLI will guide you through these selections:
-
Bundler Selection (Choose your build tool):
❯ Rsbuild (Recommended, Fastest) ⚡ Vite -
Language Selection (Choose your language):
❯ TypeScript JavaScript -
Package Manager Selection (Choose your package manager):
❯ npm yarn pnpm bun -
Axios Integration (Include API client):
❯ Yes (Recommended) No
You can also use CLI flags to skip the prompts:
# Use Rsbuild with TypeScript
npx b1nd-react-app my-app --bundler rsbuild --language ts
# Use Vite with JavaScript
npx b1nd-react-app my-app --bundler vite --language js
# Skip dependency installation
npx b1nd-react-app my-app --skip-installAfter creating your project, navigate to the directory and start development:
cd my-app
# Start development server
npm run dev # or yarn dev, pnpm dev, bun dev
# Build for production
npm run build # or yarn build, pnpm build, bun build
# Preview production build locally
npm run preview # or yarn preview, pnpm preview, bun preview
# Run linting
npm run lint # or yarn lint, pnpm lint, bun lint
# Format code with Prettier
npm run format # or yarn format, pnpm format, bun format| Bundler | Install Time | Build Time | HMR |
|---|---|---|---|
| Rsbuild | ~30-60s | 5-10x faster | 3-4s |
| Vite | ~30-60s | Fast | <1s |
| Webpack | ~2-3 min | Baseline | 9-10s |
| CRA (Deprecated) | ~2-3 min | Slow | 10s+ |
If you selected Axios during setup, you'll need to configure the following:
-
API Base URL (
src/config/config.json):{ "server": "https://your-api-baseurl.com" } -
Token Refresh Endpoint (
src/libs/axios/responseInterceptor.ts):- Update the
/refreshendpoint to match your API's token refresh route - Modify the request body structure to match your API's requirements
- Update the
-
Login URL (
src/libs/axios/requestInterceptor.ts):- Change the default
/loginpath to your application's login route - This path is used when tokens are invalid
- Change the default
-
Token Storage (
src/libs/token/token.ts):- By default, tokens are stored in browser cookies
- You can modify this to use localStorage, sessionStorage, or other methods
- Token Storage: By default, tokens are stored in browser cookies
- Token Types:
accessToken(short-lived) andrefreshToken(long-lived) - Setting Tokens: Use
Token.setToken(key, value)after authenticationimport Token from '@libs/token/token'; import { ACCESS_TOKEN_KEY } from '@constants/token.constants'; // After login Token.setToken(ACCESS_TOKEN_KEY, response.data.accessToken);
- Automatic Refresh: Axios interceptors automatically handle token refresh on 401 errors
- This boilerplate follows a component-based architecture optimized for React
- Designed to work well with modern state management solutions (React Context, Zustand, Redux)
- Works seamlessly with React Query for server state management
- Path aliases (@components, @hooks, etc.) are pre-configured for cleaner imports
- Remove Axios: If you don't need Axios, delete
src/libs/andsrc/config/directories - Token Storage: Replace cookie storage in
src/libs/token/token.tswith localStorage or sessionStorage - Styling: Add CSS-in-JS libraries (styled-components, emotion) as needed
├─public
└─src
├─api # API related files
├─assets # Static files such as images, fonts, etc.
├─components # UI components
├─config # Configuration files (config.json)
├─constants # Constant files
│ └─token # Token-related constants
│ └─token.constants.ts
├─hooks # Custom hooks
├─libs # Libraries and helper functions
│ └─axios # Axios-related settings
│ ├─customAxios.ts
│ ├─requestInterceptor.ts
│ └─responseInterceptor.ts
│ └─token # Token-related settings
│ └─token.ts
├─pages # Page components
├─queries # React Query related files
├─styles # CSS/SCSS files
├─types # Type definitions
└─utils # Utility functions
The project follows a component-based architecture with React hooks, context, and optional state management.
Rsbuild is a blazing-fast build tool powered by Rspack (Rust-based). It offers:
- ⚡ 5-10x faster builds than Webpack
- 🚀 Zero-config setup with sensible defaults
- 🔄 Consistent Dev/Production builds
- 📦 Automatic code splitting and chunking
- ✅ Full Webpack plugin compatibility
The Rsbuild template includes optimized configuration for production builds with chunk splitting and minification.
📖 Rsbuild Architecture Guide 📚 Official Rsbuild Docs
Vite is a modern bundler focused on speed with:
- ⚡ Sub-second HMR (Hot Module Replacement)
- 🚀 Fast cold starts
- 📦 Optimized production builds
- 🎯 Great developer experience
The Vite template provides an alternative for developers who prefer Vite's approach.
📖 Vite Architecture Guide 📚 Official Vite Docs
The b1nd-react-app community can be found on GitHub Discussions, where you can ask questions, share ideas, and showcase your projects with other community members.
Please note that our Code of Conduct applies to all b1nd-react-app community channels. We strongly encourage all users to read and adhere to the Code of Conduct to ensure a respectful and productive environment for everyone.
Contributions to b1nd-react-app are welcome and highly appreciated. However, before you jump right into it, we would like you to review our Contribution Guidelines to ensure a smooth experience contributing to the project.
We have a list of good first issues that are perfect for newcomers and beginners. These issues are relatively limited in scope, making them a great starting point to gain experience, understand the contribution process, and get familiar with the codebase. Check out the list of good first issues and start contributing today! How to write an issue
We look forward to your contributions!