Skip to content

mobitrendz/react-frontend-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

78 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

React 19 + FastAPI Frontend Template

Frontend Code Quality Test Coverage Coverage Percentage

A modern, high-performance full-stack template featuring a React 19 frontend and a FastAPI backend. Optimized for 2026 industry standards, this template is pre-configured with a premium design system, TanStack Query orchestration, and comprehensive unit testing.

πŸ”— Related Repositories

πŸ›  Tech Stack

  • Frontend: React 19 (TypeScript)
  • State Management: TanStack Query (React Query)
  • Routing: React Router 7
  • UI Components: shadcn/ui + Lucide Icons
  • Build Tool: Vite 8
  • Styling: Tailwind CSS 4
  • Validation: Zod
  • Testing: Vitest + RTL

πŸ—οΈ 2026 Modern Standards

This template goes beyond basic boilerplate by implementing high-performance patterns:

  • πŸ”„ Server State Orchestration: Powered by TanStack Query for automatic caching, background revalidation, and built-in loading/error management.
  • πŸ›‘οΈ Fail-Safe Environment: Zod-validated configuration ensures the app never starts with missing or invalid environment variables.
  • 🎨 Premium UI Framework: Built on shadcn/ui and Tailwind CSS 4, featuring glassmorphism, adaptive dark mode, and Lucide-powered iconography.
  • 🧬 Contract-First SDK: Type-safe API client generated directly from your FastAPI OpenAPI schema.

πŸš€ Key Features

πŸ’» Frontend & User Experience

  • πŸ”’ Secure Authentication: Robust login/signup flow with JWT persistence and public registration support.
  • πŸ›£ Multi-Page Architecture: Seamless navigation between Dashboard and Profile using React Router 7.
  • βœ… Advanced Task Management: Inline editing, priority filtering, and real-time search for tasks.
  • πŸ‘€ Account Lifecycle: Secure account deletion with password verification and automated task cleanup.
  • πŸŒ“ Adaptive Design: Premium dark-mode design system with modern micro-animations.

πŸ›  Administrative Controls

  • πŸ‘₯ User Management: Powerful admin dashboard to manage all system users.
  • ⚑ Status Control: Instant activation/deactivation of user accounts with visual feedback.
  • βž• Admin Creation: Create new administrative accounts directly from the control center.
  • πŸ” Search & Filter: Sophisticated user searching and role-based filtering.

πŸ§ͺ Unit Testing & Quality Assurance

The project maintains high standards for reliability with a comprehensive test suite and automated quality gates.

Test Coverage Status

Category Coverage
Statements 92.66%
Lines 93.98%
Functions 90.47%
Branches 84.46%

Test Coverage Details

Our test suite covers critical user flows and administrative edge cases:

  • πŸ” Authentication: Full coverage for login, token persistence, and role-based route protection.
  • πŸ‘€ Profile Management: Testing for user details updates, password changes, and account deletion flows.
  • βœ… Task Operations: Comprehensive testing of Task CRUD, filtering, and real-time search functionality.
  • πŸ› οΈ Admin Controls:
    • User Management: Creation, deletion, and status toggling for administrative and regular accounts.
    • System Intelligence: Metrics visualization, server health monitoring, and request success ratios.
  • πŸ›‘οΈ Error Handling: Robust testing of global Error Boundaries and API error extraction logic.

Testing Stack

  • Vitest: A blazing fast unit test framework powered by Vite.
  • React Testing Library: The industry standard for testing component behavior.
  • JSDOM: Modern browser environment simulation.

Testing Workflow

To maintain our high reliability standards, follow these steps during development:

  1. Watch Mode: Best for active development.
    npm test
  2. Full Validation: Run the entire suite once (used in pre-commit).
    npm run test:run
  3. Coverage Report: Generate a detailed HTML report in /coverage.
    npm run test:coverage
  4. Formatting Check: Verify code style without applying fixes.
    npm run format:check
  5. UI Debugging: Vitest provides a powerful UI for visualizing test flows.
    npx vitest --ui

πŸ›‘οΈ Automated Quality Checks

CI/CD API Guardrails

Our GitHub Actions workflow (frontend.yml) includes an automated API Sync Check. If the backend schema changes without a corresponding frontend SDK update (npm run generate-client), the CI pipeline will fail, preventing broken contracts from reaching production.

Local Git Hooks

Before every commit, pre-commit runs ESLint, Prettier, and TypeScript type-checks to ensure only high-quality code enters the repository. This ensures absolute consistency with our CI/CD standards.

🏁 Getting Started

Prerequisites

  1. Node.js: v22.14.0 (locked via .nvmrc).
  2. Python: 3.12+ (required for pre-commit).
  3. Backend: FastAPI backend running (default: http://localhost:8000).

πŸš€ Quick Start

Get up and running in less than 60 seconds. This template is designed for Zero-Config local development.

  1. Install dependencies:
    npm install
    pre-commit install
  2. Generate the API Client:
    npm run generate-client
  3. Start development:
    npm run dev

Tip

The app defaults to http://localhost:8000 for the backend. To customize this or other settings, see the Environment Configuration section below.

βš™οΈ Environment Configuration

While the app works out-of-the-box with sensible defaults, you can customize your environment by creating a .env file:

cp .env.example .env

Configuration Options

Variable Description Default
VITE_API_URL The base URL for your FastAPI backend. http://localhost:8000
VITE_ENV Current execution environment. development
VITE_ENABLE_ANALYTICS Toggle for premium analytics tracking. false

🧬 API Integration (@hey-api/openapi-ts)

This project uses @hey-api/openapi-ts to generate a type-safe SDK. We've enhanced this with TanStack Query support for a declarative data-fetching experience.

Usage Example

import { useQuery } from "@tanstack/react-query";
import { readTodosApiV1TodosGet } from "./client/sdk.gen";

const { data, isLoading, error } = useQuery({
  queryKey: ["todos"],
  queryFn: () => readTodosApiV1TodosGet(),
});

πŸ“‚ Project Structure

  • src/client/: Auto-generated API client and TanStack Query hooks.
  • src/components/ui/: shadcn/ui primitives (Button, Input, Card, etc.).
  • src/lib/: Shared utilities (Auth logic, error handling, env validation).
  • src/env.ts: Zod-validated environment schema.
  • src/index.css: Tailwind 4 design system.

Built with ❀️ for rapid full-stack development. Refer to CONTRIBUTING.md for contribution guidelines.

πŸ“‹ Release Notes

See the full Release Notes for a detailed history of changes.

βš–οΈ License

This project is licensed under the MIT License.

πŸ’‘ Inspiration

This project is heavily inspired by the official full-stack-fastapi-template in the FastAPI repository. It builds upon those foundational concepts, incorporating modern toolchain upgrades, enhanced observability, and AI-optimized developer workflows.

About

An evolving, enterprise-grade React template

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages