Divar Clone is a modern classifieds marketplace inspired by Divar. It provides a complete flow for discovering advertisements, publishing and managing listings, communicating with other users, and administering marketplace content.
The project is organized as a monorepo:
- Frontend: Next.js App Router, React, TypeScript, Tailwind CSS
- Backend: Laravel REST API, Sanctum authentication, Eloquent ORM
- Realtime: Laravel Reverb, Laravel Echo, and private channels
- Browse advertisements by category, location, and state
- Advertisement details, image galleries, favorites, notes, and browsing history
- User registration and authentication with OTP verification
- User dashboard for creating, editing, and managing advertisements
- Admin dashboard for users, advertisements, categories, attributes, pages, menus, states, and settings
- Secure private conversations between advertisement participants
- Realtime message delivery and read receipts over WebSockets
- Payment flow with a success callback page
- Soft deletes, trash management, bulk actions, and image processing
| Layer | Technologies |
|---|---|
| Frontend | Next.js 16, React 19, TypeScript, Tailwind CSS |
| Backend | PHP 8.3+, Laravel 13, Sanctum |
| Realtime | Laravel Reverb, Laravel Echo, Pusher JS |
| Database | Any Laravel-supported database |
| Tooling | Composer, npm, Pest, Laravel Pint, ESLint |
Install the following before continuing:
- PHP 8.3 or newer
- Composer
- Node.js 20 or newer and npm
- A database supported by Laravel
git clone https://github.com/bitwizarder/divar-clone.git
cd divar-clonecd backend
composer install
php artisan key:generateCreate backend/.env with your local Laravel settings. Configure the database, application URL, Sanctum stateful domains, and CORS settings, then run:
php artisan migrate
php artisan storage:linkKeep
backend/.envlocal. It is ignored by Git and must never contain production credentials in a committed change.
Create frontend/.env.local:
NEXT_PUBLIC_API_BASE_URL=http://127.0.0.1:8000
NEXT_PUBLIC_REVERB_APP_KEY=my-app-key
NEXT_PUBLIC_REVERB_HOST=127.0.0.1
NEXT_PUBLIC_REVERB_PORT=8080
NEXT_PUBLIC_REVERB_SCHEME=httpThen install the frontend dependencies:
cd ../frontend
npm installOpen separate terminals and run:
Backend API
cd backend
php artisan serveFrontend
cd frontend
npm run devThe application will be available at http://localhost:3000.
The chat uses Laravel Reverb and private channels authenticated through Laravel Sanctum.
In backend/.env, configure the broadcaster and Reverb values:
BROADCAST_CONNECTION=reverb
REVERB_APP_ID=local-app
REVERB_APP_KEY=my-app-key
REVERB_APP_SECRET=my-app-secret
REVERB_HOST=127.0.0.1
REVERB_PORT=8080
REVERB_SCHEME=httpStart the Reverb server in a separate terminal:
cd backend
php artisan reverb:startThe chat events currently implement ShouldBroadcastNow, so they are broadcast immediately and do not require a queue worker.
If an event is changed from ShouldBroadcastNow to ShouldBroadcast, it becomes queued. In that case, start a queue worker as well:
cd backend
php artisan queue:workFor a local setup, keep the API server, frontend, Reverb server, and queue worker (when using ShouldBroadcast) running in separate terminals.
.
├── backend/ # Laravel API, authentication, broadcasts, and admin logic
├── frontend/ # Next.js application and user/admin interfaces
├── backend/routes/ # API, authentication, and broadcasting routes
└── frontend/app/ # App Router pages, layouts, and UI components
Run backend tests:
cd backend
php artisan testFormat PHP code:
./vendor/bin/pintRun frontend linting:
cd frontend
npm run lintEnvironment files, dependencies, generated builds, logs, storage keys, and IDE files are intentionally excluded from version control. The repository-level .gitignore includes the Laravel backend and Next.js frontend paths, while backend/.gitignore contains Laravel-specific defaults.
Never commit real credentials, API keys, Reverb secrets, or production .env files.
Contributions are welcome. Please create a focused branch, keep changes scoped, run the relevant checks, and open a pull request with a clear description.
This project is licensed under the MIT License.