HireHub is a RESTful API that connects clients and freelancers.
It supports project posting, offers, reviews, authentication, and role‑based access.
- Laravel 12
- PHP 8.2
- MySQL
- REST API (JSON only)
- Service‑based architecture
- Client
- Freelancer
- Admin
- Authentication (Register/Login)
- Freelancer verification system
- Projects (create, update, delete)
- Offers system with auto‑rejection logic
- Reviews & ratings
- Filtering & sorting
- Performance‑optimized queries
- Clean architecture (Services, Form Requests, Models)
POST /api/register
POST /api/login
POST /api/logout (auth:sanctum)
GET /api/user
GET /api/dashboard
GET /api/profile
PUT /api/profile
GET /api/freelancers
GET /api/notifications
GET /api/projects
GET /api/projects/{project}
POST /api/admin/verify/{profile}
POST /api/projects
PUT /api/projects/{project}
DELETE /api/projects/{project}
GET /api/projects/{project}/offers
POST /api/projects/{project}/offers/{offer}/accept
POST /api/projects/{project}/reviews
POST /api/projects/{project}/offers
GET /api/my-offers
DELETE /api/offers/{offer}
- Controllers → HTTP layer
- Services → Business logic
- Models → Relationships
- Form Requests → Validation
- SOLID + Clean Code principles
git clone
cd hirehub
composer install
cp .env.example .env
php artisan key:generate
php artisan migrate --seed
php artisan serve
improves the performance of the GET /api/projects endpoint by fixing N+1 queries and enabling caching.
All screenshots are stored in:
docs/screenshotes/
The main branch executed many SQL queries for related models
(attachments, offers, tags, cities, countries, users).
This caused slow performance.
Using eager loading:
->with(['user.city.country', 'tags', 'offers.user', 'attachments'])
reduced the number of queries significantly.
Caching was added using:
Cache::remember($cacheKey, 300, function () { ... });
Telescope → Redis shows:
GET laravel-cache-projects...
This confirms the response was served from cache, not the database.
| Request | Queries | Cache |
|---|---|---|
| main | 10–12 | No |
| task4 (1st) | 10–12 | Miss |
| task4 (2nd) | 0 | Hit |
Caching + eager loading improved performance and eliminated unnecessary database queries.
A Postman collection is included:
HireHub.postman_collection.json
- Open Postman
- Click Import
- Select the file
- Set the environment variable: {{base_url}} = http://localhost:8000/api {{client_token}} = {{freelancer_token}} = {{admin_token}}=
- N+1 queries fully fixed
- Caching reduced DB load by ~90%
- Redis + Telescope confirm cached responses
- Endpoint is now significantly faster and optimized
