Skip to content

mukles/admin-dashboard-starter

Repository files navigation

Admin Dashboard Starter

React Vite TypeScript Tailwind CSS License: MIT

A production-ready, modular admin dashboard starter template built with modern web technologies. Designed for scalable enterprise applications, SaaS platforms, and internal tools requiring robust authentication, role-based access control, and modular architecture.

🌟 Key Features

  • πŸ—οΈ Modular Architecture - Independent, self-contained feature modules
  • πŸ” Enterprise Authentication - JWT-based with refresh token rotation
  • 🎨 Modern UI/UX - Built with shadcn/ui and Tailwind CSS
  • πŸ“Š Dashboard Components - Pre-built charts, tables, and analytics
  • πŸ›‘οΈ Type Safety - Full TypeScript integration with strict type checking
  • ⚑ Performance Optimized - Code splitting, lazy loading, and caching
  • πŸ§ͺ Testing Ready - Unit and integration test setup included
  • πŸ“± Responsive Design - Mobile-first, cross-device compatibility

πŸ›οΈ Architecture Overview

Modular Design Philosophy

The application follows a Domain-Driven Design (DDD) approach with clear separation of concerns:

src/
β”œβ”€β”€ app/                    # Application shell & core configuration
β”‚   β”œβ”€β”€ layout/            # Global layout components
β”‚   β”œβ”€β”€ providers/         # Context providers & global state
β”‚   └── router/            # Routing configuration & guards
β”œβ”€β”€ modules/               # Feature modules (domain boundaries)
β”‚   β”œβ”€β”€ auth/             # Authentication & authorization
β”‚   β”œβ”€β”€ dashboard/        # Main dashboard & analytics
β”‚   β”œβ”€β”€ users/            # User management
β”‚   └── [feature]/        # Additional feature modules
β”œβ”€β”€ shared/               # Cross-module shared resources
β”‚   β”œβ”€β”€ components/       # Reusable UI components
β”‚   β”œβ”€β”€ hooks/            # Custom React hooks
β”‚   β”œβ”€β”€ services/         # External integrations & utilities
β”‚   β”œβ”€β”€ types/            # Global TypeScript definitions
β”‚   └── utils/            # Helper functions & constants
└── styles/              # Global styles & theme configuration

Module Structure

Each feature module follows a consistent internal structure:

modules/[feature]/
β”œβ”€β”€ components/          # Feature-specific components
β”œβ”€β”€ hooks/              # Feature-specific React hooks
β”œβ”€β”€ pages/              # Route components
β”œβ”€β”€ services/           # API calls & business logic
β”œβ”€β”€ stores/             # State management
β”œβ”€β”€ types/              # TypeScript definitions
β”œβ”€β”€ utils/              # Feature-specific utilities
└── index.ts            # Public API exports

πŸ”’ Security & Authentication

JWT Implementation

  • Access Tokens: Short-lived (15 minutes) for API authentication
  • Refresh Tokens: Long-lived (7 days) for session renewal
  • Automatic Rotation: Seamless token refresh without user interruption
  • Secure Storage: Encrypted token storage with XSS protection

Route Protection

  • Role-Based Access Control (RBAC): Granular permission system
  • Route Guards: Automatic redirection based on authentication status
  • Protected Routes: Authenticated-only access with loading states
  • Public Routes: Login, registration, and marketing pages

Security Best Practices

  • CSRF Protection: Anti-CSRF tokens for state-changing operations
  • XSS Prevention: Content sanitization and CSP headers
  • Input Validation: Client and server-side validation with Zod
  • Secure Headers: Security headers configuration included

πŸš€ Quick Start

Prerequisites

  • Node.js: >= 18.0.0
  • Package Manager: pnpm (recommended), yarn, or npm
  • Git: For version control

Installation

  1. Clone the repository

    git clone https://github.com/mukles/admin-dashboard-starter.git
    cd admin-dashboard-starter
  2. Install dependencies

    pnpm install
  3. Environment setup

    cp .env.example .env.local
    # Configure your environment variables
  4. Start development server

    pnpm dev
  5. Open your browser Navigate to http://localhost:5173

Environment Variables

Create a .env.local file with the following variables:

# API Configuration
VITE_API_BASE_URL=http://localhost:3000/api
VITE_APP_NAME=Admin Dashboard

# Authentication
VITE_JWT_SECRET_KEY=your-secret-key-here
VITE_REFRESH_TOKEN_KEY=your-refresh-key-here

πŸ› οΈ Available Scripts

# Development
pnpm dev              # Start development server
pnpm dev:host         # Start with network access

# Building
pnpm build            # Build for production
pnpm preview          # Preview production build

# Code Quality
pnpm lint             # Run ESLint
pnpm lint:fix         # Fix linting issues
pnpm type-check       # Run TypeScript compiler
pnpm format           # Format code with Prettier

# Testing
pnpm test             # Run unit tests
pnpm test:watch       # Run tests in watch mode
pnpm test:coverage    # Generate coverage report

# Dependencies
pnpm deps:update      # Update dependencies
pnpm deps:audit       # Security audit

πŸ“¦ Technology Stack

Core Technologies

  • React 18 - UI library with concurrent features
  • Vite 5 - Next-generation build tool
  • TypeScript 5 - Type-safe JavaScript
  • React Router 6 - Client-side routing

UI & Styling

  • shadcn/ui - Accessible, customizable components
  • Tailwind CSS 3 - Utility-first CSS framework
  • Lucide Icons - Beautiful icon library
  • React Hook Form - Form handling
  • Zod - Runtime type validation

Development Tools

  • ESLint - Code linting
  • Prettier - Code formatting
  • Husky - Git hooks
  • Commitizen - Conventional commits

πŸ“Š Project Structure Deep Dive

Application Shell (app/)

Contains the core application setup, global providers, routing configuration, and layout components that wrap the entire application.

Feature Modules (modules/)

Self-contained domains with their own components, state, and business logic. New features are added as separate modules to maintain isolation and scalability.

Shared Resources (shared/)

Common utilities, components, and services used across multiple modules. This promotes code reuse while maintaining clear boundaries.

πŸ§ͺ Testing Strategy

Unit Testing

  • Vitest - Fast unit test runner
  • React Testing Library - Component testing utilities
  • MSW - API mocking for tests

Integration Testing

  • Playwright - End-to-end testing
  • Component Testing - Testing component interactions

Test Coverage

  • Minimum 80% code coverage requirement
  • Critical paths (authentication, payments) require 95% coverage

🚒 Deployment

Build Process

pnpm build

Deployment Options

Static Hosting (Vercel, Netlify)

# Automatic deployment with git integration
# Configure build command: pnpm build
# Publish directory: dist

Container Deployment (Docker)

FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN pnpm install
COPY . .
RUN pnpm build
EXPOSE 4173
CMD ["pnpm", "preview", "--host"]

CDN Deployment

Optimized for global distribution with asset optimization and caching strategies.

πŸ“ˆ Performance Optimizations

  • Code Splitting - Automatic route-based splitting
  • Lazy Loading - Dynamic imports for heavy components
  • Image Optimization - Automatic image compression and WebP support
  • Bundle Analysis - Built-in bundle analyzer
  • Caching Strategy - Optimized browser caching headers

πŸ”§ Customization

Theme Configuration

Modify src/styles/theme.css to customize colors, typography, and spacing.

Adding New Modules

# Create new module structure
mkdir -p src/modules/your-module/{components,hooks,pages,services,stores,types,utils}

Component Library Extension

Add new shadcn/ui components:

npx shadcn-ui@latest add [component-name]

πŸ“š Documentation

🀝 Contributing

We welcome contributions! Please read our Contributing Guidelines before submitting pull requests.

Development Workflow

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Code Standards

  • Follow TypeScript best practices
  • Maintain test coverage above 80%
  • Use conventional commit messages
  • Document new features and APIs

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • shadcn/ui for the excellent component library
  • Tailwind CSS for the utility-first CSS framework
  • React team for the amazing library
  • Vite for the lightning-fast build tool

πŸ“ž Support


⭐ Star this repository if you find it helpful!

Made with ❀️ by Mukles

Releases

No releases published

Packages

 
 
 

Contributors