Skip to content

API Reference

Backend API Endpoint Specifications (Cloudflare Workers + Hono)

All routes require a valid Clerk Bearer JWT Token passed in the HTTP Authorization header (Authorization: Bearer <clerk_token>). Cross-Origin Resource Sharing (CORS) is enabled globally.

Common Base URL

  • Custom BYOC (Bring Your Own Cloud): https://<your-worker-subdomain>.workers.dev/api

Endpoint Reference

MethodPathDescriptionRequest BodyResponse
GET/api/pagesFetch all active pages for current userNonePage[]
POST/api/pagesCreate new pagePartial<Page>Page
PUT/api/pages/:idUpdate existing page content/titlePartial<Page>Page
DELETE/api/pages/:idPermanently delete pageNone{ success: true }
GET/api/projectsFetch all user projectsNoneProject[]
POST/api/projectsCreate new projectPartial<Project>Project
PUT/api/projects/:idUpdate project metadataPartial<Project>Project
DELETE/api/projects/:idDelete projectNone{ success: true }
GET/api/issuesFetch all user Kanban issuesNoneIssue[]
POST/api/issuesCreate new Kanban taskPartial<Issue>Issue
PUT/api/issues/:idUpdate issue status/priority/titlePartial<Issue>Issue
DELETE/api/issues/:idDelete issueNone{ success: true }
GET/api/notificationsFetch user notificationsNoneNotificationItem[]

Data Synchronization & Differential Engine (smartSync)

Instead of performing expensive full-state replacements on every keystroke, DevWannaSpace uses a client-side differential engine (smartSync).

How smartSync Works:

  1. In-Memory Cache: The client maintains an active state cache (stateCache.pages, stateCache.projects, etc.).
  2. Delta Calculation:
    • added: Items in new array missing from old array → POST request.
    • removed: Items in old array missing from new array → DELETE request.
    • updated: Items whose updatedAt timestamp has changed → PUT request.
  3. Optimistic Parallel Execution: All necessary HTTP calls are dispatched in parallel via Promise.all.
  4. Status Bar Emission: Broadcasts 'saving' | 'saved' | 'error' events to subscribers (updating the UI sync indicator in the top navbar).

Error Resilience & Edge Case Handling

  1. Vite Unhandled Rejection Safeguard: Parallel Promise.all requests in AppShell.tsx have individual .catch(() => {}) handlers attached prior to Promise.all evaluation. This prevents secondary asynchronous network failures from triggering Vite's full-screen Red Error Overlay.
  2. Invalid Key Graceful Fallback: If invalid Clerk keys or incorrect API URLs are detected at runtime, the application catches the initialization failure and renders a friendly "Connection Failed" UI with direct access to the Self-Host settings panel.