A React-based task management application with authentication, dashboard, and task CRUD operations.
- ✅ Register page with form validation
- ✅ Login page with form validation
- ✅ Error message display
- ✅ JWT token storage after login
- ✅ Redirect after successful login
- ✅ Display logged in user info
- ✅ List of tasks
- ✅ Admin dashboard shows all users and all tasks
- ✅ Create task
- ✅ View tasks
- ✅ Edit task -Fields ✅ Delete task
:
- ✅ Title
- ✅ Description
- ✅ Status (pending/completed)
Rules:
- ✅ Normal users see only their tasks
- ✅ Admin sees all tasks
- ✅ JWT for protected routes
- ✅ Handle API errors properly
- ✅ Show loading states
- ✅ Logout functionality
- ✅ Clean design
- ✅ Simple interface
- ✅ Responsive layout
- ✅ Proper spacing
- ✅ Consistent colors
- ✅ Mobile friendly layout
- ✅ Client side form validation
- ✅ Required field messages
- ✅ API error display
- ✅ Empty state handling
- ✅ Minimum 2 component tests (Login, TaskCard)
- ✅ Minimum 1 integration/API test
- ✅ JWT stored in localStorage
- ✅ Protected routes
- ✅ No secrets in frontend
- ✅ Environment variables for API URL
task-tracker-frontend/
├── src/
│ ├── api/
│ │ ├── api.js # Axios API client
│ │ └── mock.js # Mock API for development
│ ├── components/
│ │ ├── Navbar.js # Navigation component
│ │ ├── ProtectedRoute.js # Route protection
│ │ └── TaskCard.js # Task display component
│ ├── pages/
│ │ ├── Dashboard.js # Main dashboard
│ │ ├── LoginPage.js # Login form
│ │ └── RegisterPage.js # Registration form
│ ├── services/
│ │ ├── authService.js
│ │ └── taskService.js
│ ├── utils/
│ │ └── auth.js
│ ├── App.js # Main app with routing
│ ├── index.js # Entry point
│ └── index.css # Global styles
├── tests/
│ ├── api.test.js # API integration tests
│ ├── Login.test.js # Login component tests
│ └── TaskCard.test.js # TaskCard component tests
├── .env # Environment variables
├── .env.example # Example env file
├── package.json
└── README.md
- Node.js (v14 or higher)
- npm or yarn
- Clone the repository:
git clone <repository-url>
cd task-tracker-frontend- Install dependencies:
npm install- Create environment file:
cp .env.example .env- Start the development server:
npm startThe app will open at http://localhost:3000
Run all tests:
npm testRun specific test file:
npm test -- Login.test.js
npm test -- TaskCard.test.js
npm test -- api.test.jsnpm run buildThe application includes mock data with the following demo accounts:
| Role | Password | |
|---|---|---|
| Admin | admin@example.com | admin123 |
| User | user@example.com | user123 |
The app uses environment variables for API configuration:
REACT_APP_API_URL=http://localhost:5000/api
For development, the mock API is enabled by default.
npm start- Start development servernpm test- Run testsnpm run build- Build for productionnpm run eject- Eject from Create React App
- React 19
- React Router 7
- Axios
- Jest & React Testing Library
- Tailwind CSS (via CDN or custom styles)
MIT