How zabedfolio/taskly-client works
1. What this repo is
- This is the frontend client for Taskly, built with Next.js App Router + React.
- The actual business backend is a separate server/API (shown in the README), so this repo is mostly the presentation layer, route structure, auth client, and API orchestration.
2. Core application boundary
- The main boundary is between:
- browser-rendered Next.js pages/components
- API calls to the external backend
- a small set of Next.js API routes that proxy or handle platform-specific integrations.
- Most data is fetched through helpers in src/lib/api/**, not directly inside page components.
3. Route structure and persona-based UX
- The app is organized around distinct route families:
- public pages like /, /browse, /freelancers
- auth pages under /auth/login and /auth/signup
- role-specific dashboards under /dashboard/client, /dashboard/freelancer, and /dashboard/admin
- support/error routes like /payment-success, /success, /unauthorized, and not-found
- This route tree is the main architectural signal: each persona gets its own navigation, layout, and workflows.
4. Dashboard layouts as the main UI boundary
- src/app/dashboard/layout.jsx wraps dashboard-wide behavior.
- Each role has its own layout:
- client/layout.jsx
- freelancer/layout.jsx
- admin/layout.jsx
- These layouts likely control shared shell behavior such as sidebar navigation, role gating, and page chrome, while individual pages implement task/proposal/settings views.
5. Public discovery layer
- The home and marketplace discovery surfaces are component-driven:
- src/components/home/* powers the landing page with featured tasks, stats, top freelancers, testimonials, and hero sections.
- /freelancers and /browse are the main discovery pages for talent and tasks.
- Shared modal components in src/components/shared support deep inspection of freelancers, tasks, and ratings without leaving the listing page.
6. Role workflows and data flow
- Clients: post tasks, review proposals, accept bids, and complete payment.
- Freelancers: browse tasks, submit proposals, track active work, and view earnings.
- Admins: verify freelancers, block/unblock users, and audit transactions.
- These workflows are reflected in the API helper split under src/lib/api/client, freelancer, home, and admin, which keeps each persona’s data access isolated.
7. Authentication and access control
- Auth is handled through Better Auth integration in src/lib/auth.js and src/lib/auth-client.js.
- The auth route handler lives at src/app/api/auth/[...all]/route.js, so auth is implemented as a Next.js API endpoint rather than only client-side state.
- src/app/unauthorized and src/proxy.js indicate route protection/redirect logic for blocked or unauthorized sessions, with access constrained by role and account status.
8. Payment and checkout flow
- Payment is a distinct subsystem:
- /payment/checkout
- /payment-success
- /dashboard/client/payment-success
- API route src/app/api/checkout_sessions/route.js
- The frontend delegates payment session creation to the backend/Stripe integration, then uses success routes to finalize the client-side UX after payment confirmation.
9. File upload / image service boundary
- src/app/api/imagebb/route.js shows a dedicated integration for image uploads through ImageBB.
- This keeps external upload credentials and request shaping out of the main UI components and gives the app a controlled upload boundary.
10. State management
- The app uses React Contexts instead of a heavy global store:
- BookmarkContext
- NotificationContext
- ThemeContext
- That suggests the shared client state is limited to UI-centric concerns, while server state is fetched through the API helper layer.
11. Shared UI primitives
- Common components in src/components/common and src/components/shared act as the reusable presentation layer:
- navbar/footer/shell/notification bell
- rating and verification badges
- task/freelancer detail modals
- These components are reused across public pages and dashboards, which reduces duplication while keeping the route pages thin.
12. Technology and runtime shape
- This repo is a Next.js frontend with the App Router, using:
- React for component composition
- Next.js route handlers for API-adjacent endpoints
- CSS pipeline files (globals.css, postcss.config.mjs) for styling
- ESLint and JS config for code quality and aliasing
- The backend storage/auth/payment concerns are externalized, so the client architecture is primarily a routed UI plus API orchestration layer.
13. How to draw the architecture diagram
- A good diagram would show:
- user personas entering through public pages
- role-based dashboard branches for client/freelancer/admin
- shared UI components feeding those pages
- lib/api helpers connecting the UI to the external backend
- Next API routes for auth, checkout, and ImageBB
- context providers wrapping the React tree for bookmarks, notifications, and theme
- external dependencies: Better Auth, Stripe, ImageBB, and the separate server API
Main entry points: getAllTasks.js API helpers · TaskDetailModal.jsx Detail modals · DashboardSidebar.jsx Sidebar · BookmarkContext.jsx Contexts
Components 27
App routes
Next.js App Router pages, layouts, and route handlers.
- App shell · Root layout and global app entry for providers and shell composition.
src/app/layout.js - Home · Public landing page for discovery and onboarding.
src/app/page.js - Browse · Public task discovery page.
src/app/browse/page.jsx - Freelancers · Public freelancer discovery page.
src/app/freelancers/page.jsx - Auth pages · Login and signup entry points.
src/app/auth/login/page.jsx - Dashboard shell · Shared dashboard boundary for role-specific areas.
src/app/dashboard/layout.jsx - Client area · Client dashboard shell and task/proposal/payment workflows.
src/app/dashboard/client/layout.jsx - Freelancer area · Freelancer dashboard shell and work tracking workflows.
src/app/dashboard/freelancer/layout.jsx - Admin area · Admin dashboard shell and moderation/ops workflows.
src/app/dashboard/admin/layout.jsx - Payment routes · Checkout and success pages for payment completion.
src/app/payment/checkout/page.jsx - Status pages · Success, unauthorized, and not-found handling.
src/app/unauthorized/page.jsx
UI layer
Reusable presentation components used across public pages and dashboards.
- Navbar · Top-level navigation used on public surfaces.
src/components/common/Navbar.jsx - Sidebar · Role-aware dashboard navigation shell.
src/components/dashboard/DashboardSidebar.jsx - Home modules · Hero, featured tasks, stats, testimonials, and top freelancers.
src/components/home/HeroBanner.jsx - Detail modals · Task, freelancer, and rating modal surfaces.
src/components/shared/TaskDetailModal.jsx - Badges · Rating and verification presentation primitives.
src/components/shared/VerifiedBadge.jsx
Client state
React context providers for shared UI state.
- Contexts · Bookmark, notification, and theme providers.
src/contexts/BookmarkContext.jsx
API layer
Client-side API helpers and Next.js route handlers.
- Auth handler · Better Auth endpoint mounted as a Next.js API route.
src/app/api/auth/[...all]/route.js - Checkout API · Creates payment sessions for checkout flow.
src/app/api/checkout_sessions/route.js - Image upload · ImageBB integration boundary for uploads.
src/app/api/imagebb/route.js - API helpers · Persona-scoped helpers for home, client, freelancer, and admin data.
src/lib/api/home/getAllTasks.js - Auth client · Better Auth client/server integration helpers.
src/lib/auth-client.js - Stripe lib · Stripe configuration and payment helper layer.
src/lib/stripe.js
External services
Backend and third-party systems used by the client.
- Backend API · Separate Taskly backend that serves business data and actions.
- Better Auth · Authentication provider used by the client.
- Stripe · Payment provider for checkout and confirmation.
- ImageBB · Third-party image upload service.
Connections 26
- App shell → Contexts: wraps · Root app composition includes shared client state providers.
- App shell → Navbar: renders · Root-level shell and navigation appear across public surfaces.
- Home → Home modules: composes · Landing page is assembled from modular home sections.
- Browse → Detail modals: uses · Discovery page opens task details in modals.
- Freelancers → Detail modals: uses · Talent discovery page opens freelancer details and ratings.
- Auth pages → Auth client: authenticates · Login and signup rely on the auth client integration.
- Dashboard shell → Sidebar: provides · Shared dashboard shell supplies role navigation.
- Client area → Sidebar: uses · Client area uses the shared dashboard navigation.
- Freelancer area → Sidebar: uses · Freelancer area uses the shared dashboard navigation.
- Admin area → Sidebar: uses · Admin area uses the shared dashboard navigation.
- Client area → API helpers: fetches · Client workflows pull tasks, proposals, and payment data.
- Freelancer area → API helpers: fetches · Freelancer workflows pull tasks, proposals, and stats.
- Admin area → API helpers: fetches · Admin workflows pull moderation and transaction data.
- Payment routes → Checkout API: starts · Checkout UI calls the server route to create payment sessions.
- Payment routes → Stripe lib: uses · Payment pages depend on Stripe client logic.
- Status pages → Auth client: gates · Unauthorized and status handling are tied to auth/session state.
- Auth handler → Better Auth: integrates · Auth endpoint is backed by Better Auth.
- Checkout API → Stripe: integrates · Checkout endpoint creates sessions with Stripe.
- Image upload → ImageBB: integrates · Upload endpoint forwards images to ImageBB.
- API helpers → Backend API: calls · Most app data is fetched from the external Taskly backend.
- Auth client → Better Auth: calls · Client auth helpers communicate with Better Auth.
- Stripe lib → Stripe: calls · Payment helper layer is built around Stripe.
- Contexts → Home: supports · Shared UI state feeds public browsing and saved-item behavior.
- Contexts → Dashboard shell: supports · Contexts are available throughout authenticated dashboard flows.
- Detail modals → API helpers: reads · Detail modals are populated from API-backed entity data.
- Badges → Detail modals: decorates · Rating and verification badges are reused in detail views.