A production-ready React boilerplate with authentication, routing, API utilities, and responsive layout components.
- 🛠️ Modern Tooling: Built with Vite + React + TypeScript
- 🔐 Authentication: Context-based auth system with JWT support
- 🚦 Routing: Protected & public routes with React Router
- 📡 API Client: Axios-based request utility with interceptors
- 🎨 Styling: TailwindCss and Shadcn UI
- 🔄 State Management: React Query for server state & context api for client state
- 🧹 Code Quality: ESLint for linting
- ⚡ Performance: Code splitting, lazy loading, and top progress bar
-
Clone the repository
git clone https://github.com/your-username/react-boilerplate.git cd react-boilerplate -
Install dependencies using pnpm
pnpm install
-
Create a
.envfile based on.env.examplecp .env.example .env
-
Start the development server
pnpm dev
src/
├── components/ # Reusable components
├── contexts/ # React contexts
├── hooks/ # Custom hooks
├── lib/ # Utility functions
├── pages/ # Page components├── styles/ # Global styles
├── App/App.tsx # Main app component
└── main.tsx # Entry point
- JWT token storage in localStorage
- Auth context with login/logout methods
- Protected route wrapper
- Automatic profile fetching on app load
- Axios-based
baseRequestutility - Automatic auth header injection
- Error handling
- AbortController support
- Responsive max-width wrapper
- Persistent layout with header/footer
- Scroll restoration
- Loading indicators
The GitHub Actions workflow (.github/workflows/ci.yml) includes:
- Linting: Runs ESLint on every push
- Build: Production build verification
- Deployment: (Configure your deployment steps)
pnpm dev: Start development serverpnpm build: Create production buildpnpm lint: Run ESLintpnpm preview: Preview production build locally
| Variable | Description |
|---|---|
VITE_APP_SERVER_URL |
Base API URL |
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a pull request
MIT
- Add a
CONTRIBUTING.mdfor contribution guidelines - Include a
CHANGELOG.mdfor version history - Add a
SECURITY.mdfor vulnerability reporting - Consider adding a code coverage badge if you implement tests
- Add visual examples (screenshots/GIFs) of key features