Get Started in 5 Minutes
This guide will help you set up and run the Auth Dashboard locally. You’ll learn how to install dependencies, configure the application, and implement authentication.Prerequisites
Before you begin, ensure you have:- Node.js 18+ installed on your machine
- npm, yarn, or pnpm package manager
- A code editor (VS Code recommended)
- Basic knowledge of React and TypeScript
Setup Steps
Clone and Install
First, navigate to your project directory and install dependencies:This installs all required packages including React, TypeScript, Zustand, and Axios.
Start the Development Server
Run the development server:The application will start at
http://localhost:5173 (default Vite port).Access the Login Page
Open your browser and navigate to
http://localhost:5173/login. You’ll see the login interface.The dashboard uses DummyJSON API for demonstration. Use the default credentials:
emilys / emilyspassImplement Authentication
The authentication system is already configured. Here’s how it works:The store uses Zustand with persistence to maintain user sessions across page refreshes.
src/features/auth/authStore.tsx
Use Authentication in Components
Access authentication state and methods in any component:
src/pages/Login.tsx
Test the Authentication
You can now test the complete authentication flow:- Navigate to
http://localhost:5173/login - Enter credentials:
emilys/emilyspass - Click “Login” - you’ll be redirected to the dashboard
- Try accessing protected routes - they’ll work!
- Refresh the page - your session persists
- Logout and try accessing protected routes - you’ll be redirected to login
The application uses DummyJSON API (
https://dummyjson.com) for backend services. In production, replace this with your own API.API Configuration
The API client is configured insrc/services/api.ts with automatic token injection:
src/services/api.ts
What’s Next?
Configuration
Learn how to configure the API endpoint and other settings
Authentication Guide
Deep dive into the authentication system
User Management
Explore user CRUD operations
Routing
Learn about protected routes and navigation
Common Issues
Port 5173 already in use
Port 5173 already in use
If port 5173 is already in use, Vite will automatically try the next available port. Check your terminal output for the actual port.
Login fails with network error
Login fails with network error
Ensure you have an active internet connection. The app uses DummyJSON API which requires internet access.
Session doesn't persist
Session doesn't persist
Check your browser’s localStorage settings. The app uses localStorage for session persistence.