How ayush-pandey1/karmsetu works
Purpose and Runtime
This is a Next.js App Router marketplace application connecting clients and freelancers. It combines public marketing/authentication, role-specific dashboards, project applications and delivery, chat, nearby-user discovery, and payments. The runtime is Node.js/Next.js with React, Tailwind/PostCSS, MongoDB-oriented model files, NextAuth, Redux client state, Cloudinary uploads, and payment integration.
Entry Points and Route Domains
The public site is rooted at src/app/(site)/page.jsx under the shared site shell in src/app/(site)/layout.jsx. Authentication and role selection begin under src/app/auth/signin/page.jsx, src/app/auth/signup/page.jsx, and src/app/auth/select/page.jsx. Onboarding branches by account type at src/app/onboarding/client/page.jsx and src/app/onboarding/freelancer/page.jsx.
Role-Specific Application Shells
Client and freelancer workspaces are isolated by route groups and each has a dedicated layout/navigation composition:
• Client: src/app/(client)/cl/layout.jsx, src/components/mainClient/side-nav.jsx
• Freelancer: src/app/(freelancer)/fl/layout.jsx, src/components/mainFreelancer/side-nav.jsx
These boundaries organize distinct lifecycle views while sharing underlying APIs and reusable UI. Client routes focus on job creation, applications, and hired projects; freelancer routes focus on available projects, portfolio, rewards, and notifications.
Marketplace and Project Lifecycle
Clients create and manage jobs through src/app/(client)/cl/createjob/page.jsx and job/project dashboards at src/app/(client)/cl/projectDashboard/[...jobId]/page.jsx. Freelancers browse and track work via src/app/(freelancer)/fl/projects/page.jsx and src/app/(freelancer)/fl/projectDashboard/[...jobId]/page.jsx. Server-side resource boundaries are implemented by project and application routes: src/app/api/project/route.js, src/app/api/application/route.js, and src/app/api/applicationAccepted/[id]/route.js. Domain persistence representations reside in src/app/(models)/project.js and src/app/(models)/application.js.
Identity, Profiles, and Authorization
NextAuth is exposed through src/app/api/auth/[...nextauth]/route.js, with provider/session configuration in src/app/api/auth/[...nextauth]/options.js. User records and role/profile retrieval are handled by src/app/(models)/User.js, src/app/api/user/[id]/route.js, and src/app/api/userInfoByEmail/route.js. Middleware in src/middleware.js is the likely cross-route access-control boundary. Separate personal-detail APIs preserve client/freelancer profile flows.
Messaging and Real-Time-Oriented State
Conversation and message persistence are separated from dashboard pages: src/app/api/chat/route.js, src/app/api/message/route.js, src/app/(models)/ChatModel.js, and src/app/(models)/MessageModel.js. Client views consume this through src/app/(client)/cl/chat/page.jsx and freelancer views through src/app/(freelancer)/fl/chat/page.jsx. Redux coordinates browser-side chat, socket, project, freelancer-project, and language state in src/app/(redux)/store/store.js and feature slices such as src/app/(redux)/features/socketSlice.js.
External Service Boundaries
MongoDB connectivity is centralized in src/config/db.js and src/lib/db.js. Media upload is abstracted behind src/app/api/imageUpload/route.js and src/lib/cloudinary.js. Payment creation is isolated at src/app/api/create-payment/route.js, with checkout support in src/checkout.js. Geographic discovery is exposed through role-specific nearby APIs, including src/app/api/nearby/client/[id]/route.js and src/app/api/nearby/freelancer/[id]/route.js; map presentation is provided by src/components/CmapComponent/index.jsx and src/components/FmapComponent/index.js.
Main entry points: cl/layout.jsx Client dashboard shell · page.jsx Client project dashboard · fl/layout.jsx Freelancer dashboard shell · route.js Projects
Components 21
Public & identity
- Marketing site shell
src/app/(site)/layout.jsx - Auth and role selection
src/app/auth/signin/page.jsx - Role onboarding · Client and freelancer onboarding branches.
src/app/onboarding/client/page.jsx - Route access control
src/middleware.js
Client workspace
- Client dashboard shell · Composes client navigation and lifecycle views.
src/app/(client)/cl/layout.jsx - Job creation
src/app/(client)/cl/createjob/page.jsx - Client project dashboard
src/app/(client)/cl/projectDashboard/[...jobId]/page.jsx
Freelancer workspace
- Freelancer dashboard shell · Composes freelancer navigation and lifecycle views.
src/app/(freelancer)/fl/layout.jsx - Project browsing
src/app/(freelancer)/fl/projects/page.jsx - Freelancer project dashboard
src/app/(freelancer)/fl/projectDashboard/[...jobId]/page.jsx
Platform services
- NextAuth handler
src/app/api/auth/[...nextauth]/route.js - Users and profiles
src/app/api/user/[id]/route.js - Projects · Job creation and project lifecycle resource.
src/app/api/project/[id]/route.js - Applications and hiring · Handles applications and acceptance.
src/app/api/application/[id]/route.js - Chats and messages
src/app/api/chat/route.js - Browser state · Coordinates chat, socket, project, and language state.
src/app/(redux)/store/store.js - Media uploads · Abstracts Cloudinary uploads.
src/app/api/imageUpload/route.js - Payment creation
src/app/api/create-payment/route.js - Nearby-user discovery · Role-specific geographic discovery.
src/app/api/nearby/client/[id]/route.js - MongoDB connection
src/config/db.js
Other components
- Role chat views · Shared messaging experience in both workspaces.
src/app/(client)/cl/chat/page.jsx
Connections 27
- Marketing site shell → Auth and role selection: sign in or sign up
- Auth and role selection → Role onboarding: select role
- Route access control → Client dashboard shell: guards
- Route access control → Freelancer dashboard shell: guards
- Auth and role selection → NextAuth handler: authenticates via
- NextAuth handler → Users and profiles: loads sessions and users
- Role onboarding → Users and profiles: creates profile
- Client dashboard shell → Job creation: hosts
- Client dashboard shell → Client project dashboard: hosts
- Freelancer dashboard shell → Project browsing: hosts
- Freelancer dashboard shell → Freelancer project dashboard: hosts
- Job creation → Projects: creates jobs
- Client project dashboard → Projects: manages
- Project browsing → Projects: browses
- Freelancer project dashboard → Applications and hiring: tracks application
- Project browsing → Applications and hiring: applies
- Client project dashboard → Applications and hiring: reviews and accepts
- Role chat views → Chats and messages: sends and reads
- Browser state → Chats and messages: coordinates chat state
- Client dashboard shell → Nearby-user discovery: discovers freelancers
- Freelancer dashboard shell → Nearby-user discovery: discovers clients
- Client project dashboard → Payment creation: creates payment
- Projects → MongoDB connection: persists in
- Applications and hiring → MongoDB connection: persists in
- Chats and messages → MongoDB connection: persists in
- Users and profiles → MongoDB connection: persists in
- Job creation → Media uploads: uploads media