Sharray

Classifieds Marketplace API

Active

A modern classifieds marketplace platform built with Hono, TypeScript, and Cloudflare D1. Similar to OpenSooq and Sahibinden, enabling users to post and browse listings across various categories.

API Endpoints

Authentication

POST /api/auth/register Register new user
POST /api/auth/login Login user
GET /api/auth/me Get current user (protected)

Listings

GET /api/listings Get all listings (with filtering)
GET /api/listings/:id Get single listing with details
POST /api/listings Create listing (protected)
GET /api/my-listings Get user's listings (protected)

Features

JWT Authentication

Secure token-based auth

Cloudflare D1

Globally distributed SQLite

Category-Specific Details

Property & car details

Advanced Filtering

Filter by category, city, price

Quick Start

// Register a new user
curl -X POST http://localhost:3000/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{"phone":"+1234567890","password":"secret123","name":"John Doe"}'

// Login
curl -X POST http://localhost:3000/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"phone":"+1234567890","password":"secret123"}'

// Get listings
curl http://localhost:3000/api/listings?category=car&city=Dubai

// Create listing (with token)
curl -X POST http://localhost:3000/api/listings \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"category":"car","title":"Toyota Camry 2020","price":25000,"city":"Dubai"}'