Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

phuthuycoding/react-dashboard-template

Repository files navigation

React Dashboard Template

A modern React dashboard template with authentication module and professional business theme. Built with clean MVVM architecture, ready for customization.

🌟 Features

  • πŸ” Authentication: Complete login system with Firebase integration
  • 🎨 Modern UI: Built with Tailwind CSS + shadcn/ui components
  • πŸŒ™ Theme Support: Dark/Light mode with professional blue color scheme
  • πŸ“± Responsive Design: Optimized for all devices
  • πŸ—οΈ MVVM Architecture: Clean separation of concerns
  • πŸ”₯ Firebase Ready: Pre-configured Firebase authentication with user-friendly setup UI
  • πŸ“¦ Type-Safe: Full TypeScript support
  • ⚑ Setup Friendly: Clear error messages and setup instructions when Firebase is not configured

πŸ› οΈ Tech Stack

  • Framework: React 19 + TypeScript
  • Build Tool: Vite 7
  • Styling: Tailwind CSS 4 + shadcn/ui
  • State Management: React Context + Custom Hooks
  • Routing: React Router v7
  • Form Handling: React Hook Form + Zod validation
  • Authentication: Firebase Auth
  • Icons: Lucide React
  • Notifications: Sonner
  • Package Manager: pnpm

πŸ—οΈ Project Structure

src/
β”œβ”€β”€ app/
β”‚ β”œβ”€β”€ config/ # App configuration (theme, menu)
β”‚ β”œβ”€β”€ layouts/ # Layout components
β”‚ β”œβ”€β”€ modules/
β”‚ β”‚ └── auth/ # Authentication module (MVVM)
β”‚ β”‚ β”œβ”€β”€ components/ # UI components
β”‚ β”‚ β”œβ”€β”€ hooks/ # Custom hooks
β”‚ β”‚ β”œβ”€β”€ models/ # Data models & schemas
β”‚ β”‚ β”œβ”€β”€ pages/ # Page components
β”‚ β”‚ β”œβ”€β”€ services/ # API services
β”‚ β”‚ β”œβ”€β”€ utils/ # Utility functions
β”‚ β”‚ └── viewmodels/ # Business logic
β”‚ β”œβ”€β”€ shared/ # Shared components & contexts
β”‚ β”‚ β”œβ”€β”€ components/
β”‚ β”‚ β”œβ”€β”€ contexts/
β”‚ β”‚ β”œβ”€β”€ hocs/
β”‚ β”‚ └── hooks/
β”‚ └── router.tsx # Route configuration
β”œβ”€β”€ components/ui/ # shadcn/ui components
β”œβ”€β”€ lib/
β”‚ β”œβ”€β”€ services/ # External services (Firebase)
β”‚ └── utils.ts # Utility functions
└── main.tsx # App entry point

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • pnpm (recommended) or npm

Installation

  1. Clone the repository:
git clone <repository-url>
cd react-dashboard-template
  1. Install dependencies:
pnpm install
  1. Set up environment variables:
cp .env.example .env
  1. Start development server:
pnpm dev
  1. Configure Firebase:
    • When you first run the app, you'll see a user-friendly setup screen
    • Follow the on-screen instructions to configure Firebase
    • Create a Firebase project at https://console.firebase.google.com
    • Enable Authentication > Sign-in method > Email/Password
    • Copy your Firebase config to .env:
VITE_FIREBASE_API_KEY=your_api_key
VITE_FIREBASE_AUTH_DOMAIN=your_auth_domain
VITE_FIREBASE_PROJECT_ID=your_project_id
VITE_FIREBASE_STORAGE_BUCKET=your_storage_bucket
VITE_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
VITE_FIREBASE_APP_ID=your_app_id
  1. Restart the development server after adding Firebase configuration

πŸ” Authentication Module

The auth module follows MVVM architecture:

  • Models: Data structures and validation schemas (Zod)
  • Views: React components (Login form, inputs, etc.)
  • ViewModels: Business logic and state management
  • Services: Firebase authentication API calls

Key Files:

  • src/app/modules/auth/pages/login.tsx - Login page
  • src/app/modules/auth/viewmodels/login.viewmodel.ts - Login business logic
  • src/app/modules/auth/services/auth.service.ts - Auth API calls
  • src/app/modules/auth/models/auth.schema.ts - Validation schemas
  • src/lib/services/firebase.ts - Firebase configuration
  • src/app/shared/components/firebase-setup-required.tsx - Setup UI component

Firebase Setup UI

The template includes a user-friendly setup screen that appears when Firebase is not configured:

  • Detects missing Firebase environment variables
  • Displays step-by-step setup instructions
  • Provides direct links to Firebase Console
  • Shows example .env configuration
  • Copy-to-clipboard functionality for easy setup

This ensures new users have a smooth onboarding experience instead of cryptic error messages.

πŸ“ Adding New Modules

To add a new module (e.g., dashboard, users, etc.):

  1. Create module directory:
mkdir -p src/app/modules/your-module/{components,hooks,models,pages,services,viewmodels}
  1. Add routes in src/app/router.tsx
  2. Add menu items in src/app/config/menu.ts
  3. Follow the MVVM pattern from the auth module

🎨 Theming

The template uses a professional business theme with blue as the primary color.

Theme Configuration

Theme configuration is in:

  • CSS Variables: src/index.css - Contains all color definitions in OKLCH format
  • Theme Object: src/app/config/theme.ts - Color palette constants

Color Scheme

Light Mode:

  • Primary: Professional Blue (oklch(0.5 0.15 250))
  • Secondary: Slate Gray
  • Radius: 0.5rem (slightly rounded corners)

Dark Mode:

  • Primary: Brighter Blue (oklch(0.6 0.18 250))
  • Background: Dark slate
  • Proper contrast for readability

Customizing Colors

To change the theme colors:

  1. Edit CSS variables in src/index.css (lines 43-182)
  2. Update the theme object in src/app/config/theme.ts
  3. Both light and dark modes can be customized independently

Available Utility Classes

  • .status-active, .status-pending, .status-error, .status-info, .status-neutral
  • .bg-business-gradient, .bg-business-gradient-dark
  • .card-hover - Smooth hover effects for cards
  • .glass, .glass-dark - Glass morphism effects

πŸ“¦ Build

Build for production:

pnpm build

Preview production build:

pnpm preview

🐳 Docker Support

Build Docker image:

docker build -t react-dashboard-template .

Run container:

docker run -p 3000:80 react-dashboard-template

πŸ“„ License

MIT

About

Simple react codebase implement with MVVM

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /