The Jobify platform implements a range of features to facilitate the interaction between clients and freelancers. The backend exposes a set of RESTful API endpoints that the React frontend consumes to perform CRUD (Create, Read, Update, Delete) operations and handle business logic.
User Authentication and Authorization
This feature provides secure access to the platform, ensuring that users can only access data and functionality relevant to their role. This feature provides secure access to the platform, ensuring that users can only access data and functionality relevant to their role.
Registration: New users can create an account as either a 'Client' or a 'Freelancer'.
o API Endpoint: POST /api/auth/register
o Usage: The frontend sends a POST request with the user's details (name, email, password, role). The backend validates the data, hashes the password, and creates a new user record in the database.
Login: Registered users can sign in to their accounts.
o API Endpoint: POST /api/auth/login
o Usage: The user's credentials are sent to this endpoint. The server validates them, and if successful, generates and returns a JSON Web Token (JWT).
Authorization: The generated JWT is stored on the client side and sent in the Authorization header of subsequent requests. A custom middleware on the backend verifies this token to authenticate and authorize the user for accessing protected resources.
Job Management (Client Role)
Clients have full control over the jobs they post on the platform.
Create Job: Clients can post new job opportunities with details like title, description, budget, and required skills.
o API Endpoint: POST /api/jobs
o Usage: A POST request containing the job details is sent from the client's 'Post a Job' form. The server saves this information as a new document in the jobs collection.
View My Jobs: Clients can view a dashboard listing all the jobs they have posted.
o API Endpoint: GET /api/jobs/my-jobs
o Usage: A GET request, authenticated with the client's JWT, fetches all jobs associated with their user ID.
Update & Delete Jobs: Clients can edit the details of their job postings or remove them.
o API Endpoints: PUT /api/jobs/:id, DELETE /api/jobs/:id
o Usage: The frontend uses the job's unique ID in the URL to send PUT (for updates) or DELETE requests to the respective endpoints.
Job Discovery and Bidding (Freelancer Role)
Freelancers can browse available projects and submit their proposals.
Browse Jobs: Freelancers can see a list of all currently open job postings.
o API Endpoint: GET /api/jobs
o Usage: This endpoint returns a list of all jobs with an 'open' status, which the frontend then renders for the freelancer. Filtering and search functionality can be built on top of this endpoint using query parameters (e.g., GET /api/jobs?skill=React).
Submit a Bid/Proposal: Freelancers can place a bid on a specific job.
o API Endpoint: POST /api/bids
o Usage: When a freelancer submits a proposal, a POST request is sent with the proposal text, bid amount, and the associated Job ID and Freelancer ID.
Proposal and Project Management
This feature allows clients to manage incoming proposals and the project lifecycle.
View Bids: Clients can see all the proposals submitted for one of their job postings.
o API Endpoint: GET /api/jobs/:jobId/bids
o Usage: By providing the jobId in the URL, the client can fetch all associated bids from the database.
Accept a Bid: Clients can accept a freelancer's proposal, which typically changes the job's status to 'in-progress'.
o API Endpoint: PUT /api/bids/:bidId/accept
o Usage: A PUT request to this endpoint triggers the business logic to accept the bid, notify the freelancer, and potentially reject other bids for the same project.
User Profile Management
Both clients and freelancers can manage their public profiles.
View and Update Profile: Users can update their personal information, skills, and portfolio.
o API Endpoints: GET /api/users/profile, PUT /api/users/profile
o Usage: A GET request retrieves the current user's profile data for display. A PUT request with the updated information is sent to persist the changes in the database.