Modern, responsive frontend for the Autonova automobile service management platform
Features β’ Tech Stack β’ Quick Start β’ Development
- Overview
- Features
- Tech Stack
- Quick Start
- Project Structure
- Development
- Authentication
- State Management
- Styling Guide
- Building
- Testing
- Docker
- Troubleshooting
The Autonova frontend is a modern single-page application (SPA) built with React 18 and TypeScript. It provides role-based dashboards for customers, employees, and administrators to manage vehicle services, appointments, time tracking, and billing. The application uses Vite for lightning-fast development, Tailwind CSS for styling, and shadcn/ui for beautiful, accessible UI components.
- π¨ Modern UI/UX - Beautiful interface with Tailwind CSS + shadcn/ui
- π Secure Authentication - JWT + OAuth2 Google login integration
- π± Fully Responsive - Mobile-first design that works on all devices
- β‘ Lightning Fast - Vite HMR for instant feedback during development
- π― Type-Safe - Full TypeScript support with strict mode
- π Real-time Updates - Live data synchronization with TanStack Query
- π§© Component Library - 50+ reusable shadcn/ui components
- π Optimized Build - Production builds with code splitting
- π Authentication - Login, signup, password recovery, Google OAuth2
- π€ Profile Management - Update personal information and settings
- π Notifications - Real-time alerts and notifications
- π Theme Support - Light/dark mode (ready for implementation)
- π Appointment Booking - Schedule vehicle services with date/time picker
- π Vehicle Management - Add, edit, and track multiple vehicles
- π Service Tracking - Real-time progress updates on services
- π³ Billing & Invoices - View, download, and pay invoices
- π§ Communication - Message service center directly
- β±οΈ Time Logging - Start/stop timers for tasks with smart tracking
- π Task Management - View and manage assigned tasks
- π Performance Metrics - Weekly summaries, efficiency meters
- π― Smart Suggestions - AI-powered task recommendations
- π Analytics - Personal productivity insights
- π₯ User Management - CRUD operations for all user types
- π Analytics Dashboard - Revenue, appointments, performance stats
- π Time Log Review - Monitor and approve employee time entries
- π° Billing Operations - Generate and manage invoices
- βοΈ System Settings - Configure application parameters
Framework: React 18.3.1
Language: TypeScript 5.8.3
Build Tool: Vite 5.4.19
Package Manager: pnpm (recommended) / npm / yarn
CSS Framework: Tailwind CSS 3.4.17
Component Lib: shadcn/ui (Radix UI primitives)
Icons: Lucide React 0.462.0
Animations: Tailwind CSS animations
Form Controls: Radix UI primitives
Router: React Router DOM 6.30.1
Protected Routes: Custom RequireAuth component
Role-based: RBAC with Can component
Server State: TanStack Query 5.83.0 (React Query)
Client State: Zustand 5.0.8
Global State: React Context API (AuthContext)
Form Library: React Hook Form 7.61.1
Schema Validation: Zod 3.25.76
Type Generation: Automatic TypeScript types from Zod
HTTP Client: Axios 1.13.2
Interceptors: Request/response interceptors
Base URL: Configured via environment variables
Charts: Recharts 2.15.4
Tables: Custom DataTable components
Analytics: Custom dashboard components
Notifications: Sonner 1.7.4 (toast notifications)
Date Handling: date-fns 3.6.0
Calendar: Radix UI + date-fns integration
Dialogs: Radix UI Dialog
Dropdowns: Radix UI Dropdown Menu
Tooltips: Radix UI Tooltip
Linting: ESLint 9.17.0
Type Checking: TypeScript strict mode
Hot Reload: Vite HMR
Dev Server: Vite dev server
E2E Testing: Playwright 1.48.2
Test Runner: Playwright Test
UI Mode: Interactive test debugging
Ensure you have the following installed:
# Node.js 18 or later
node -v # Should be v18.0.0 or higher
# pnpm (recommended) or npm
pnpm -v # Install: npm install -g pnpm
# OR
npm -v # v9.0.0 or higherOptional: Use nvm to manage Node.js versions:
nvm install 18
nvm use 18git clone https://github.com/void-squad/autonova-frontend-v1.git
cd autonova-frontend-v1# Using pnpm (recommended)
pnpm install
# OR using npm
npm install
# OR using yarn
yarn install# Copy the example environment file
cp .env.example .env
# Edit .env with your configuration
nano .envRequired Environment Variables:
# Backend API URL
VITE_API_BASE_URL=http://localhost:8080
# OAuth2 Configuration
VITE_GOOGLE_CLIENT_ID=your-google-client-id.apps.googleusercontent.com
# Optional: Environment
VITE_APP_ENV=development# Using pnpm
pnpm dev
# OR using npm
npm run devThe application will start at: http://localhost:5173
Vite offers hot-module reloading for rapid iteration - changes appear instantly!
autonova-frontend-v1/
β
βββ public/ # Static assets
β βββ robots.txt # SEO configuration
β
βββ src/
β βββ pages/ # Route-level components
β β βββ admin/ # Admin dashboard pages
β β β βββ Dashboard.tsx
β β β βββ UserManagement.tsx
β β β βββ Analytics.tsx
β β βββ employee/ # Employee dashboard pages
β β β βββ Dashboard.tsx
β β β βββ TimeLogging.tsx
β β β βββ Tasks.tsx
β β βββ customer/ # Customer dashboard pages
β β β βββ Dashboard.tsx
β β β βββ Appointments.tsx
β β β βββ Vehicles.tsx
β β βββ Login.tsx # Login page
β β βββ Signup.tsx # Registration page
β β βββ ForgotPassword.tsx # Password recovery
β β βββ ResetPassword.tsx # Password reset
β β βββ OAuth2Callback.tsx # OAuth2 callback handler
β β βββ Profile.tsx # User profile
β β βββ Landing.tsx # Landing page
β β
β βββ components/ # Reusable UI components
β β βββ ui/ # shadcn/ui components
β β β βββ button.tsx
β β β βββ dialog.tsx
β β β βββ input.tsx
β β β βββ select.tsx
β β β βββ ... (50+ components)
β β βββ layout/ # Layout components
β β β βββ DashboardLayout.tsx
β β β βββ AdminSidebar.tsx
β β β βββ EmployeeSidebar.tsx
β β β βββ CustomerSidebar.tsx
β β βββ auth/ # Authentication components
β β β βββ RequireAuth.tsx # Protected route wrapper
β β β βββ Can.tsx # Permission-based rendering
β β βββ timelogging/ # Time logging feature
β β β βββ ActiveTimer.tsx
β β β βββ TimeLogHistory.tsx
β β β βββ TimeLogStats.tsx
β β β βββ README.md
β β βββ billing/ # Billing components
β β β βββ InvoiceTable.tsx
β β β βββ InvoiceFilters.tsx
β β β βββ PayInvoiceDialog.tsx
β β βββ projects/ # Project management
β β βββ DataTable.tsx
β β βββ StatusBadge.tsx
β β
β βββ services/ # API service clients
β β βββ authService.ts # Authentication API
β β βββ userService.ts # User management API
β β βββ billingService.ts # Billing API
β β βββ employeeDashboardService.ts
β β βββ projectService.ts
β β
β βββ contexts/ # React contexts
β β βββ AuthContext.tsx # Global auth state
β β
β βββ hooks/ # Custom React hooks
β β βββ use-toast.ts # Toast notifications
β β βββ use-invoices.ts # Invoice data fetching
β β βββ use-debounce.ts # Input debouncing
β β βββ use-mobile.tsx # Mobile detection
β β
β βββ lib/ # Utility functions
β β βββ utils.ts # Helper functions
β β βββ auth.ts # Auth utilities
β β βββ routes.ts # Route definitions
β β βββ api/ # API client setup
β β βββ client.ts # Axios instance
β β βββ interceptors.ts # Request/response interceptors
β β
β βββ types/ # TypeScript type definitions
β β βββ auth.ts # Authentication types
β β βββ employee.ts # Employee types
β β βββ billing.ts # Billing types
β β βββ appointment.ts # Appointment types
β β βββ project.ts # Project types
β β βββ index.ts # Exported types
β β
β βββ Api/ # Additional API clients
β β βββ notificationsApi.ts
β β βββ timeLoggingApi.ts
β β
β βββ App.tsx # Main app component (routing)
β βββ App.css # App-specific styles
β βββ main.tsx # Application entry point
β βββ index.css # Global styles (Tailwind)
β βββ vite-env.d.ts # Vite type declarations
β
βββ .github/
β βββ workflows/
β βββ docker-publish.yml # CI/CD pipeline
β
βββ components.json # shadcn/ui configuration
βββ tailwind.config.ts # Tailwind CSS configuration
βββ tsconfig.json # TypeScript configuration
βββ vite.config.ts # Vite configuration
βββ postcss.config.js # PostCSS configuration
βββ eslint.config.js # ESLint configuration
βββ package.json # Dependencies and scripts
βββ pnpm-lock.yaml # pnpm lock file
βββ .env.example # Environment variables template
βββ .gitignore # Git ignore rules
βββ Dockerfile # Docker image definition
βββ docker-compose.yml # Docker Compose configuration
βββ README.md # This file
# Start development server with hot reload
pnpm dev
# or: npm run dev
# Build for production
pnpm build
# or: npm run build
# Preview production build locally
pnpm preview
# or: npm run preview
# Run ESLint
pnpm lint
# or: npm run lint
# Build for development (includes source maps)
pnpm build:dev
# or: npm run build:dev- β‘ Hot Module Replacement (HMR) - Instant updates without full reload
- π Error Overlay - Beautiful error messages in browser
- π¦ Pre-bundling - Fast dependency loading with esbuild
- π Optimized Imports - Automatic code splitting
Components: PascalCase.tsx (Button.tsx, UserCard.tsx)
Hooks: use-kebab-case.ts (use-auth.ts, use-debounce.ts)
Services: camelCase.ts (authService.ts, userService.ts)
Types: camelCase.ts (auth.ts, employee.ts)
Utilities: camelCase.ts (utils.ts, helpers.ts)
// 1. Imports
import { useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { Button } from '@/components/ui/button'
// 2. Types
interface MyComponentProps {
title: string
onSubmit: () => void
}
// 3. Component
export default function MyComponent({ title, onSubmit }: MyComponentProps) {
// 4. State and hooks
const [isLoading, setIsLoading] = useState(false)
const navigate = useNavigate()
// 5. Event handlers
const handleClick = () => {
setIsLoading(true)
onSubmit()
}
// 6. Render
return (
<div className="flex flex-col gap-4">
<h1>{title}</h1>
<Button onClick={handleClick} disabled={isLoading}>
Submit
</Button>
</div>
)
}npx shadcn-ui@latest add button
npx shadcn-ui@latest add dialog
npx shadcn-ui@latest add select# Create file: src/pages/NewPage.tsx
# Add route in: src/App.tsx// src/services/newService.ts
import { api } from '@/lib/api/client'
export const newService = {
async getData() {
const response = await api.get('/api/endpoint')
return response.data
}
}import { useAuth } from '@/contexts/AuthContext'
function MyComponent() {
const { user, isAuthenticated, login, logout } = useAuth()
const handleLogin = async () => {
await login({ email: 'user@example.com', password: 'pass123' })
}
return (
<div>
{isAuthenticated ? (
<p>Welcome, {user?.userName}!</p>
) : (
<button onClick={handleLogin}>Login</button>
)}
</div>
)
}import { RequireAuth } from '@/components/auth/RequireAuth'
// In App.tsx
<Route
path="/admin"
element={
<RequireAuth allowedRoles={['ADMIN']}>
<AdminDashboard />
</RequireAuth>
}
/>import { Can } from '@/components/auth/Can'
<Can roles={['ADMIN', 'EMPLOYEE']}>
<Button>Admin/Employee Only</Button>
</Can>- π Login Flow
- π Signup Flow
- π OAuth2 Callback
- π Password Recovery
import { useQuery, useMutation } from '@tanstack/react-query'
import { billingService } from '@/services/billingService'
function InvoiceList() {
// Fetch data with caching
const { data, isLoading, error } = useQuery({
queryKey: ['invoices'],
queryFn: () => billingService.getInvoices(),
staleTime: 5 * 60 * 1000, // 5 minutes
})
// Mutations with optimistic updates
const mutation = useMutation({
mutationFn: billingService.payInvoice,
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['invoices'] })
},
})
if (isLoading) return <div>Loading...</div>
if (error) return <div>Error: {error.message}</div>
return <div>{/* Render invoices */}</div>
}import { create } from 'zustand'
interface TimerStore {
isRunning: boolean
duration: number
start: () => void
stop: () => void
}
const useTimerStore = create<TimerStore>((set) => ({
isRunning: false,
duration: 0,
start: () => set({ isRunning: true }),
stop: () => set({ isRunning: false }),
}))
// Usage
const { isRunning, start, stop } = useTimerStore()// Layout
<div className="flex items-center justify-between gap-4 p-6">
// Typography
<h1 className="text-2xl font-bold text-gray-900 dark:text-white">
// Responsive
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3">
// States
<button className="hover:bg-blue-600 active:scale-95 disabled:opacity-50">import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
import { Dialog, DialogContent } from '@/components/ui/dialog'
<Button variant="default" size="lg">Click Me</Button>
<Input type="email" placeholder="Enter email" />- π Component Library
- π¨ Time Logging Components
# Create optimized production build
pnpm build
# Output directory: dist/
# - Minified JavaScript
# - Optimized CSS
# - Code splitting
# - Asset optimization# Build with analysis
pnpm build
# Check bundle size
ls -lh dist/assets/pnpm preview
# Opens at: http://localhost:4173# Install Playwright browsers (first time only)
npx playwright install
# Run all tests
npx playwright test
# Run in UI mode (interactive)
npx playwright test --ui
# Run specific test file
npx playwright test login.spec.ts
# Debug mode
npx playwright test --debug// tests/login.spec.ts
import { test, expect } from '@playwright/test'
test('user can login', async ({ page }) => {
await page.goto('http://localhost:5173/login')
await page.fill('input[name="email"]', 'test@example.com')
await page.fill('input[name="password"]', 'password123')
await page.click('button[type="submit"]')
await expect(page).toHaveURL(/.*dashboard/)
})docker build -t autonova-frontend .docker run -p 80:80 autonova-frontend# Start with Docker Compose
docker-compose up -d
# Stop
docker-compose downThe Dockerfile uses multi-stage builds for optimized production images:
- Builder stage: Builds the application
- Production stage: Serves with Nginx
# Change port in vite.config.ts
export default defineConfig({
server: {
port: 5174
}
})# Verify backend is running
curl http://localhost:8080/actuator/health
# Check .env configuration
cat .env | grep VITE_API_BASE_URL# Clear node_modules and reinstall
rm -rf node_modules
pnpm install# Restart TypeScript server in VS Code
Cmd+Shift+P β "TypeScript: Restart TS Server"# Clear Vite cache
rm -rf node_modules/.vite
# Rebuild
pnpm buildEnable verbose logging:
DEBUG=* pnpm dev- π Main Project README
- βοΈ Backend README
- π Employee Dashboard Architecture
- β±οΈ Time Logging Integration
- π Time Logging API Requirements
- React Documentation
- TypeScript Handbook
- Vite Guide
- Tailwind CSS Docs
- shadcn/ui Components
- TanStack Query
See main Contributing Guidelines
- β Follow TypeScript strict mode
- β Use Tailwind CSS utilities (avoid custom CSS)
- β Implement responsive design (mobile-first)
- β Add loading states for async operations
- β Handle error states gracefully
- β Use React Hook Form for all forms
- β Validate with Zod schemas
- β Write meaningful component names
- β Add JSDoc comments for complex logic
- β Test E2E flows with Playwright
This project is licensed under the MIT License.
Part of the Autonova Platform