This project is a frontend dashboard application built using React (Vite) and Tailwind CSS.
It demonstrates authentication flow, protected routing, reusable components and responsive UI design.
The project simulates a real-world admin and tenant portal.
Follow the steps below to run the project locally:
Open terminal inside the project folder and run:
npm install
npm run dev
Open your browser and visit:
src/
├── components/
│ ├── common/
│ │ ├── ProtectedRoute.jsx
│ │ └── LoginGuard.jsx
│ │
│ └── ui/
│ ├── StatCard.jsx
│ ├── Badge.jsx
│
├── layouts/
│ └── DashboardLayout.jsx
│
├── pages/
│ ├── admin/
│ │ ├── AdminLogin.jsx
│ │ └── AdminDashboard.jsx
│ │
│ ├── tenant/
│ │ ├── TenantLogin.jsx
│ │ └── TenantDashboard.jsx
│ │
│ ├── Profile.jsx
│ └── Settings.jsx
│
├── App.jsx
└── main.jsx
-
components/common
Contains reusable logic components such as route protection and login guards. -
components/ui
Contains reusable UI components like cards and badges. -
layouts
Contains the common dashboard layout including sidebar and header. -
pages
Contains all application screens such as login, dashboards, profile and settings. -
App.jsx
Manages routing configuration. -
main.jsx
Entry point of the React application.
This project uses localStorage to simulate authentication.
- User enters email and password.
- Validation checks required fields and email format.
- On successful login:
- Role is stored as
"admin"in localStorage. - User is redirected to Admin Dashboard.
- Role is stored as
- User enters Tenant ID, email and password.
- Validation is performed.
- On successful login:
- Role is stored as
"tenant". - Tenant ID is stored.
- User is redirected to Tenant Dashboard.
- Role is stored as
- Clears role, tenantId and theme from localStorage.
- Redirects user to Landing Page.
Routing is handled using React Router DOM.
- Checks the user role from localStorage.
- If role is missing or incorrect, user is redirected to landing page.
- Prevents unauthorized access to dashboards.
- Prevents logged-in users from accessing login pages again.
- Automatically redirects logged users to their respective dashboards.
- Uses nested routing.
- Sidebar and header remain fixed.
- Only page content changes using
<Outlet />.
Samarth Khot
Final Year – Computer Engineering