← Home|
Frontend Documentation

Frontend

Task Manager — Next.js Application

A full-stack task management application built with Next.js, React, and TypeScript. The frontend provides a modern, responsive interface for user authentication and task management, communicating with a backend API hosted on AWS.

Overview

A full-stack task management application built with Next.js, React, and TypeScript. The frontend provides a modern, responsive interface for user authentication and task management, communicating with a backend API hosted on AWS.

Tech Stack

CategoryTechnology
FrameworkNext.js (App Router)
LanguageTypeScript
StylingTailwind CSS
HTTP ClientAxios
IconsLucide React
React Compilerbabel-plugin-react-compiler

Project Structure

Root: frontend/src/

@types/

TypeScript type definitions — constants (TaskStatus) and interfaces (auth, tasks)

app/

Next.js App Router pages — login, signup, user dashboard, API proxy routes

components/

React components — dashboard, landing page, layout, login, signup

config/axios.ts

Axios instance and helper configuration

context/AuthContext.tsx

Global authentication context provider

hooks/

Custom hooks — useAuth, useTasks for data fetching

utils/api/

API service functions — auth.ts and tasksApi.ts

Authentication Flow

1

User Registration

/signup

User submits username, email, and password. API call to /api/auth/register. On success, redirects to login page.

2

User Login

/login

User submits email and password. JWT token stored in localStorage. User data fetched and stored in AuthContext. Redirects to /user dashboard.

3

Protected Routes

/user

AuthContext checks for token on mount. Fetches user data if token exists. Redirects to login if unauthenticated. Provides logout() function to clear session.

State Management

AuthContext (Global)

Global authentication state managed via React Context

NameTypeDescription
userDataUserDataUser profile and task statistics
authenticatedbooleanBoolean authentication status
loadingbooleanLoading state during auth check
logout()functionClears session
fetchUser()functionRefreshes user data

Local Component State

Task lists managed with useTasks hook. Form states with useState. Modal visibility controlled locally.

Data Models

UserDataUser profile with task statistics
FieldType
data.task_data.completed_tasksnumber
data.task_data.pending_tasksnumber
data.task_data.ongoing_tasksnumber
data.task_data.tasks_countnumber
data.user_data.idstring
data.user_data.usernamestring
data.user_data.emailstring
ITaskIndividual task object
FieldType
task_idstring
titlestring
descriptionstring
status"pending" | "ongoing" | "complete"
created_atstring

API Endpoints

Base URL: https://6ft4bgs2e6.execute-api.ap-south-1.amazonaws.com/api/v1

Authorization: Bearer token in Authorization header

POST/api/auth/registerPUBLICCreate new user
POST/api/auth/loginPUBLICAuthenticate user, returns JWT
GET/api/auth/userAUTHGet current user data
POST/api/tasks/createtaskAUTHCreate new task
GET/api/tasks/showtaskAUTHFetch all user tasks
PUT/api/tasks/updatetask/:task_idAUTHUpdate task status
DELETE/api/tasks/deletetask/:task_idAUTHDelete task

Component Reference

AuthProviderContext

Wraps entire app. Manages session, token validation, logout, auto-fetches user data on mount.

LoginPage Component

Email/password form with visibility toggle, validation, error states, loading states, glassmorphism design.

SignupPage Component

Username/email/password registration form with validation, error handling, success redirect.

UserPageDashboard

Main dashboard with user profile header, task statistics sidebar, task list, logout button, protected route logic.

TasksFeature Component

Task list display, add button, status dropdown per task, delete functionality, empty state UI, modal integration.

AddTaskModalModal

Title input (required), description textarea (optional), form validation, submit/cancel, loading state.

Scripts & Setup

NPM Scripts

npm run devStart development server on localhost:3000
npm run buildBuild for production
npm startStart production server

Features

Landing page with hero, features, and about sections
User registration and JWT login
Protected dashboard with task statistics
Create, update status, and delete tasks
Password visibility toggle
Responsive mobile-first design
Glassmorphism UI with gradient backgrounds
Loading states and error feedback

Future Enhancements

Task filtering and search
Due dates and reminders
Dark mode toggle
Email verification and password reset