The frontend for the Contact Management RESTful API. Built with React 19 and TypeScript, featuring a feature-based architecture, full CRUD for contacts and addresses, and a clean responsive UI with dark/light mode support.
Live Demo: contact-management.malfin.xyz | Depends on: contact-management-restful-api-ts
- JWT Authentication — Register & login with JWT. Token persisted to
localStoragevia Zustand. Auto-logout and redirect on 401 via Axios response interceptor. - Contact Management — Full CRUD: create, view, edit, and delete contacts with client-side search/filter and pagination.
- Address Management — Each contact can have multiple addresses. Full CRUD per address using dialog-based forms.
- Profile — Update username and password from the profile page.
- Dark / Light Mode — System-aware theme toggle powered by
next-themes. - Skeleton Loading — Dedicated skeleton components for every async state — no layout shift.
- Toast Notifications — Consistent success/error feedback via
sonneron every mutation. - Route Guards —
AuthGuard(protected routes) andGuestGuard(auth pages) prevent unauthorized access and preserve post-login redirect.
| Layer | Technology |
|---|---|
| Language | TypeScript 5 |
| UI Framework | React 19 |
| Build Tool | Vite 8 |
| Styling | Tailwind CSS v4 |
| Server State | TanStack Query v5 |
| Client State | Zustand v5 |
| Forms | React Hook Form + Zod |
| HTTP Client | Axios |
| Routing | React Router v7 |
| UI Primitives | Shadcn / Base UI |
| Notifications | Sonner |
| Theme | next-themes |
This project uses a feature-based folder structure with a strict layered pattern inside each feature:
src/
├── features/
│ ├── auth/
│ │ ├── auth.types.ts # TypeScript interfaces
│ │ ├── auth.schema.ts # Zod schema + inferred payload types
│ │ ├── auth.service.ts # Raw Axios API calls
│ │ ├── auth.store.ts # Zustand client state (persisted)
│ │ ├── auth.hook.ts # TanStack Query mutations with toast feedback
│ │ ├── guards/ # AuthGuard, GuestGuard
│ │ └── components/ # Feature-scoped UI components
│ ├── contact/ # Contact CRUD feature
│ ├── address/ # Address CRUD feature (nested under contact)
│ └── user/ # Profile management feature
│
├── components/
│ ├── ui/ # Shadcn-style primitive components
│ └── form/ # Shared form fields (InputField, ButtonField, etc.)
│
├── lib/
│ ├── api.ts # Axios instance + auth interceptors
│ ├── queryClient.ts # TanStack Query client config
│ └── utils.ts # cn(), errorHookResponse()
│
├── pages/ # Route-level page components
├── layouts/ # AuthLayout, MainLayout
├── routes/ # createBrowserRouter config
└── stores/ # Global app stores
User Action
│
▼
React Component ──► useXxxHook (TanStack Query)
│
▼
xxxService ──► api (Axios + JWT) ──► REST API
│
▼
queryClient.invalidateQueries ──► UI re-renders
cp .env.example .envVITE_API_BASE_URL=your_api_base_url_here| Variable | Description | Default |
|---|---|---|
VITE_API_BASE_URL |
Base URL of the REST API | http://localhost:3000/api |
npm install
npm run dev # Dev server with HMR → http://localhost:5173Other commands:
npm run build # Type-check + production build → dist/
npm run preview # Preview production build locally
npm run lint # Run ESLintThe frontend is deployed on Vercel and connects to the REST API hosted on a VPS.
To deploy your own instance:
- Push the repo to GitHub
- Import the project on Vercel
- Set
VITE_API_BASE_URLin the Vercel dashboard → Settings → Environment Variables - Deploy — Vercel will build and serve the app automatically
vercel.jsonis included to configure SPA fallback routing so React Router works correctly on direct URL access and page refresh.
- Contact Management API — the Express.js backend this app consumes