Skip to content

CoSpa is a smart discovery and booking platform for coworking spaces and work-friendly coffee shops, connecting users with curated spaces to work, meet, and create.

Notifications You must be signed in to change notification settings

hoangnv170752/CoSpa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CoSpa - AI-Powered Workspace Discovery Platform

CoSpa - HΓ ng ngΓ y CoSpa trΓͺn Unikorn.vn

CoSpa is an intelligent location discovery platform that helps users find the perfect workspaces, cafes, and coworking spaces across Vietnam. Built with AI-powered chat interface and semantic search capabilities.

🌟 Features

Core Features

  • AI Chat Assistant: Natural language conversation to discover locations based on user preferences
  • Semantic Search: Powered by Qdrant vector database for intelligent location matching
  • Interactive Map: Real-time location visualization with Leaflet
  • Saved Locations: Bookmark favorite workspaces for quick access
  • User Reviews: Community-driven reviews with rating system
  • City Navigation: Quick filters for major cities (Hanoi, Quang Ninh, Hai Phong, Ho Chi Minh City)

User Tiers

  • Free Tier:

    • 3 conversation limit
    • 10 messages per conversation
    • 1 review per location
    • Public reviews (name & email displayed)
  • Premium Tier (99,000Δ‘ one-time):

    • Unlimited conversations
    • Unlimited messages
    • Anonymous reviews
    • Priority support
    • Early access to new features

Review System

  • Star rating (1-5)
  • Text comments about quality, WiFi, staff attitude
  • User information display for free users
  • Anonymous option for premium users
  • One review per user per location

πŸ› οΈ Tech Stack

Frontend

  • React + TypeScript + Vite
  • Tailwind CSS for styling
  • Leaflet for interactive maps
  • Clerk for authentication
  • Lucide React for icons

Backend

  • FastAPI (Python 3.11+)
  • PostgreSQL for data storage
  • Qdrant for vector search
  • OpenAI GPT-4 for chat completions
  • psycopg for database connections

Infrastructure

  • Database: PostgreSQL with UUID primary keys
  • Vector DB: Qdrant for semantic search
  • Authentication: Clerk
  • Deployment: VPS with automated backups

πŸ“ Project Structure

CoSpa/
β”œβ”€β”€ api/                    # FastAPI backend
β”‚   β”œβ”€β”€ routes/            # API endpoints
β”‚   β”‚   β”œβ”€β”€ chat.py        # Chat & location search
β”‚   β”‚   β”œβ”€β”€ conversations.py
β”‚   β”‚   β”œβ”€β”€ reviews.py     # Review system
β”‚   β”‚   β”œβ”€β”€ saved_locations.py
β”‚   β”‚   └── users.py
β”‚   β”œβ”€β”€ config/            # Configuration
β”‚   β”œβ”€β”€ models/            # Pydantic models
β”‚   └── services/          # Business logic
β”œβ”€β”€ web/                   # React frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/    # React components
β”‚   β”‚   β”œβ”€β”€ pages/         # Page components
β”‚   β”‚   β”œβ”€β”€ services/      # API services
β”‚   β”‚   └── types/         # TypeScript types
β”‚   └── public/            # Static assets
β”œβ”€β”€ db/                    # Database
β”‚   └── migrations/        # SQL migrations
└── scripts/               # Utility scripts
    └── backup_database.sh # Automated backup

πŸš€ Getting Started

Prerequisites

  • Python 3.11+
  • Node.js 18+
  • PostgreSQL 14+
  • Qdrant instance
  • OpenAI API key
  • Clerk account

Backend Setup

  1. Install dependencies:
cd api
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt
  1. Configure environment (.env):
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=cospa
POSTGRES_USER=postgres
POSTGRES_PASSWORD=your_password

OPENAI_API_KEY=your_openai_key
QDRANT_API_KEY=your_qdrant_key
QDRANT_URL=your_qdrant_url

CLERK_SECRET_KEY=your_clerk_secret
  1. Run migrations:
psql -U postgres -d cospa -f db/migrations/001_initial_schema.sql
psql -U postgres -d cospa -f db/migrations/006_create_reviews_table.sql
psql -U postgres -d cospa -f db/migrations/007_add_user_info_to_reviews.sql
  1. Start server:
python main.py
# Server runs on http://localhost:8000

Frontend Setup

  1. Install dependencies:
cd web
npm install
  1. Configure environment (.env):
VITE_API_BASE_URL=http://localhost:8000
VITE_CLERK_PUBLISHABLE_KEY=your_clerk_key
  1. Start development server:
npm run dev
# App runs on http://localhost:5173

πŸ“Š Database Schema

Key Tables

  • users: User profiles from Clerk
  • sites: Workspace/cafe locations with coordinates
  • chat_conversations: User conversation threads
  • chat_messages: Individual messages with AI responses
  • saved_locations: User bookmarked locations
  • reviews: User reviews with ratings and comments

🎯 Key Implementations

1. Conversation Limits

  • Free users: Max 3 conversations, 10 messages each
  • Backend validation with clear error messages
  • UI prompts to upgrade when limits reached

2. Review System

  • One review per user per location (database constraint)
  • Free users: Name & email displayed
  • Premium users: Optional anonymous reviews
  • Star ratings with text comments

3. Semantic Search

  • Qdrant vector embeddings for location matching
  • Natural language query understanding
  • Context-aware location recommendations

4. Database Backups

  • Automated daily backups via cron
  • 3-day retention policy
  • Compressed archives with timestamps

πŸ” Security Features

  • Clerk authentication integration
  • User UUID-based access control
  • SQL injection prevention with parameterized queries
  • CORS configuration for API security

πŸ’³ Payment Integration

  • QR code payment options (International & Vietnam Banking)
  • Manual verification process
  • 24-hour upgrade turnaround

πŸ“ API Documentation

Once the server is running, visit:

  • Swagger UI: http://localhost:8000/docs
  • ReDoc: http://localhost:8000/redoc

🀝 Contributing

This is a personal project for the Amazon Nova AI Hackathon. For inquiries:

πŸ“„ License

All rights reserved Β© 2026 CoSpa

πŸ† Hackathon Submission

Built for Amazon Nova AI Hackathon - Agentic AI Category

  • Multi-agent architecture for location discovery
  • Amazon Nova integration for embeddings and chat
  • Enterprise-ready solution for media companies

Note: This application is currently in beta and actively accepting feedback for improvements.

About

CoSpa is a smart discovery and booking platform for coworking spaces and work-friendly coffee shops, connecting users with curated spaces to work, meet, and create.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors