Skip to main content

API Overview

Base URL: https://ayts-api.jerquinbayudo.workers.dev
Framework: Hono.js on Cloudflare Workers
Auth: JWT (Bearer token)

Health Check

GET /health

Response:

{
"status": "ok",
"timestamp": "2026-05-06T12:00:00.000Z",
"environment": "production",
"version": "1.0.0"
}

Route Groups

PrefixModuleDescription
/api/authroutes/auth.tsRegister, login, password reset, refresh
/api/usersroutes/users-simple.tsUser profile management
/api/vendorsroutes/vendors.tsVendor operations + onboarding
/api/storesroutes/stores.tsStore listing + discovery
/api/productsroutes/products.tsProduct management
/api/ordersroutes/orders-simple.tsOrder creation + tracking
/api/paymentsroutes/payments.tsPayMongo integration
/api/reviewsroutes/reviews.tsProduct/store reviews
/api/notificationsroutes/notifications.tsPush subscriptions
/api/searchroutes/search.tsFull-text search
/api/webhooksroutes/webhooks.tsPayMongo webhooks
/api/adminroutes/admin.tsAdmin-only operations
/api/ridersroutes/riders.tsRider management
/api/publicroutes/public.tsUnauthenticated public data
/api/uploadroutes/upload.tsFile upload to R2
/api/catalogroutes/catalog.tsProduct catalog browsing

Authentication

Most endpoints require a JWT token in the Authorization header:

Authorization: Bearer {token}

The token is returned from POST /api/auth/login or POST /api/auth/register.

Role Hierarchy

RoleAccess
customerBrowse, cart, orders, reviews
vendor+ Manage own store and products
rider+ Accept/update delivery orders
adminFull access to all endpoints

Error Responses

All errors follow this shape:

{
"success": false,
"error": "Error message",
"code": "ERROR_CODE"
}

Rate Limiting

Endpoint GroupLimit
Auth (login/register)10 req / 15 min per IP
Forgot password3 req / hour per IP
All other endpointsNo strict limit (Workers limits apply)

CORS

Allowed origins (production):

  • https://ayts.jerquinbayudo.workers.dev
  • https://ayts-admin.jerquinbayudo.workers.dev
  • https://ayts-fe.pages.dev

Localhost origins only in ENVIRONMENT=development.

Middleware Stack

All requests go through:

  1. structuredLogger — structured JSON logging
  2. prettyJSON — pretty-print JSON in development
  3. CORS handler
  4. securityHeaders — CSP, X-Frame-Options, HSTS
  5. Route handler
  6. errorHandler — global error catch