Skip to content

ExcuseMeBro/react-boilerplate

Repository files navigation

React Boilerplate

Clean starter for React apps that talk to REST APIs.

What is inside?

  • React 19 + TypeScript + Vite 8
  • Tailwind CSS 4
  • Redux Toolkit for app state
  • TanStack Query for server state
  • REST API client with JWT support
  • i18n: English, Uzbek, and Russian
  • Biome instead of ESLint and Prettier
  • Lightweight UI animations with Motion

Start

npm install
cp .env.example .env
npm run dev

App runs on http://localhost:3000.

Main commands

npm run dev             # start dev server
npm run build           # type-check and build
npm run check           # Biome lint + format check
npm run check:write     # auto-fix safe Biome issues
npm run audit           # security audit

REST API config

.env:

VITE_API_URL=http://localhost:8080/api
VITE_AUTH_STRATEGY=bearer
VITE_REQUEST_TIMEOUT_MS=15000

Auth endpoints expected by default:

  • POST /auth/login
  • GET /auth/me
  • POST /auth/refresh
  • POST /auth/logout

Todo example endpoints:

  • GET /todos
  • POST /todos
  • PATCH /todos/:id
  • DELETE /todos/:id

JWT note

For production, prefer server-set httpOnly, Secure, SameSite cookies. If backend requires bearer JWTs, set VITE_AUTH_STRATEGY=bearer and frontend sends Authorization: Bearer <token>.

Project structure

src/
  components/       shared UI
  config/           env config
  features/         feature modules: auth, todos
  layouts/          app layouts
  locales/          i18n dictionaries
  pages/            route pages
  plugins/          i18n setup
  services/         REST client and token storage
  store/            Redux Toolkit store

Add new feature

  1. Create src/features/<name>.
  2. Add types.ts and service.ts.
  3. Use api.get/post/put/patch/delete from src/services/http.ts.
  4. Add page or components.
  5. Add translation keys in en.json, uz.json, and ru.json.

No GraphQL

This boilerplate is REST-first. GraphQL packages and config are intentionally not included.

About

React boilerplate

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors