Skip to content

varshu55/WorkSphere

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

406 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿข WorkSphere - AI-Powered Remote Workspace Finder

WorkSphere Banner

Next.js TypeScript Prisma Tailwind CSS Tests PWA Ready

A multi-agent AI platform that helps remote workers discover ideal workspaces like cafes, coworking spaces, and libraries based on WiFi quality, power outlets, noise levels, and more.

๐Ÿš€ Live Demo โ€ข ๐Ÿ› Report Bug


๐Ÿ‘‘ Project Leadership & Authorship

๐Ÿš€ Contributors (Live API Tracker)

Automated contributor tracking synced directly via the GitHub API:

WorkSphere Contributors


๐Ÿ“‹ 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

๐Ÿ—บ๏ธ 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

๐Ÿ“Š 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

  • 57 Unit Tests: Full coverage with Jest & React Testing Library
  • E2E Testing: Playwright configuration for end-to-end tests
  • API Tests: Route handler testing
  • Component Tests: UI component validation

๐Ÿ› ๏ธ Tech Stack

Category Technology
Framework Next.js 15.5 (App Router)
Language TypeScript 5.0
Styling Tailwind CSS 4.0, Custom UI Components
AI/LLM Groq SDK (Llama 3.3 70B)
Database Neon PostgreSQL + Prisma 7.2 ORM (with @prisma/adapter-pg)
Authentication Clerk
Maps React Leaflet + OpenStreetMap
Venue Data OpenStreetMap (Overpass API) - FREE
Venue Photos Pexels API - FREE (20k req/mo)
Real-time Server-Sent Events (SSE)
Routing OSRM (Open Source Routing Machine) - FREE
PDF Generation pdf-lib 2.x (serverless-compatible)
Testing Jest 29, React Testing Library, Playwright
PWA Service Workers + IndexedDB
Deployment Vercel

๐Ÿ—๏ธ 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 18+
  • npm or yarn
  • Git

Installation

  1. Clone the repository

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

    npm install
  3. Set up environment variables

    cp .env.example .env.local
    # Edit .env.local with your credentials
  4. Set up the database

    # Prisma 7 uses driver adapters - ensure DATABASE_URL is set
    npx prisma generate
    npx prisma db push
  5. Run the development server

    npm run dev
  6. Open in browser

    http://localhost:3000
    

๐Ÿงช 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

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:

# Database (Neon PostgreSQL)
DATABASE_URL="postgresql://user:password@host/database?sslmode=require"

# Clerk Authentication
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 (Groq)
GROQ_API_KEY=gsk_...

# Pexels (for venue photos - free at pexels.com/api)
PEXELS_API_KEY=your_pexels_key_here

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

Route Page Description
/ Landing Page Hero section with product mockup, features showcase, CTAs
/ai AI Workspace Finder Main app with 70/30 map/chat split, dark theme
/dashboard User Dashboard Personal dashboard for authenticated users
/offline Offline Page PWA fallback when network unavailable
/sign-in Sign In Clerk authentication sign-in page
/sign-up Sign Up Clerk authentication sign-up page

๏ฟฝ๐Ÿ”Œ API Routes

Method Route Description
POST /api/chat Main chat endpoint with agent pipeline
GET /api/venues Search venues
POST /api/venues Add crowdsourced venue
GET /api/venues/enrich Enrich venue with OSM + Pexels data
POST /api/venues/[id]/rate Rate a venue
POST /api/venues/updates Bulk update venue photos
GET /api/favorites Get user's favorites
POST /api/favorites Add favorite
DELETE /api/favorites Remove favorite
GET /api/conversations List conversations
POST /api/conversations Create conversation
GET /api/conversations/[id] Get conversation
DELETE /api/conversations/[id] Delete conversation
GET /api/location IP-based location fallback
POST /api/webhook Clerk webhook for user sync

๐Ÿค– 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

๐Ÿ“ Project Structure

worksphere/
โ”œโ”€โ”€ prisma/
โ”‚   โ””โ”€โ”€ schema.prisma          # Database schema
โ”œโ”€โ”€ public/
โ”‚   โ”œโ”€โ”€ sw.js                  # Service worker for PWA
โ”‚   โ””โ”€โ”€ manifest.json          # PWA manifest
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ __tests__/             # Test files
โ”‚   โ”‚   โ”œโ”€โ”€ api/               # API route tests
โ”‚   โ”‚   โ”œโ”€โ”€ components/        # Component tests
โ”‚   โ”‚   โ””โ”€โ”€ lib/               # Utility tests
โ”‚   โ”œโ”€โ”€ agents/                # AI Agent implementations
โ”‚   โ”‚   โ”œโ”€โ”€ Orchestrator.tsx   # Routes queries to agents
โ”‚   โ”‚   โ”œโ”€โ”€ ContextAgent.tsx   # Extracts user intent
โ”‚   โ”‚   โ”œโ”€โ”€ DataAgent.tsx      # Fetches venue data
โ”‚   โ”‚   โ”œโ”€โ”€ ReasoningAgent.tsx # Scores and ranks venues
โ”‚   โ”‚   โ””โ”€โ”€ ActionAgent.tsx    # Updates UI
โ”‚   โ”œโ”€โ”€ app/
โ”‚   โ”‚   โ”œโ”€โ”€ api/               # API routes
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ chat/          # Agent pipeline endpoint
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ venues/        # Venue CRUD
โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ enrich/    # OSM + Pexels enrichment
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ favorites/     # User favorites
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ conversations/ # Chat history
โ”‚   โ”‚   โ”œโ”€โ”€ ai/                # Main app page
โ”‚   โ”‚   โ”œโ”€โ”€ sign-in/           # Auth pages
โ”‚   โ”‚   โ”œโ”€โ”€ sign-up/
โ”‚   โ”‚   โ”œโ”€โ”€ offline/           # Offline fallback
โ”‚   โ”‚   โ””โ”€โ”€ layout.tsx         # Root layout
โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”œโ”€โ”€ ai-elements/       # Reusable AI UI components
โ”‚   โ”‚   โ”œโ”€โ”€ ui/                # UI components
โ”‚   โ”‚   โ”œโ”€โ”€ EnhancedChatbot.tsx
โ”‚   โ”‚   โ”œโ”€โ”€ Map.tsx
โ”‚   โ”‚   โ”œโ”€โ”€ VenueCard.tsx      # Enhanced with photos, amenities
โ”‚   โ”‚   โ”œโ”€โ”€ VenueRatingDialog.tsx
โ”‚   โ”‚   โ”œโ”€โ”€ VenueSubmissionModal.tsx
โ”‚   โ”‚   โ””โ”€โ”€ ErrorBoundary.tsx
โ”‚   โ”œโ”€โ”€ hooks/
โ”‚   โ”‚   โ”œโ”€โ”€ usePWA.tsx         # PWA installation hook
โ”‚   โ”‚   โ””โ”€โ”€ useRealTime.tsx    # Real-time updates hook
โ”‚   โ”œโ”€โ”€ lib/
โ”‚   โ”‚   โ”œโ”€โ”€ prisma.ts          # Database client
โ”‚   โ”‚   โ”œโ”€โ”€ utils.ts           # Utilities
โ”‚   โ”‚   โ”œโ”€โ”€ rateLimit.ts       # Rate limiting
โ”‚   โ”‚   โ”œโ”€โ”€ analytics.ts       # Event tracking
โ”‚   โ”‚   โ”œโ”€โ”€ validations.ts     # Zod schemas
โ”‚   โ”‚   โ”œโ”€โ”€ venues.ts          # OSM + Pexels integration (NEW)
โ”‚   โ”‚   โ”œโ”€โ”€ routing.ts         # OSRM routing (NEW)
โ”‚   โ”‚   โ””โ”€โ”€ offlineStorage.ts  # IndexedDB for PWA
โ”‚   โ”œโ”€โ”€ tools/                 # AI Agent tools
โ”‚   โ””โ”€โ”€ types/                 # TypeScript types
โ”œโ”€โ”€ e2e/                       # Playwright E2E tests
โ”œโ”€โ”€ jest.config.js             # Jest configuration
โ”œโ”€โ”€ playwright.config.ts       # Playwright configuration
โ””โ”€โ”€ package.json

๐Ÿงช 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"

โญ 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

Contributions are welcome! Please refer to our comprehensive Contributing Guide for details on:

  • Coding standards and styling.
  • Testing guidelines (Jest unit tests and Playwright E2E integration).
  • Required pre-commit quality checks to ensure Vercel build compatibility.

To get started quickly:

  1. Fork the repository and create your feature branch (git checkout -b feature/amazing-feature).
  2. Implement your changes.
  3. Make sure all pre-commit checks pass (npm run lint, npx tsc --noEmit, and npm test).
  4. Commit your changes (git commit -m 'feat: Add amazing feature') and push to your branch.
  5. Open a Pull Request against the main branch.

๐Ÿ“„ 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

Releases

Packages

Contributors

Languages