Skip to content

About

Topics

Resources

Code of conduct

Contributing

Security policy

Accessibility

Stars

24 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

3,389 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

WorkSphere Logo

WorkSphere

The Intelligent Multi-Agent Workspace Discovery & Real-Time Booking Engine

ECSoC 2026 - Elite Coders Summer of Code ย ย ย ย ย ย ย ย  OSCI 2026 - Open Source Contribution India

๐ŸŒŸ Official Selected Project for ECSoC 2026 (Elite Coders Summer of Code) & OSCI 2026 (Open Source Contribution India) ๐ŸŒŸ

Next.js React TypeScript Tailwind CSS Prisma ORM PostgreSQL PartyKit PWA


License PRs Welcome Contributors ECSoC 2026 OSCI 2026 CI Status Live Demo

WorkSphere is an autonomous multi-agent ecosystem engineered for remote professionals, digital nomads, and distributed teams.
Discover top-tier cafes, coworking spaces, and quiet libraries dynamically ranked on WiFi speeds, power outlet density, real-time noise metrics, and live seating occupancy.

๐Ÿš€ Launch Live Demo โ€ข โœจ Features โ€ข ๐Ÿ—๏ธ Architecture โ€ข โšก Quickstart โ€ข ๐Ÿ‘ฅ Contributors (111) โ€ข ๐Ÿ› Report Issue


๐Ÿ‘‘ Project Leadership & Authorship

Role Leader GitHub Badges
๐Ÿš€ Founder & Lead Architect / CTO Satyam Pandey @SatyamPandey-07 GitHub Profile Pair Extraordinaire

Tip

Issue Claiming & Auto-Merge Workflow:

  • Post /claim on any open issue to auto-assign it to yourself (limit: up to 10 active issues, 6-day completion window).
  • Post /unclaim on an issue to unassign yourself if you need to release it for other contributors!
  • When opening a PR, link the issue (e.g. Closes #123). Our CI will automatically approve and squash-merge your PR with co-author credit!

๐Ÿš€ Contributors (111 Active Rockstars)

A massive thank you to all 111 brilliant contributors and bots building WorkSphere! ๐ŸŒŸ

SatyamPandey-07
SatyamPandey-07
๐Ÿ‘‘ Creator
Janvi-kapoor
Janvi-kapoor
jasonjose007
jasonjose007
Aditya8369
Aditya8369
Senthil455
Senthil455
dependabot[bot]
dependabot[bot]
Ayush-0918
Ayush-0918
SanjanaTech19
SanjanaTech19
ErebAsh
ErebAsh
zainabhina05-png
zainabhina05-png
Pratyush-Panda-2006
Pratyush-Panda-2006
Babin123456
Babin123456
sanskarcoder29
sanskarcoder29
Aakif-Kohari
Aakif-Kohari
prasiddhi-105
prasiddhi-105
afifasyed123
afifasyed123
sanjana2505006
sanjana2505006
harshit-kumar-dev
harshit-kumar-dev
Vachhani-Tapan
Vachhani-Tapan
Jivan-Patel
Jivan-Patel
leenacags
leenacags
Chirag1724
Chirag1724
Jidnyasa-P
Jidnyasa-P
Jashvanthan
Jashvanthan
diksha78dev
diksha78dev
MILAN-123865
MILAN-123865
rishab11250
rishab11250
Prathvikmehra
Prathvikmehra
gauri9368gupta-maker
gauri9368gupta-maker
sumittiwari1302
sumittiwari1302
Huzaifaahmedbhutto
Huzaifaahmedbhutto
Sahan20030814
Sahan20030814
shahkhushi0307
shahkhushi0307
Shruti070107
Shruti070107
hemnath-hub
hemnath-hub
Tanishkkkkk
Tanishkkkkk
vigneshwaran484
vigneshwaran484
onitshubham14
onitshubham14
Kushal-prime
Kushal-prime
Kanneboinashivakumar
Kanneboinashivakumar
Aryanbuha890
Aryanbuha890
Diwakar-odds
Diwakar-odds
revatikadam0607
revatikadam0607
Srineedhi
Srineedhi
marisa-mmm
marisa-mmm
anushkanikam05
anushkanikam05
Ruchira807
Ruchira807
khushimalani16
khushimalani16
Aakansha-saroj-05
Aakansha-saroj-05
anshika-guleria
anshika-guleria
varshu55
varshu55
harshith7002
harshith7002
shadab-6718
shadab-6718
csxark
csxark
chetna123-ch
chetna123-ch
nithinoffizial
nithinoffizial
khedkaravani-rgb
khedkaravani-rgb
pranav28042007-boop
pranav28042007-boop
hirthicksundar1980-debug
hirthicksundar1980-debug
SoumalyaSaha
SoumalyaSaha
Kadaliswarna
Kadaliswarna
yashvi-3106
yashvi-3106
Yuva-Deekshitha-N
Yuva-Deekshitha-N
Vishvapatel2047
Vishvapatel2047
rudreshborle
rudreshborle
Komal290106
Komal290106
badshahaditya57-sketch
badshahaditya57-sketch
Daksh7785
Daksh7785
HimanshuPathak2725
HimanshuPathak2725
prajapati-pankaj-31
prajapati-pankaj-31
panditshubham766-dotcom
panditshubham766-dotcom
SpiliosDimakopoulos
SpiliosDimakopoulos
itsaditi05
itsaditi05
Ananyapselvam
Ananyapselvam
SujalKamate
SujalKamate
RitikaSen27
RitikaSen27
PranavSudhakar68
PranavSudhakar68
Parshant-12
Parshant-12
punithkumar-060308
punithkumar-060308
Bheemeswari497
Bheemeswari497
AndrewJefrin
AndrewJefrin
piush365
piush365
RajD2910
RajD2910
s-reeshma
s-reeshma
sagar-18-07-2006
sagar-18-07-2006
Suprita736
Suprita736
Aditya90456
Aditya90456
VarunikaShreeS
VarunikaShreeS
VathsalyaB
VathsalyaB
jenniferramesh423-cmyk
jenniferramesh423-cmyk
karrisanthoshigayatri
karrisanthoshigayatri
nishthagupta09
nishthagupta09
saikarthikraaj
saikarthikraaj
teajas14
teajas14
Mattheusl
Mattheusl
Gautam-Bharadwaj
Gautam-Bharadwaj
keshav33450
keshav33450
Keerthi-10-05
Keerthi-10-05
Jaswanth1617
Jaswanth1617
jiahshifana08
jiahshifana08
Gunjan10-droid
Gunjan10-droid
Gabyee17
Gabyee17
Falguni-105
Falguni-105
Kruthica
Kruthica
Prathibha-ui
Prathibha-ui
codinggujarat
codinggujarat
swimming001
swimming001
ranjithr-cyber
ranjithr-cyber
gaurika-analyst
gaurika-analyst
gaurrov
gaurrov
shlok926
shlok926

๐Ÿ“‹ Table of Contents


โœจ Features

๐Ÿค– AI-Powered Search

  • Natural Language Queries: "Find a quiet cafe with good WiFi near me"
  • Smart Intent Understanding: Extracts work type, amenities, location preferences
  • Intelligent Scoring: Ranks venues based on work-friendliness criteria

๐ŸŽ™๏ธ Voice Input (Browser Support)

The chatbot supports voice-to-text via the Web Speech API:

Browser Voice Input
Chrome 33+ โœ… Supported
Edge 79+ โœ… Supported
Safari (desktop/mobile) โœ… Supported (webkit prefix)
Firefox Stable โš ๏ธ Not supported by default
Firefox Nightly โš ๏ธ Requires flag โ€” see below

Firefox users: The Web Speech API is disabled by default. To enable it:

  1. Navigate to about:config in Firefox.
  2. Search for media.webspeech.recognition.enable and set it to true.
  3. Reload the application.

When voice input is unavailable, a clear warning banner is displayed and the feature degrades gracefully โ€” the text input remains fully functional.

๐Ÿ—บ๏ธ Interactive Dark Theme Map

  • Dark Theme: Beautiful CartoDB Dark Matter tiles
  • Real-time Markers: Purple glowing venue markers with venue photos
  • Green Route Lines: Real road routing with OSRM (not straight lines)
  • User Location: Custom marker with Clerk user avatar
  • Auto-centering: Map adjusts to show search results
  • Dark Popups: Styled popups matching the theme

๐Ÿ“ก Real-time Venue Updates (NEW)

  • Server-Sent Events (SSE): Live venue data pushed from server to client
  • Live Ratings: See new reviews appear instantly without refreshing
  • Availability Updates: Crowd levels update in real-time
  • Stable Connections: Smart reconnect logic prevents connection spam

๐Ÿ“ธ Venue Photos (NEW)

  • Pexels Integration: High-quality venue photos via Pexels API
  • Server-side Proxy: API key never exposed to the browser
  • DB Caching: Each venue fetched once, then served from cache
  • Lazy Loading: Skeleton shimmer while photo loads, graceful fallback on error
  • Free tier: 20,000 requests/month, no billing required

๐Ÿข Venue Enrichment (100% FREE APIs)

  • OpenStreetMap Integration: Real venue data from OSM Overpass API
  • Amenities Display: WiFi, outdoor seating, accessibility from OSM
  • Opening Hours: Real business hours when available
  • No Credit Card Required: All APIs are completely free

๐Ÿ›ฃ๏ธ Real Road Routing

  • OSRM Integration: Actual road paths instead of straight lines
  • Turn-by-turn Geometry: Realistic routes on the map
  • Distance Calculation: Accurate road distance to venues
  • Multiple Profiles: Walking, driving, cycling routes

๐ŸŽฏ Multi-Agent Architecture

  • 5 Specialized AI Agents working together:
    • Orchestrator โ†’ Context โ†’ Data โ†’ Reasoning โ†’ Action
  • Transparent Reasoning: See each agent's thought process
  • Parallel Processing: Efficient query handling

โญ User Features

  • Favorites System: Save frequently visited spots
  • Crowdsourced Ratings: Rate venues on WiFi quality, outlets, noise levels, quietness
  • Rating Dialog: Beautiful modal with 5-star ratings for each amenity
  • Conversation History: Resume previous searches
  • Venue Suggestions: Submit new venues via modal form
  • Profile Dashboard: Complete analytics dashboard showing booking history
  • "NEURAL LEDGER": Futuristic booking history with confirmation IDs, dates, venue details
  • Download Receipts: PDF receipts for each booking with automatic download
  • View on Map: External link button to view booked venues on the interactive map
  • Booking Status: Visual status badges (Confirmed, Pending, Cancelled)

๐Ÿ” Authentication

  • Clerk Integration: Secure sign-in/sign-up
  • User Profiles: Personalized experience
  • Webhook Sync: Real-time user data updates

๐Ÿงพ PDF Receipt System

  • Serverless-Compatible: Uses pdf-lib (not PDFKit) for AWS Lambda compatibility
  • Instant Generation: PDF receipts generated on-demand for confirmed bookings
  • Professional Format: Includes venue details, booking info, confirmation ID, timestamps
  • Embedded Fonts: Helvetica and HelveticaBold loaded from pdf-lib (no filesystem dependencies)
  • Direct Download: One-click download with loading states and error handling
  • Fixed Build Issues: Resolved Buffer/Uint8Array compatibility and cuid ID string handling

๐Ÿ“ฑ Progressive Web App (PWA)

  • Installable: Add to home screen on mobile/desktop
  • Offline Support: IndexedDB storage for venues and favorites
  • Service Worker: Caches static assets for fast loading
  • Background Sync: Queue actions when offline

๐Ÿš€ Performance & Reliability

  • Rate Limiting: API protection with configurable limits
  • Data Caching: Multi-layer caching with TTL support
  • Error Boundaries: Graceful error handling prevents crashes
  • Loading Skeletons: Smooth loading states for better UX

See docs/NEXTJS_PERFORMANCE_PLAYBOOK.md for a full guide on rendering strategies, bundle optimization, image optimization, caching, and Core Web Vitals measurement.

๐Ÿ“Š Analytics & Monitoring

  • Event Tracking: Track searches, venue interactions, agent performance
  • Agent Metrics: Monitor AI pipeline execution times
  • Search Patterns: Understand user behavior and preferences

๐Ÿงช Comprehensive Testing

  • 838+ Test Suites: Full coverage with Jest & React Testing Library
  • E2E Testing: Playwright configuration for end-to-end user journey tests
  • API Tests: Route handler testing with in-memory request simulation
  • Component Tests: UI component validation and accessibility audits

๐Ÿ’ธ Web3, Solana Pay & Smart Escrow

  • Solana Pay Engine: High-contrast QR payment modal with dynamic payment request generation, Screen Wake Lock API integration to prevent display dimming during scan, and verifiable on-chain confirmation (protected against synthetic confirmation spoofing).
  • Focus Session Bounties & Escrow: Stake crypto tokens to commit to deep work sessions; automated smart-contract payout release upon verified session completion (/api/bounties/payout, /api/bookings/escrow).
  • Virtual Single-Use Cards & Automated Invoicing: Issue ephemeral corporate cards for workspace booking expenses with automatic OCR receipt reconciliation (/api/finance/card).
  • Nomad Tax Residency Geo-Fence & ZK Ledger: Automated tracking of border crossings and physical presence duration with zero-knowledge cryptographic proof generation (/analytics/nomad-tax).
  • JSON & CSV Tax Export: Download complete tax records, workspace rental deductions, and business expense summaries formatted for international digital nomad audits (/api/bookings/export).

๐ŸŽง Edge Audio Processing & Acoustic Privacy (WASM DSP)

  • Dynamic Acoustic Privacy Jammer: WebAssembly DSP ring buffer applying Delayed Auditory Feedback (DAF) to headphones, scientifically disrupting loud speech and maintaining private conversations in open cafes (/api/audio/jammer).
  • AI Generative Venue Vibe Audio Synthesizer: Procedural acoustic soundscapes and focus-frequency noise generation tailored in real-time to current venue ambient noise telemetry (/api/audio/vibe).
  • Spatial RT60 Reverberation Analyzer: In-browser acoustic impulse measurement calculating venue echo decay time (RT60) to grade conference call suitability (/api/venues/acoustics/rt60).
  • Keyboard Acoustic Emanation Shield: Client-side acoustic masking preventing microphone-based keystroke eavesdropping in public coworking lounges (/api/security/acoustic).

๐Ÿ‘“ Spatial Computing, WebXR & Ergonomics

  • WebXR SLAM Venue Scanner & Voxel Octree: Camera-based spatial mapping for desk geometry, power outlet coordinates, and indoor navigation paths (/ar/finder).
  • Real-Time 3D Desk Ergonomics & ISO Validator: WebGL 3D avatar posture analysis evaluating chair height, screen angle, and ambient lighting against ISO 9241 standards (/wellness/ergonomics).
  • Automated Audio-Description Spatial Scene Graph: Real-time accessibility engine converting venue visual layout into navigable spatial audio narration for visually impaired professionals (/api/accessibility/scene).
  • Team Proximity Haptic Feedback & Spatial Anchoring: Physical team proximity alerts using Gamepad/Web Haptics API and spatial beacon tags (/api/ar/anchors).

๐Ÿข Digital Twin & Building IoT Orchestration

  • Workspace Digital Twin HVAC & Air Quality Purge: Live CO2, TVOC, and PM2.5 monitoring triggering automated ventilation requests and threshold breach alerts (/api/twin/airquality).
  • Cafe Power Grid Load Forecasting & Breaker Trip Predictor: Wattage monitoring preventing sudden cafe circuit breaker trips (/venues/power-grid).
  • Multi-Sensory Focus Environment IoT Controller: Smart lighting (circadian CCT), desk height, and acoustic masking control via Matter / HomeKit / Zigbee bridges (/api/iot/orchestrate).
  • ASHRAE Standard 55 Thermal Comfort Index: Predicted Mean Vote (PMV) and Predicted Percentage Dissatisfied (PPD) computed live from ambient temperature and relative humidity sensors.

๐ŸŒ Decentralized Networking & Survival Mesh

  • Distributed Compute-Burst WebRTC Mesh: Collaborative local distributed computing offloading code builds and heavy processing across idle laptops on cafe WiFi (/p2p/mesh-collab, /api/compute/burst).
  • Offline-First P2P Emergency Mesh Network: WebRTC DataChannels + Bluetooth Low Energy (BLE) peer discovery maintaining critical comms during cafe ISP outages (/api/network/survival).
  • Offline Medical Emergency Mesh Beacon & First-Aid Router: Instant SOS broadcasting and automated navigation to the nearest automated external defibrillator (AED) and medical kit (/api/medical/beacon).
  • Bandwidth-Hog Identification & Cooperative QoS: Local network cooperative monitoring to detect and throttle background stream hogs on public WiFi (/api/network/qos).

โœˆ๏ธ Nomad Travel, Smart Housing & Collab War Rooms

  • Flight-Delay Itinerary Auto-Rerouting: Webhook integration with aviation feeds automatically rescheduling booked coworking passes when flights are delayed or cancelled (/api/travel/reroute).
  • Git Merge Conflict Physical War Room & IoT Lockdown: Automatic physical meeting room booking and IoT access lockdown during critical deployment conflicts (/api/collab/warroom).
  • Decentralized Nomad Housing Swap & Smart-Contract Lease Ledger: Peer-to-peer apartment and studio exchange protocol backed by decentralized identity and reputation scores (/api/housing/swap).
  • Distributed Luggage Storage P2P Trust & IoT Locker Protocol: Secure short-term storage locker management with cryptographic token keys and BLE unlock (/peripherals/locker, /api/luggage/store).
  • Micro-Climate Pedestrian Routing & Wind-Tunnel Risk Engine: OSRM routing enriched with real-time micrometeorology, sheltering laptops from rain squalls and wind tunnels (/api/routing/microclimate).
  • Predictive Cafe Inventory Restocking Engine: Real-time oat milk, specialty bean, and pastry stock forecasting based on check-in velocity (/venues/cafe-order, /api/inventory/restock).

๐Ÿ›ก๏ธ Zero-Knowledge Proofs, Security & Compliance

  • Decentralized DID Wallet & ZK-Age / Identity Verification: Verify KYC and identity requirements without disclosing personal identity documents (/test-student-zkp, /api/identity/verify).
  • Client-Side PII Redaction & Document Sanitization Pipeline: In-browser regex and NER model scrubbing sensitive credentials, emails, and phone numbers before cloud transmission (/api/documents/sanitize).
  • AI-Powered Legal & NDA Redline Assistant: In-browser automated contract analysis, clause risk scoring, and interactive redlining before booking commercial spaces (/api/legal/redline).
  • Cryptographic Proof-of-Deep-Work Ledger with ZK-SNARKs: Verifiable proof of undistracted deep-work time for client billing without surveillance (/api/zkp/deepwork).
  • ECDH P-256 + AES-GCM 256 End-to-End Encrypted (E2EE) Chat & SPKI Key Pinning: Zero-knowledge team communication with SPKI SHA-256 Certificate Public Key Pinning (/api/auth/passkey/*).
  • Audit Log SHA-256 Merkle Tree Verification: Tamper-evident immutable audit log endpoint (/api/admin/audit/verify).

๐ŸŒŸ Core Platform Capabilities

WorkSphere brings together geospatial data, ambient intelligence, and real-time collaboration into a unified, responsive interface:

Capability Experience Technical Highlight
๐Ÿ—บ๏ธ Interactive Geospatial Map Dynamic CartoDB Dark Matter tiles with color-coded venue noise markers (green=quiet, amber=moderate, red=busy). Real road routing with OSRM, Haversine proximity, custom Clerk user pins.
๐Ÿค– Autonomous Multi-Agent AI Conversational discovery agent that reasons across amenities, seating availability, and workspace preferences. 5-agent pipeline (Orchestrator โ†’ Context โ†’ Data โ†’ Reasoning โ†’ Action) with transparent thought telemetry.
๐Ÿ“ก Live Presence & Telemetry Real-time seat occupancy badges (Quiet, Moderate, Busy) and collaborative workspace notes. Sub-50ms WebSocket synchronization powered by PartyKit mesh network.
๐Ÿ’ณ Solana Pay & Smart Escrow One-click crypto micro-payments, QR scan with Wake Lock, and deep-work bounty escrow payouts. Real-time Solana RPC verification, anti-spoofing transaction filters, smart contract escrow.
๐ŸŽง WASM DSP Acoustic Privacy Speech jamming with Delayed Auditory Feedback (DAF) preventing loud calls in public cafes. WebAudio AudioWorklet + WebAssembly C ring buffer for ultra-low latency audio processing.
๐Ÿ‘“ WebXR SLAM Spatial Scanner Augmented Reality indoor desk finder, power outlet locator, and millimeter-level wayfinding. WebXR Device API, point cloud voxelization, and SLAM visual-inertial odometry.
๐Ÿข Digital Twin HVAC & Air Purge Automated indoor environmental air quality purge alerts and smart ventilation orchestration. Real-time CO2/PM2.5 IoT telemetry with threshold anomaly detection and BACnet/MQTT bridge.
๐ŸŒ Distributed WebRTC Compute Mesh Offload heavy compile and test workloads onto idle peer machines connected to the same cafe WiFi. WebRTC DataChannels, P2P work stealing algorithm, and distributed task chunking.
๐Ÿ”‹ Battery Panic Mode Automatically re-ranks search results when battery drops below 20%, prioritizing verified desk outlets. Web Battery API integration with graceful degradation on non-supported viewports.
๐Ÿ“ด Offline-First Survival PWA Browse cached venues, floor plans, and queue check-ins completely offline via mesh networking. Service Worker background sync + IndexedDB storage + Web Locks API synchronization.
๐Ÿงพ Cryptographic PDF Invoicing Instant one-click PDF receipts with HMAC-SHA256 signatures generated for verified bookings. 100% serverless, zero-filesystem execution via pdf-lib with embedded Helvetica glyphs.
๐ŸŽ“ Zero-Knowledge Identity & Perks Claim verified student discounts and KYC clearance without revealing personal identification documents. Client-side WASM ZKP proof generation with offline localStorage verification caching.
โœˆ๏ธ Flight Reroute & IoT War Room Auto-reschedule bookings upon flight delays and lock down physical war rooms on merge conflicts. Aviation webhook feeds, automated calendar rebalancing, and IoT smart-lock triggers.
๐Ÿ›ก๏ธ Edge PII Redaction & E2EE Client-side redaction of sensitive credentials and documents before leaving the local browser. Zero-knowledge ECDH P-256 + AES-GCM 256 encryption with SPKI SHA-256 public key pinning.

๐Ÿ› ๏ธ Tech Stack

Category Technology
Framework Next.js 15.5 (App Router with Server Components & Server Actions)
Language TypeScript 5.0
Styling Tailwind CSS 4.0, Radix UI Primitives, Lucide Icons
AI / Multi-Agent Groq SDK (Llama 3.3 70B Versatile), In-Browser Intent Orchestrator
Database Neon Serverless PostgreSQL + Prisma 7.2 ORM (with @prisma/adapter-pg)
Authentication Clerk (JWTs, Webhook Sync, Passkeys & WebAuthn)
Web3 & FinTech Solana Web3.js, Solana Pay Protocol, Smart Contract Escrows
Edge Audio / DSP WebAssembly (WASM C DSP), AudioWorklet API, Web Audio Oscillators
Spatial & AR WebXR Device API, Three.js / WebGL, Voxel Octrees
Maps & Routing React Leaflet, OpenStreetMap, OSRM Road Machine, CartoDB Dark Matter
Real-time & P2P PartyKit WebSockets, Server-Sent Events (SSE), WebRTC DataChannels
Digital Twin / IoT Matter / HomeKit Bridge, MQTT Telemetry, Web Bluetooth Low Energy (BLE)
Cryptography / ZKP Web Crypto API (SubtleCrypto HMAC-SHA256), WASM ZK-SNARKs (SnarkJS)
PDF Generation pdf-lib 2.x (Zero-filesystem serverless execution)
Testing Jest 29, React Testing Library, Playwright E2E (838+ test suites)
PWA & Offline Service Workers, IndexedDB, Background Sync API, Web Locks API
Deployment Vercel (Edge & Serverless Functions)

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                         USER INTERFACE                          โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚      Map (70%)          โ”‚  โ”‚     Chat (30%)              โ”‚  โ”‚
โ”‚  โ”‚  - Venue Markers        โ”‚  โ”‚  - Natural Language Input   โ”‚  โ”‚
โ”‚  โ”‚  - User Location        โ”‚  โ”‚  - Agent Transparency       โ”‚  โ”‚
โ”‚  โ”‚  - Route Polylines      โ”‚  โ”‚  - Venue Cards              โ”‚  โ”‚
โ”‚  โ”‚  - Auto-centering       โ”‚  โ”‚  - Action Buttons           โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                 โ”‚
                                 โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                      MULTI-AGENT PIPELINE                        โ”‚
โ”‚                                                                  โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”‚
โ”‚  โ”‚ Orchestrator โ”‚ -> โ”‚   Context    โ”‚ -> โ”‚     Data     โ”‚      โ”‚
โ”‚  โ”‚    Agent     โ”‚    โ”‚    Agent     โ”‚    โ”‚    Agent     โ”‚      โ”‚
โ”‚  โ”‚              โ”‚    โ”‚              โ”‚    โ”‚              โ”‚      โ”‚
โ”‚  โ”‚ Routes query โ”‚    โ”‚ Extracts     โ”‚    โ”‚ Fetches      โ”‚      โ”‚
โ”‚  โ”‚ to agents    โ”‚    โ”‚ intent &     โ”‚    โ”‚ venues via   โ”‚      โ”‚
โ”‚  โ”‚              โ”‚    โ”‚ parameters   โ”‚    โ”‚ Overpass API โ”‚      โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜      โ”‚
โ”‚                                                  โ”‚               โ”‚
โ”‚                                                  โ–ผ               โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                          โ”‚
โ”‚  โ”‚    Action    โ”‚ <- โ”‚  Reasoning   โ”‚                          โ”‚
โ”‚  โ”‚    Agent     โ”‚    โ”‚    Agent     โ”‚                          โ”‚
โ”‚  โ”‚              โ”‚    โ”‚              โ”‚                          โ”‚
โ”‚  โ”‚ Updates UI,  โ”‚    โ”‚ Scores &     โ”‚                          โ”‚
โ”‚  โ”‚ map, chat    โ”‚    โ”‚ ranks venues โ”‚                          โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                          โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                 โ”‚
                                 โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                         DATA LAYER                               โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚  Neon Postgres  โ”‚  โ”‚   OpenStreetMap โ”‚  โ”‚     Clerk      โ”‚  โ”‚
โ”‚  โ”‚                 โ”‚  โ”‚                 โ”‚  โ”‚                โ”‚  โ”‚
โ”‚  โ”‚ - Users         โ”‚  โ”‚ - Overpass API  โ”‚  โ”‚ - Auth         โ”‚  โ”‚
โ”‚  โ”‚ - Venues        โ”‚  โ”‚ - Cafes         โ”‚  โ”‚ - User Sync    โ”‚  โ”‚
โ”‚  โ”‚ - Ratings       โ”‚  โ”‚ - Libraries     โ”‚  โ”‚ - Sessions     โ”‚  โ”‚
โ”‚  โ”‚ - Favorites     โ”‚  โ”‚ - Coworking     โ”‚  โ”‚                โ”‚  โ”‚
โ”‚  โ”‚ - Conversations โ”‚  โ”‚                 โ”‚  โ”‚                โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ”‚                                                                  โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                      โ”‚
โ”‚  โ”‚   Pexels API    โ”‚  โ”‚    OSRM API     โ”‚                      โ”‚
โ”‚  โ”‚                 โ”‚  โ”‚                 โ”‚                      โ”‚
โ”‚  โ”‚ - Venue Photos  โ”‚  โ”‚ - Road Routing  โ”‚                      โ”‚
โ”‚  โ”‚ - 20k/mo FREE   โ”‚  โ”‚ - Polylines     โ”‚                      โ”‚
โ”‚  โ”‚ - Server Proxy  โ”‚  โ”‚ - FREE          โ”‚                      โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿš€ Getting Started

Prerequisites

  • Node.js 20+ (Node.js 20 LTS or Node.js 22 LTS recommended)
  • npm or yarn
  • Git
  • Docker and Docker Compose (Optional, but highly recommended for local Postgres & Redis)

Installation & Setup

  1. Clone the repository

    git clone https://github.com/SatyamPandey-07/WorkSphere.git
    cd WorkSphere
  2. Install dependencies

    npm install
  3. Choose your environment setup path:

    Option A: Docker Compose (Recommended)

    This starts a local PostgreSQL instance (with the pgvector extension) and Redis automatically.

    # Start database and Redis container services
    docker compose up -d
    
    # Copy local environment example
    cp .env.example .env.local
    # Fill out any missing external API keys in .env.local (e.g. Clerk, Groq)

    Option B: Manual Setup

    If you prefer not to use Docker:

    1. Setup a PostgreSQL 15+ database with the pgvector extension enabled.
    2. Optionally setup an Upstash Redis database.
    3. Copy environment config and fill in Neon and Upstash URLs:
      cp .env.example .env.local
  4. Initialize Database Schema

    npx prisma generate
    npx prisma db push
  5. Run the development server

    npm run dev
  6. Open in browser

    http://localhost:3000

๐Ÿ”ง Troubleshooting

New contributors commonly run into a few setup hurdles when configuring their local environment. Here are the most frequent issues and their quick fixes:

1. PrismaClientInitializationError / Database Connection Failures

Symptom:

PrismaClientInitializationError: Can't reach database server at `localhost:5432`
Please make sure your database server is running at `localhost:5432`.

or

The table `public.Venue` does not exist in the current database.

Root Causes & Solutions:

  • Container not started: If using Docker Compose, ensure the PostgreSQL and Redis containers are actively running:
    docker compose ps
    docker compose up -d
  • Prisma Schema not pushed: If the database exists but tables or columns are missing, synchronize the schema:
    npx prisma generate
    npx prisma db push
  • Seeding sample data: To populate local venues and amenities:
    npm run postinstall
    node prisma/seed.js

2. Node.js Engine & Dependency Incompatibilities

Symptom:

error: Unsupported engine. The engine "node" is incompatible with this module.
Expected version ">=20.0.0". Got "v18.19.0".

or syntax errors involving modern TypeScript experimental strip types, ECMAScript modules, or WebAssembly SIMD loaders.

Root Causes & Solutions:

  • WorkSphere leverages Node.js 20+ runtime features (experimental type stripping, native fetch optimizations, and ES2024 features).
  • Check your current Node.js version:
    node -v
  • If your version is lower than v20.0.0, update via nvm (macOS/Linux) or nvm-windows:
    # Install and switch to Node.js 20 or 22 LTS
    nvm install 20
    nvm use 20

3. Stale Next.js Build Cache (.next)

Symptom:

Error: Cannot find module 'next/dist/server/...'

or hydration mismatch errors, stale chunk load errors, or webpack compilation failures after pulling major upstream changes.

Root Causes & Solutions:

  • Next.js caches compiled pages and webpack artifacts in .next/. When branch switching or updating dependencies, the cache can become invalid.

  • Clear the Next.js build cache and reinstall dependencies cleanly:

    On macOS / Linux / Git Bash:

    rm -rf .next
    npm run dev

    On Windows PowerShell:

    Remove-Item -Recurse -Force .next
    npm run dev
  • If you encounter native module mismatches:

    # Deep clean
    rm -rf .next node_modules package-lock.json
    npm install
    npx prisma generate
    npm run dev

4. Missing or Unconfigured Environment Variables (.env.local)

Symptom:

Error: Missing environment variable: DATABASE_URL

or authentication redirection loops with Clerk, or map tile loading failures.

Root Causes & Solutions:

  • Next.js requires .env.local for local secrets. Ensure you copied .env.example:
    cp .env.example .env.local
  • Verify the following essential keys in .env.local:
    # Local Docker Postgres (default)
    DATABASE_URL="postgresql://postgres:postgres@localhost:5432/worksphere?schema=public"
    DIRECT_URL="postgresql://postgres:postgres@localhost:5432/worksphere?schema=public"
    
    # Upstash Redis (Optional for rate limiting; mock fallback exists)
    UPSTASH_REDIS_REST_URL="http://localhost:8079"
    UPSTASH_REDIS_REST_TOKEN="example_token"
    
    # App Base URL
    NEXT_PUBLIC_APP_URL="http://localhost:3000"
  • Restart npm run dev after updating .env.local to allow Next.js to reload environment variables.

๐Ÿงช Testing

Run All Tests

npm test

Watch Mode

npm run test:watch

End-to-End Tests

npm run test:e2e
npm run test:e2e:ui  # With UI

For a full guide on writing, running, and debugging Playwright tests, see docs/PLAYWRIGHT_TESTING_GUIDE.md.

Test Coverage

  • 57 Unit Tests covering:
    • API Route Handlers
    • React Components
    • Utility Functions
    • Rate Limiting
    • Analytics

๐Ÿ” Environment Variables

Create a .env.local file in the root directory by copying the template:

cp .env.example .env.local

Fill in the following values. Variables marked (required) must be set for the app to start; (optional) ones have local fallbacks.

# โ”€โ”€ Database โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
# (required) Neon PostgreSQL connection string โ€” get from neon.tech
DATABASE_URL="postgresql://user:password@host/database?sslmode=require"

# โ”€โ”€ Authentication โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
# (required) Clerk keys โ€” get from clerk.com > your app > API keys
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
CLERK_SECRET_KEY=sk_test_...
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up

# โ”€โ”€ AI โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
# (required) Groq API key โ€” free at console.groq.com
GROQ_API_KEY=gsk_...

# (optional) Gemini API key โ€” used for server-side venue summaries
GEMINI_API_KEY=your_gemini_key_here

# โ”€โ”€ Venue Photos โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
# (optional) Pexels API key โ€” falls back to placeholder images
PEXELS_API_KEY=your_pexels_key_here

# โ”€โ”€ Rate Limiting โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
# (optional) Upstash Redis โ€” falls back to in-memory rate limiter
UPSTASH_REDIS_REST_URL=https://your-upstash-redis-endpoint.upstash.io
UPSTASH_REDIS_REST_TOKEN=your-upstash-redis-token

Full reference: See docs/ENV_VARS.md for a complete list of every variable with detailed descriptions.

You can obtain the Upstash Redis credentials from your Upstash Redis database dashboard.

The Upstash Redis variables are optional for local development. If UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN are omitted, the application falls back to an in-memory rate limiter. This allows the application to run locally without an Upstash Redis configuration, but rate-limit state is stored only in the local application memory and is not shared across multiple instances or processes.

For production or multi-instance deployments, configuring Upstash Redis is recommended to ensure consistent rate limiting across application instances.

Getting API Keys

Service URL Free Tier Required
Neon neon.tech 0.5GB storage โœ… Yes
Clerk clerk.com 10,000 MAU โœ… Yes
Groq console.groq.com Free API access โœ… Yes
Pexels pexels.com/api 20,000 req/month โŒ No (has fallback)
OSM/OSRM N/A Unlimited โŒ No (public API)

๐Ÿ“ฑ Pages (52 Interactive Application Views)

Category Route Page Description
Core AI & Maps / Landing Page Hero section with product showcase, community stats, and CTAs
/ai AI Workspace Finder Dual-pane 70/30 interactive CartoDB map & multi-agent reasoning chat
/ai/concierge AI Concierge Natural-language concierge for itinerary planning & seat reservations
/workspace Workspace Suite Multi-window workspace manager with persistent layout state
/compare Venue Comparison Side-by-side metric matrix comparison across multiple venues
Social & Collaboration /social Nomad Community Hub Local digital nomad community feeds, check-ins, and networking
/social/focus-room Virtual Focus Rooms Collaborative Pomodoro sessions with synchronized willpower gauges
/social/meet-halfway Meet Halfway Engine Geospatial midpoint calculator for distributed team meetings
/social/skill-exchange Skill Barter Hub Web-of-trust peer-to-peer knowledge and skill exchange
/bundles/work-hop Work-Hop Pass Multi-venue pass bundle purchasing and check-in scanner
Web3 & FinTech /pay/crypto-micro Solana Pay Portal Dynamic QR-code crypto micropayment terminal with Wake Lock
/pay/split/[token] Bill Splitting Hub Multi-party workspace booking bill split and settlement
/peripherals/locker Smart IoT Locker Grid Decentralized luggage & equipment locker rental protocol
Spatial & Hardware /ar/finder WebXR AR Wayfinding Augmented Reality SLAM indoor desk & outlet finder
/wellness/ergonomics 3D Desk Ergonomics Real-time WebGL 3D avatar posture analysis & ISO 9241 evaluation
/venues/sound-gradient Acoustic Heatmap Real-time spatial sound level gradient and noise contour map
/venues/power-grid Power Grid Monitor Real-time cafe electrical load forecasting & breaker trip alert
/venues/solar-finder Solar Glare & Sun Calc Solar angle & natural daylight tracking for glare-free outdoor desks
Analytics & Nomad Compliance /analytics Telemetry Dashboard Venue network latency, noise history, and occupancy analytics
/analytics/nomad-tax Nomad Tax & Border Ledger Zero-knowledge border crossing ledger and tax residency tracker
/analytics/carbon Carbon Footprint Tracker Commute and workspace energy consumption offset calculator
/analytics/noise-forecasting Predictive Noise Engine Prophet-based forecasting for future crowd and decibel levels
User & Administration /dashboard User Neural Ledger Personal dashboard, confirmed bookings, and cryptographic receipts
/dashboard/webhooks Webhook Integrations Developer webhook endpoint management and event delivery logs
/user-profile/passport Nomad Digital Passport Verifiable credential badges, check-in history, and POAPs
/admin/system Admin System Diagnostics Partition maintenance, DB health, and memory telemetry
/admin/performance Core Web Vitals Monitor Real-time server latency, TTFB, and route latency heatmaps
/offline Offline Survival Mode Offline-first PWA fallback with cached venues and queue sync
/sign-in Sign In Clerk authentication sign-in portal
/sign-up Sign Up Clerk authentication sign-up portal

๐Ÿ”Œ API Routes (300+ Modular Endpoints)

WorkSphere features a modular API architecture organized across specialized subsystems:

Subsystem Key Endpoints Description
๐Ÿค– Multi-Agent AI /api/chat
/api/ai/concierge
/api/legal/redline
/api/scheduling/pod
Multi-agent reasoning pipeline, legal NDA redlining, and meeting pod optimization
๐ŸŽง WASM Audio & DSP /api/audio/jammer
/api/audio/vibe
/api/venues/acoustics/rt60
/api/security/acoustic
DAF speech jamming, AI ambient soundscapes, RT60 spatial acoustics, and acoustic masking
๐Ÿ’ณ Web3 & Payments /api/payments/solana/*
/api/bounties/payout
/api/bookings/escrow
/api/finance/card
Solana Pay RPC verification, focus bounties escrow, and virtual card issuance
๐Ÿ‘“ Spatial & WebXR /api/venues/slam
/api/ar/anchors
/api/accessibility/scene
/api/spatial/beacons
SLAM voxel octree, AR anchors, audio-described spatial scene graphs, and team proximity
๐Ÿข Digital Twin & IoT /api/twin/airquality
/api/venues/powergrid
/api/iot/orchestrate
/api/wellness/ergonomics
HVAC air purge orchestrator, cafe breaker trip prediction, Matter IoT bridges, and ergonomics
๐ŸŒ Mesh & Survival /api/compute/burst
/api/network/survival
/api/medical/beacon
/api/network/qos
WebRTC distributed compute mesh, offline P2P emergency network, and medical beacon
๐Ÿ›ก๏ธ ZKP & Security /api/auth/zkp/nomad-proof
/api/identity/verify
/api/documents/sanitize
/api/zkp/deepwork
Zero-knowledge identity proofs, client-side PII sanitization, and proof-of-deep-work
๐Ÿ—บ๏ธ Venues & Routing /api/venues
/api/venues/enrich
/api/routing/microclimate
/api/travel/reroute
Venue search & OSM enrichment, micro-climate weather routing, and flight-delay rerouting
๐Ÿงพ Bookings & Receipts /api/bookings
/api/bookings/[id]/download
/api/tax/nomad-compliance
/api/bookings/export
Serverless PDF receipt generation with HMAC-SHA256 signatures and JSON/CSV tax exports
๐Ÿ“Š Admin & Diagnostics /api/admin/audit/verify
/api/admin/performance
/api/admin/system/latency-heatmap
SHA-256 Merkle tree verification, route latency canvas heatmaps, and system diagnostics

๐Ÿค– Multi-Agent System

Agent Pipeline Flow

User Query: "Find a quiet cafe with WiFi near me"
                    โ”‚
                    โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚           ORCHESTRATOR AGENT                 โ”‚
โ”‚  โ€ข Analyzes query type                      โ”‚
โ”‚  โ€ข Determines: Context โ†’ Data โ†’ Reasoning   โ”‚
โ”‚  โ€ข Output: agentsToUse[], reasoning         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                    โ”‚
                    โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚             CONTEXT AGENT                    โ”‚
โ”‚  โ€ข Extracts intent: workType = "focus"      โ”‚
โ”‚  โ€ข Parameters: amenities = [wifi, quiet]    โ”‚
โ”‚  โ€ข Output: structured intent object         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                    โ”‚
                    โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚              DATA AGENT                      โ”‚
โ”‚  โ€ข Queries Overpass API for cafes           โ”‚
โ”‚  โ€ข Filters by location radius               โ”‚
โ”‚  โ€ข Output: venues[], conditions, meta       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                    โ”‚
                    โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚            REASONING AGENT                   โ”‚
โ”‚  โ€ข Scores: WiFi(30%), Noise(25%),           โ”‚
โ”‚    Outlets(20%), Rating(15%), Distance(10%) โ”‚
โ”‚  โ€ข Ranks top venues with explanations       โ”‚
โ”‚  โ€ข Output: rankedVenues[], reasoning        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                    โ”‚
                    โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚             ACTION AGENT                     โ”‚
โ”‚  โ€ข Updates map markers                      โ”‚
โ”‚  โ€ข Sets map view/zoom                       โ”‚
โ”‚  โ€ข Generates chat response                  โ”‚
โ”‚  โ€ข Output: UI updates, message              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Agent Transparency

The UI shows each agent's contribution:

๐Ÿง  Agent Pipeline (5 steps)
โ”œโ”€ ๐ŸŽฏ Orchestrator: Routing to Context, Data, Reasoning agents
โ”œโ”€ ๐Ÿ” Context: Extracted intent - focus work, needs WiFi
โ”œโ”€ ๐Ÿ“Š Data: Found 12 cafes within 2km radius
โ”œโ”€ ๐Ÿ’ก Reasoning: Top pick - Blue Bottle Coffee (score: 8.5/10)
โ””โ”€ โšก Action: Updated map with 5 markers

The venue summary endpoint sends its prompt to Gemini rather than the chat models. See docs/GEMINI_INTEGRATION.md for the client contract, model choice, error handling, and test setup.


๐Ÿ“ Project Structure

The repository is a Next.js monorepo. Below is the top-level layout followed by a plain-English description of every major directory.

worksphere/
โ”œโ”€โ”€ prisma/                    # Database schema, migrations, and seed script
โ”œโ”€โ”€ party/                     # PartyKit real-time collaboration server
โ”œโ”€โ”€ docs/                      # Extended developer guides and reference docs
โ”œโ”€โ”€ e2e/                       # Playwright end-to-end tests
โ”œโ”€โ”€ public/                    # Static assets: PWA manifest, service worker, icons
โ”œโ”€โ”€ scripts/                   # Build and utility scripts
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ __tests__/             # Jest unit and integration tests
โ”‚   โ”‚   โ”œโ”€โ”€ api/               # API route tests
โ”‚   โ”‚   โ”œโ”€โ”€ components/        # Component tests
โ”‚   โ”‚   โ””โ”€โ”€ lib/               # Utility tests
โ”‚   โ”œโ”€โ”€ app/                   # Next.js App Router pages, layouts, and API routes
โ”‚   โ”‚   โ”œโ”€โ”€ api/               # API route handlers
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ chat/          # Multi-agent pipeline endpoint
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ venues/        # Venue CRUD + OSM/Pexels enrichment
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ favorites/     # User favorites
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ conversations/ # Chat history
โ”‚   โ”‚   โ”œโ”€โ”€ ai/                # Main workspace-finder page
โ”‚   โ”‚   โ”œโ”€โ”€ dashboard/         # User profile and booking dashboard
โ”‚   โ”‚   โ”œโ”€โ”€ sign-in/           # Clerk authentication pages
โ”‚   โ”‚   โ”œโ”€โ”€ sign-up/
โ”‚   โ”‚   โ”œโ”€โ”€ offline/           # PWA offline fallback
โ”‚   โ”‚   โ””โ”€โ”€ layout.tsx         # Root layout and global providers
โ”‚   โ”œโ”€โ”€ components/            # Reusable React UI components
โ”‚   โ”‚   โ”œโ”€โ”€ ai-elements/       # Agent-transparency and AI-specific UI pieces
โ”‚   โ”‚   โ””โ”€โ”€ ui/                # General design-system components
โ”‚   โ”œโ”€โ”€ context/               # React context providers for global client state
โ”‚   โ”œโ”€โ”€ core/                  # Core business logic and domain services
โ”‚   โ”œโ”€โ”€ hooks/                 # Custom React hooks (PWA, real-time, speech)
โ”‚   โ”œโ”€โ”€ lib/                   # Shared utilities, database client, rate limiting, analytics
โ”‚   โ”œโ”€โ”€ locales/               # Internationalisation (i18n) string files
โ”‚   โ”œโ”€โ”€ shaders/               # WebGL/GLSL shader source files
โ”‚   โ”œโ”€โ”€ types/                 # Shared TypeScript type definitions
โ”‚   โ”œโ”€โ”€ utils/                 # General-purpose helper functions
โ”‚   โ”œโ”€โ”€ wasm/                  # WebAssembly modules used in the browser
โ”‚   โ”œโ”€โ”€ worker/                # Service worker and background-sync logic
โ”‚   โ””โ”€โ”€ workers/               # Additional web worker scripts
โ”œโ”€โ”€ jest.config.js             # Jest configuration
โ”œโ”€โ”€ playwright.config.ts       # Playwright configuration
โ””โ”€โ”€ package.json

Key directories at a glance

Directory What it contains
prisma/ schema.prisma (data model), auto-generated migrations, and a seed script for local development
party/ PartyKit server (server.ts, multiRegionServer.ts) that powers real-time collaborative features via WebSockets
docs/ Hundreds of developer-facing guides covering architecture, testing, deployment, security, and more
e2e/ Playwright end-to-end test suites for full browser flows
public/ Static files served directly: service worker (sw.js), PWA manifest, and app icons
scripts/ One-off and CI utility scripts (database seeding, asset generation, etc.)
src/app/ Next.js 15 App Router โ€” every page, layout, and API route handler lives here
src/components/ Reusable React components: map, chatbot, venue cards, rating dialog, error boundary, and design-system primitives
src/context/ React context providers that share global state (currency, events, etc.) across the component tree
src/core/ Framework-agnostic business logic and domain services, kept separate from Next.js specifics
src/hooks/ Custom React hooks: usePWA, useRealTime (SSE), and useSpeechRecognition
src/lib/ Shared back-end helpers: Prisma client, Zod validation schemas, rate limiter, analytics, OSM/Pexels integration, and OSRM routing
src/locales/ Translation JSON files used by the i18n layer
src/shaders/ GLSL/WebGL shader programs for any GPU-accelerated rendering
src/types/ Project-wide TypeScript interfaces and enums
src/utils/ Lightweight, stateless helper functions shared across the codebase
src/wasm/ Compiled WebAssembly modules (e.g. FFT, noise filtering, SQLite FTS)
src/worker/ Service worker source and offline/background-sync logic
src/workers/ Additional dedicated web worker scripts (heavy computation off the main thread)
src/__tests__/ Unit and integration tests mirroring the src/ directory layout

๐Ÿงช Testing the App (User Guide)

Quick Start Test

  1. Open the app at http://localhost:3000
  2. Allow location access when prompted
  3. Start chatting with the AI assistant!

Feature Testing Checklist

๐Ÿ” AI Search

Try these natural language queries:

  • "Find a quiet cafe with good WiFi near me"
  • "Show me coworking spaces within 2km"
  • "I need a library to study"

๐ŸŽ™๏ธ Voice Input

  1. Open the app in Chrome or Edge
  2. Click the microphone icon in the chat input bar
  3. Allow microphone permission when prompted
  4. Speak your query โ€” it will populate the text input automatically
  5. Click Send or press Enter to submit

Testing the unsupported-browser warning (Firefox Nightly / DevTools simulation):

  1. Open Chrome DevTools (F12) โ†’ Console tab
  2. Paste: delete window.SpeechRecognition; delete window.webkitSpeechRecognition;
  3. Reload the page
  4. The mic button will appear dimmed/greyed out
  5. Click it โ†’ an amber warning banner appears explaining the limitation

โญ Favorites & Ratings (Requires Sign-in)

  1. Sign in with Clerk
  2. Click heart icon on venue cards to favorite
  3. Click "Rate" to submit ratings

๐Ÿ“ฑ PWA Installation

  • Desktop: Click install icon in browser
  • Mobile: "Add to Home Screen"

๐Ÿš€ Deployment

Deploy to Vercel

  1. Push to GitHub
  2. Connect repository to Vercel
  3. Add environment variables
  4. Deploy!

๐Ÿ”ฎ Future Improvements

Priority Feature Description
๐Ÿ”ด High Analytics Dashboard Admin page to view search patterns, popular venues, user metrics
๐ŸŸก Medium Mobile App React Native version sharing the same API backend
๐ŸŸก Medium AI Memory Cross-conversation learning for personalized recommendations
๐ŸŸก Medium Social Features Share favorite workspaces, follow other remote workers
๐ŸŸข Low Booking Integration Reserve desks at coworking spaces via API
๐ŸŸข Low Noise Level API Real-time noise monitoring hardware integration

๐Ÿค Contributing & Issue Workflow

Contributions are warmly welcomed! We aim to make contributing as smooth and rewarding as possible.

โšก Automated Issue Assignment

  1. Find an Issue: Explore our Open Issues.
  2. Claim with /claim: Drop a comment containing /claim on any unassigned issue. The automation will assign it to you instantly!
    • You can hold up to 10 active assigned issues at once.
    • Recommended completion window is 6 days.
  3. Release with /unclaim: If you need to step away from an issue, simply comment /unclaim to release it for other contributors.
  4. Auto-Merge on PR: Include Closes #<issue_number> in your PR description. When opened, CI checks the issue link and automatically squash-merges your PR with co-author credit!

Please refer to our Contributing Guide and Code of Conduct.


๐Ÿ“„ License

This project is licensed under the MIT License.


๐Ÿ‘จโ€๐Ÿ’ป Author

Satyam Pandey


โญ Star this repo if you find it helpful!

Made with โค๏ธ by Satyam Pandey

About

Topics

Resources

Code of conduct

Contributing

Security policy

Accessibility

Stars

24 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages