Back to Blog
Web Development

PIT Frontend: React Dashboard for Equipment Repair & Tracking

View Repository on GitHubLive Website / Demo

What Is PIT Frontend?

pitfrontend is the client-side dashboard for the PIT Equipment Repair & Tracking System — a full-stack application that digitises the complete repair lifecycle for production equipment. It pairs with pitbackend, a Laravel 11 REST API.

The system is built for warehouse and production environments — tracking everything from intake and fault logging through diagnosis, parts management, and resolution.

Tech Stack

LayerTechnology
FrameworkReact 18+ (Vite)
StylingTailwind CSS
State ManagementReact Context API (AuthContext) — no Redux
HTTP ClientAxios
Iconslucide-react
DeploymentVercel (vercel.json)

Role-Based UI

The frontend enforces access control using React ProtectedRoute components that wrap role-sensitive views. Each role sees a different slice of the application:

RoleAccessible Routes
adminAll routes (/*)
electronics_head/dashboard, /equipment, /tickets, /tickets/intake
technician/dashboard, /tickets (assigned tickets only)
management/dashboard, /equipment, /tickets (read-only)

When the backend returns a 401 Unauthorized response, the frontend immediately clears the Sanctum token from localStorage and redirects to /login — no stale sessions persist.

Architecture

The React app compiles to static assets (/dist) which are served directly from the cPanel public_html directory alongside the Laravel backend. The README documents this deployment pattern explicitly:

public_html/
├── index.php   ← Symlinked Laravel public entry
└── /dist       ← Compiled React static assets

This co-location on shared cPanel hosting avoids the need for a separate frontend server or CDN, which is the practical reality for many production deployments in the East African market.

Auth Flow

  1. User submits credentials to POST /api/login
  2. Laravel Sanctum returns a token
  3. Token stored in localStorage, attached to all subsequent requests via Axios interceptor
  4. AuthContext provides user, token, and logout globally
  5. ProtectedRoute checks role before rendering any protected view

Vite Configuration

The vite.config.js is customised for the cPanel deployment — the build output targets public_html/dist and asset paths are configured to work correctly when served as a subdirectory alongside the Laravel entry point.

View on GitHub →