This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel (or oxc when used in rolldown-vite) for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
The React Compiler is enabled on this template. See this documentation for more information.
Note: This will impact Vite dev & build performances.
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
A modern, responsive React + TypeScript + Vite SaaS frontend for credit card management and financial transaction tracking.
# Install dependencies
pnpm install
# Start development server
pnpm dev
# Build for production
pnpm build
# Preview production build
pnpm preview
# Run linter
pnpm lint- Instant page transitions - Navigate between pages with 0ms blocking
- Automatic prefetching - Other pages' data loads in background
- Smart caching - React Query caches all data for instant access
- Skeleton loaders - See content indicators while data loads
- React Compiler enabled - Automatic memoization and optimizations
- Vite HMR - Fast hot module replacement during development
- Code splitting - Lazy-loaded routes for smaller initial bundle
- Query caching - React Query handles all data fetching and caching
- React 19 with TypeScript
- Vite - Lightning fast build tool
- Tailwind CSS + CVA - Utility-first styling with variants
- Radix UI - Headless, accessible component library
- React Query - Server state management
- React Router - SPA routing
- Sonner - Toast notifications
src/
βββ components/ # Reusable UI components
β βββ ui/ # Radix UI-based primitives
β βββ system/ # Layout & system components
β βββ skeletons/ # Loading skeletons
βββ pages/ # Page components
βββ hooks/ # Custom React hooks
β βββ api/ # API query hooks
βββ lib/ # Utilities & helpers
β βββ api/ # API client functions
β βββ auth/ # Authentication utilities
β βββ types/ # TypeScript types
βββ layouts/ # Layout wrappers
βββ context/ # React Context
βββ assets/ # Static assets
The app implements intelligent data prefetching to enable snappy navigation:
- User navigates to a page β Router changes instantly (0ms delay)
- Page component mounts β Shows skeleton immediately
- Data loads β Content renders when ready
- After page loads β Automatically prefetch other pages' data
Dashboard loads
ββ Shows content
ββ Prefetches: Transactions, Peoples, Cards (background)
User clicks "Transactions"
ββ Navigate INSTANTLY (data cached)
ββ Shows transactions
ββ Prefetches: Dashboard, Peoples, Cards (background)
User clicks "Peoples"
ββ Navigate INSTANTLY (data cached)
ββ Shows peoples
ββ Prefetches: Dashboard, Transactions, Cards (background)
- Dashboard (
/) - Overview with stats and recent transactions - Transactions (
/transactions) - List and search transactions - Transaction Detail (
/transactions/:id) - Single transaction details - Peoples (
/peoples) - Contact management - Cards (
/cards) - Credit/debit card management - Profile (
/profile) - User profile settings - Add Transaction (
/add-transaction) - Transaction creation
- Token-based authentication via
src/lib/auth/token.ts - AuthContext provides
useAuth()hook - Protected routes via
ProtectedRoutecomponent - Query client prefetches user data on app init
- Cross-tab token sync with
ccs:token-changedevent
All data fetching uses React Query with smart caching:
- Dashboard: 5 minute stale time
- Transactions: 3 minute stale time
- Peoples: 10 minute stale time
- Cards: 10 minute stale time
Hooks available in src/hooks/api/useQueries.ts:
useDashboardData();
useTransactionsQuery(page, limit);
useTransactionQuery(id);
usePeoplesQuery(page, limit);
useCardsQuery(page, limit);Uses Tailwind CSS with CVA (class-variance-authority) for component variants:
// Button with variants
<Button variant="default" size="lg">Click me</Button>
<Button variant="outline" size="sm">Secondary</Button>
<Button variant="destructive">Danger</Button>Dark mode support via dark: prefix throughout the app.
@/ resolves to ./src/
// Instead of
import { Button } from "../../components/ui/button";
// Use
import { Button } from "@/components/ui/button";useApiToast - API calls with toast feedback
const { executeApiCall } = useApiToast();
await executeApiCall({
apiCall: (signal) => fetch("/api/data", { signal }),
successMessage: "Data loaded!",
});usePrefetchPages - Prefetch other pages' data
const { prefetchDashboard, prefetchTransactions } = usePrefetchPages();pnpm devpnpm build # TypeScript check + Vite build
pnpm preview # Preview dist/ locally- Build output in
dist/ - Deploy to Netlify, Vercel, or any static host
- See
netlify.tomlfor Netlify configuration
Additional documentation in docs/ folder:
INSTANT_NAVIGATION_FIX.md- How instant navigation worksAUTOMATIC_PAGE_PREFETCHING.md- Page prefetching systemSNAPPY_NAVIGATION.md- Navigation improvementsREACT_QUERY_GUIDE.md- React Query patterns
Follow these patterns:
- Use TypeScript - Strict mode enabled
- Component structure - Use Radix UI + CVA for styling
- API calls - Use
useApiToastfor consistent UX - Error handling - Extract with
getApiErrorMessage() - Queries - Use hooks from
@/hooks/api/useQueries
Private project - All rights reserved
Built with β€οΈ for snappy SPA navigation
You can also install eslint-plugin-react-x and eslint-plugin-react-dom for React-specific lint rules:
// eslint.config.js
import reactX from "eslint-plugin-react-x";
import reactDom from "eslint-plugin-react-dom";
export default defineConfig([
globalIgnores(["dist"]),
{
files: ["**/*.{ts,tsx}"],
extends: [
// Other configs...
// Enable lint rules for React
reactX.configs["recommended-typescript"],
// Enable lint rules for React DOM
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ["./tsconfig.node.json", "./tsconfig.app.json"],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
]);