A modern AI-powered freelance marketplace frontend built with Next.js App Router, Tailwind CSS, React Query, NextAuth, and TypeScript.
This frontend is designed to work with a backend API and provides:
- AI-assisted pitch generation and career coaching
- Gig marketplace browsing and saved listings
- Freelancer, client, and admin dashboards
- Role-based navigation and authentication flows
- Profile management, orders, disputes, and moderation tools A modern AI-powered freelance marketplace frontend built with Next.js App Router, Tailwind CSS, React Query, NextAuth, and TypeScript.
This frontend is designed to work seamlessly with our backend API, providing a robust platform for freelancers and clients to connect, collaborate, and leverage AI for career growth.
- Public landing pages: home, explore, talent, about, blog, contact, FAQ
- Authentication with email/password and Google login
- Dashboard workspace for freelancers, clients, and admins
- AI-powered pages for pitch generation, analysis, recommendations, and chat
- Marketplace pages for gig browsing, saved gigs, and gig details
- Central Axios API client in
src/lib/api.ts - JWT session token injection using
next-authsession data - Backend base URL configured with
NEXT_PUBLIC_API_URL - Shared API helpers for auth, gigs, talent, reviews, blog, AI, and admin actions
- Direct backend fetch usage in registration and protected user pages
📂 Project structure (click to expand folders)
src/app/ — App Router pages & layouts
src/app/
├── (auth)/
│ ├── login/page.tsx
│ └── register/page.tsx
├── (dashboard)/
│ ├── layout.tsx
│ ├── dashboard/page.tsx
│ ├── dashboard/gigs/page.tsx
│ ├── dashboard/orders/page.tsx
│ ├── dashboard/finances/page.tsx
│ ├── dashboard/messages/page.tsx
│ ├── dashboard/profile/page.tsx
│ ├── dashboard/saved/page.tsx
│ ├── dashboard/billing/page.tsx
│ ├── dashboard/purchases/page.tsx
│ └── dashboard/admin/
│ ├── users/page.tsx
│ ├── moderation/page.tsx
│ └── disputes/page.tsx
├── ai-pitch/page.tsx
├── analytics/page.tsx
├── blog/page.tsx
├── chat/page.tsx
├── contact/page.tsx
├── explore/page.tsx
├── faq/page.tsx
├── about/page.tsx
├── gigs/[slug]/page.tsx
├── talent/page.tsx
├── layout.tsx
└── page.tsx
login/page.tsx,register/page.tsx: auth UI and flows (usesnext-authand direct fetch for register).explore/page.tsx: gig discovery; callsgigApi.getGigs(...)with filters and pagination.gigs/[slug]/page.tsx: gig details, saved-gigs checks and toggle endpoints.- Dashboard pages: protected routes reading/writing via
apiandadminApihelpers.
src/components/ — Reusable UI & page blocks
src/components/
├── ui/ # button.tsx, input.tsx, card.tsx, tabs.tsx, etc.
├── layout/ # Navbar.tsx, Footer.tsx, DashboardSidebar.tsx
├── cards/ # GigCard.tsx, GigCardSkeleton.tsx, TalentCard.tsx
├── shared/ # UserAvatar.tsx, EmptyState.tsx, Pagination.tsx
└── home/ # HeroSection.tsx, FeaturesSection.tsx, CTASection.tsx
ui/: low-level primitives used across the app.layout/: global and dashboard layout components (Navbar handles auth state).home/: landing page sections imported bysrc/app/page.tsx.
src/hooks/ — Custom hooks that call APIs and provide utilities
src/hooks/
├── useAI.ts # wraps aiApi (buildPitch, analyzeCareer, chat)
├── useAuth.ts # next-auth helpers and logout flow
├── useDebounce.ts # debounce input values
├── useGigs.ts # React Query hooks for gigs (list, detail, my-gigs)
└── useRole.ts # helper to check user roles
- Hooks use
@tanstack/react-queryandsrc/lib/api.tshelpers to fetch/mutate data.
src/lib/ — API client, auth config, constants, utilities
src/lib/
├── api.ts # central Axios instance + api helpers (authApi, gigApi, aiApi, adminApi)
├── auth.ts # next-auth options and callbacks
├── constants.ts # ROUTES, API_BASE_URL, demo creds, categories
├── query-client.ts # React Query default config
└── utils.ts # small helpers (cn, formatters)
api.tsattaches tokens viagetSession()and exposes typed helpers used across pages.auth.tsmaps backend login responses into NextAuth session tokens.
src/providers/ — App providers
src/providers/
└── Providers.tsx # SessionProvider, QueryClientProvider, NextThemesProvider
- Wraps the entire app; configures React Query and theme behavior.
src/store/ — Zustand stores for small persistent UI state
src/store/
├── authStore.ts # persisted auth UI state
├── chatStore.ts # local AI chat state (drafts, history pointers)
└── uiStore.ts # global UI toggles (modals, drawers)
- These are local-only, complementing server session state from NextAuth.
src/types/ — TypeScript interfaces & global types
src/types/
├── index.ts # User, Gig, ApiResponse, AI types
├── next-auth.d.ts # NextAuth session augmentation
└── global.d.ts # global declarations
- Central type definitions used for API responses and frontend models.
src/validations/ — Zod schemas for form validation
src/validations/
├── auth.schema.ts # loginSchema, registerSchema
├── pitch.schema.ts # AI pitch input validation
└── profile.schema.ts # profile update checks
- Zod validators are used on the client before sending requests to the backend.
src/app/— route-driven pages and layout organizationsrc/components/— reusable UI, page blocks, dashboard panels, and cardssrc/lib/— backend client, auth configuration, constants, and helperssrc/hooks/— custom React hooks interacting with API and session statesrc/providers/— application wrappers for React Query, NextAuth, and themesrc/store/— client-side persisted state with Zustandsrc/types/— app-wide TypeScript models and API typingssrc/validations/— Zod schemas for form validation
- Centralized API Client: Built with Axios (
src/lib/api.ts) for clean network requests. - Secure Sessions: JWT session token injection using
next-authsession data. - Shared API Helpers: Modularized logic for auth, gigs, talent, reviews, blog, AI, and admin actions.
- Environment Configuration: Easily configurable backend base URL via
NEXT_PUBLIC_API_URL.
src/lib/api.ts- Creates an Axios instance with
baseURLfromAPI_BASE_URL - Adds
Content-Type: application/json - Uses
getSession()to attachAuthorization: Bearer <token>for authenticated requests - Normalizes errors for consistent frontend handling
- Exposes REST helpers:
authApigigApitalentApireviewApiblogApiaiApiadminApi
- Creates an Axios instance with
- Framework: Next.js (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- State Management: Zustand (Client state), TanStack React Query (Server state)
- Authentication: NextAuth.js
- Validation: Zod
src/lib/auth.ts- Defines
next-authoptions with Credentials and Google providers - Credentials provider calls
${API_BASE_URL}/auth/login - Google callback calls
${API_BASE_URL}/auth/google/callback?id_token=... - Maps backend user fields into session token and session objects
- Defines
src/app/(auth)/login/page.tsx- Uses
signIn('credentials')andsignIn('google')
- Uses
src/app/(auth)/register/page.tsx- POSTs directly to
${API_BASE_URL}/auth/register - Auto-signs in the user after successful registration
- POSTs directly to
src/app/explore/page.tsx- Calls
gigApi.getGigs(...) - Sends filters for search, category, price, sorting, page, and limit
- Calls
src/app/gigs/[slug]/page.tsx- Calls
gigApi.getGigBySlug(...) - Loads saved gigs via
api.get('/users/saved-gigs') - Toggles saved status with
api.post('/users/saved-gigs/${gig._id}')
- Calls
src/app/blog/page.tsx- Uses
blogApi.getPosts(...)
- Uses
src/components/home/BlogPreview.tsx- Also fetches
blogApi.getPosts({ limit: 3 })
- Also fetches
src/app/ai-pitch/page.tsx- Uses
useAI/aiApi.chat(...)for AI pitch generation
- Uses
src/app/chat/page.tsx- Uses
aiApi.chat(...)to power the career coach chat interface
- Uses
src/app/analytics/page.tsx- Uses
aiApioradminApifor analytics-style results
- Uses
src/hooks/useAI.ts- Wraps AI mutations and queries in React Query for reusable behavior
src/app/(dashboard)/dashboard/profile/page.tsx- GET
/users/profile - PUT
/users/profile - POST
/users/change-password
- GET
src/app/(dashboard)/dashboard/gigs/page.tsx- Calls
gigApi.getMyGigs()for freelancer listings
- Calls
src/app/(dashboard)/dashboard/orders/page.tsx- Loads buyer or order data from protected backend routes
src/app/(dashboard)/dashboard/saved/page.tsx- Uses saved gig APIs and toggles saved state
src/app/(dashboard)/dashboard/admin/users/page.tsx- Calls
adminApi.getUsers(...) - Toggles user status and updates user roles
- Calls
src/app/(dashboard)/dashboard/admin/moderation/page.tsx- Calls
adminApi.getGigs(...) - Updates gig status via moderation actions
- Calls
src/app/(dashboard)/dashboard/admin/disputes/page.tsx- Calls
adminApi.getDisputes(...) - Resolves disputes with
adminApi.resolveDispute(...)
- Calls
- Defines
API_BASE_URLfrom environment variables - Includes route constants such as
ROUTES.EXPLORE,ROUTES.DASHBOARD, and admin paths - Contains application data like gig categories, skills pool, experience levels, delivery times, and demo credentials
Ensure you have Node.js (v18+ recommended) and npm installed.
- Renders
DashboardSidebar - Provides role-aware dashboard layout for authenticated users
Create a .env.local file in the root directory and add the following:
- Wraps all pages with
Providers - Includes global
NavbarandFooter - Sets metadata from
APP_NAMEandAPP_DESCRIPTION
- Wraps the app with
SessionProvider,QueryClientProvider, andNextThemesProvider - Configures React Query default options and theme behavior
Create a .env.local file with:
# The main backend endpoint. All API helpers depend on it.
NEXT_PUBLIC_API_URL=http://localhost:5000/api/v1
# NextAuth & Google OAuth Credentials
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
NEXTAUTH_SECRET=your-nextauth-secret
NEXT_PUBLIC_API_URLis the main backend endpoint. All API helpers depend on it.
npm install
npm run devBuild production:
npm run build
npm startLint:
npm run lint- Freelancer:
user@nexusai.com/Demo@1234 - Client:
client@nexusai.com/Demo@1234 - Admin:
admin@nexusai.com/Demo@1234
- This frontend is tightly coupled with a backend API that supports auth, gigs, users, AI, reviews, blog, and admin features.
next-authmanages session state while Axios handles authenticated HTTP requests.- The layout supports both public marketing and protected dashboard routes.
- The app includes dark mode, responsive design, and reusable UI components.
- Add complete gig creation/edit workflows in the dashboard
- Improve loading / error states across all pages
- Add AI conversation persistence and history
- Enhance analytics with real backend metrics
- Add stronger type-safe API wrappers for all endpoints