Skip to content

An AI tourism agent for Dubai featuring Gemini 2.5 Flash, semantic search, and real-time safety workflows. Built with Next.js 16, Clerk, and Qdrant.

Notifications You must be signed in to change notification settings

aritra-os/Toursim-Agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ™οΈ Toursim Agent (Dubify)

Your Intelligent Tourism Companion for Dubai - Full-Stack Application with AI-Powered Features

Next.js FastAPI TypeScript Python Gemini Clerk

Live Demo: https://dubify-five.vercel.app

A comprehensive full-stack AI tourism application featuring Google Gemini 2.5 Flash AI, Qdrant vector search, intelligent rate limiting, and modern authentication.


πŸ“‹ Table of Contents


🌟 Overview

Dubai Navigator AI is a full-stack web application that helps tourists explore Dubai safely and intelligently using AI-powered features:

  • πŸ€– AI Tourism Chatbot - Natural conversations about Dubai powered by Gemini 2.5 Flash
  • πŸ” Semantic Search - Find places by "vibes" using vector embeddings and Qdrant
  • πŸ›‘οΈ AI Safety Assessment - Real-time location safety analysis with risk scoring
  • πŸ” Secure Authentication - Clerk-powered auth with Google OAuth

Why This Project Stands Out

  • Polyglot Development: TypeScript frontend + Python backend showcasing versatility
  • Modern AI Integration: Google's latest Gemini 2.5 Flash model
  • Production Architecture: Separated frontend/backend with proper API design
  • Vector Search: Semantic understanding using Qdrant vector database
  • Clean Code: Extensive documentation, type safety, and error handling

✨ Features

🎯 Core Features

1. AI Tourism Chatbot

  • Powered by Google Gemini 2.5 Flash
  • Context-aware conversations about Dubai attractions, culture, and customs
  • Markdown-formatted responses with rich information
  • Message history and conversation context
  • Cultural awareness and safety-first approach
  • Rate Limited: 20 messages per user per hour

2. Vibe-Based Semantic Search

  • Search by feelings/vibes (e.g., "romantic sunset spots", "family-friendly activities")
  • Vector embeddings for semantic understanding
  • Qdrant Vector Database with in-memory fallback
  • Smart filtering (category, price range, halal, family-friendly)
  • 500+ pre-loaded Dubai locations
  • Rate Limited: 30 searches per user per hour

3. AI Safety Check Workflow

  • 5-stage automated safety assessment
  • Real-time location risk scoring (0-100)
  • AI-generated contextual recommendations
  • Time-of-day aware analysis
  • Complete audit trail with workflow stages
  • Emergency contact information
  • Rate Limited: 10 safety checks per user per hour

4. User Authentication

  • Clerk authentication with Google OAuth
  • Email/password authentication
  • Protected dashboard routes
  • User profile management
  • Session management and security

🎨 Additional Features

  • Responsive Design: Beautiful UI that works on all devices
  • Dark Mode Ready: Tailwind CSS with customizable themes
  • Type Safety: Full TypeScript implementation
  • Error Handling: Comprehensive error messages and fallbacks
  • Auto Documentation: Interactive API docs at /docs

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         Frontend                            β”‚
β”‚                  (Next.js + TypeScript)                     β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚   Chat   β”‚  β”‚  Search  β”‚  β”‚  Safety  β”‚  β”‚   Auth   β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β”‚             β”‚             β”‚             β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚
                      β–Ό
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚      Backend API            β”‚
        β”‚   (FastAPI + Python)        β”‚
        β”‚                             β”‚
        β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
        β”‚  β”‚  API Endpoints      β”‚   β”‚
        β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€   β”‚
        β”‚  β”‚ /api/chat           β”‚   β”‚
        β”‚  β”‚ /api/search         β”‚   β”‚
        β”‚  β”‚ /api/safety         β”‚   β”‚
        β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
        β”‚            β”‚                β”‚
        β”‚            β–Ό                β”‚
        β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
        β”‚  β”‚  Business Logic     β”‚   β”‚
        β”‚  β”‚  (Services)         β”‚   β”‚
        β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β–Ό                     β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Gemini AI   β”‚    β”‚  Qdrant Vector   β”‚
β”‚  2.5 Flash   β”‚    β”‚    Database      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Data Flow

  1. User Request β†’ Frontend (Next.js)
  2. API Call β†’ Backend (FastAPI) at http://localhost:8000
  3. Business Logic β†’ Service Layer (Gemini/Qdrant)
  4. External APIs β†’ Google Gemini AI / Qdrant Cloud
  5. Response β†’ Backend β†’ Frontend β†’ User

πŸ› οΈ Tech Stack

Frontend (/frontend)

  • Framework: Next.js 16 (App Router)
  • Language: TypeScript 5.x
  • Styling: Tailwind CSS 3.4
  • Authentication: Clerk
  • UI Components: shadcn/ui
  • Icons: Lucide React
  • Deployment: Vercel

Backend (/backend)

  • Framework: FastAPI 0.115
  • Language: Python 3.11+
  • AI: Google Gemini 2.5 Flash (google-generativeai)
  • Vector DB: Qdrant Cloud
  • Authentication: Clerk (verification)
  • Validation: Pydantic
  • Rate Limiting: SlowAPI
  • Server: Uvicorn (ASGI)
  • Deployment: Railway / Render / Fly.io

External Services

  • AI Model: Google Gemini 2.5 Flash
  • Vector Search: Qdrant Cloud
  • Authentication: Clerk
  • Hosting: Vercel (Frontend) + Railway (Backend)

πŸš€ Getting Started

Prerequisites

  • Node.js 18+ (for frontend)
  • Python 3.11+ (for backend)
  • npm or yarn (package manager)
  • Git (version control)

Required API Keys

  1. Google Gemini API Key

  2. Qdrant Cloud (Optional - has fallback)

  3. Clerk Authentication

Installation

1. Clone the Repository

git clone https://github.com/yourusername/dubai-navigator.git
cd dubai-navigator

2. Setup Backend

cd backend

# Create virtual environment
python -m venv venv

# Activate virtual environment
# Windows:
venv\Scripts\activate
# Mac/Linux:
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Create .env file
copy .env.example .env
# Edit .env and add your API keys

# Run the server
python -m app.main

Backend will run on: http://localhost:8000 API Documentation: http://localhost:8000/docs

3. Setup Frontend

cd frontend

# Install dependencies
npm install

# Create .env.local file
copy .env.example .env.local
# Edit .env.local and add your Clerk keys

# Run development server
npm run dev

Frontend will run on: http://localhost:3000

Running Both Services

Terminal 1 - Backend:

cd backend
venv\Scripts\activate  # Windows
python -m app.main

Terminal 2 - Frontend:

cd frontend
npm run dev

Now visit: http://localhost:3000

Running with Docker

The easiest way to run both frontend and backend together is using Docker Compose:

Prerequisites

Using Docker Compose

  1. Make sure you have environment files ready:

    • backend/.env with your API keys
    • frontend/.env.local with Clerk keys
  2. Build and start all services:

# Build and start in detached mode
docker-compose up -d --build

# Or run in foreground (see logs)
docker-compose up --build
  1. Access the application:

  2. View logs:

# All services
docker-compose logs -f

# Specific service
docker-compose logs -f frontend
docker-compose logs -f backend
  1. Stop services:
# Stop containers
docker-compose down

# Stop and remove volumes
docker-compose down -v

Running Individual Services with Docker

Backend only:

cd backend
docker build -t dubai-navigator-backend .
docker run -p 8000:8000 --env-file .env dubai-navigator-backend

Frontend only:

cd frontend
docker build -t dubai-navigator-frontend .
docker run -p 3000:3000 --env-file .env.local dubai-navigator-frontend

Docker Benefits

  • βœ… No need to install Python or Node.js
  • βœ… Consistent environment across all machines
  • βœ… Easy deployment to cloud platforms
  • βœ… Isolated dependencies

πŸ“ Project Structure

Dubai-Navigator/
β”œβ”€β”€ frontend/                    # Next.js Frontend
β”‚   β”œβ”€β”€ app/                    # Next.js App Router
β”‚   β”‚   β”œβ”€β”€ (auth)/            # Authentication pages
β”‚   β”‚   β”œβ”€β”€ (dashboard)/       # Protected dashboard routes
β”‚   β”‚   β”œβ”€β”€ api/               # API route handlers (deprecated - use backend)
β”‚   β”‚   └── layout.tsx         # Root layout
β”‚   β”œβ”€β”€ components/            # React components
β”‚   β”‚   β”œβ”€β”€ chat/             # Chat interface
β”‚   β”‚   β”œβ”€β”€ search/           # Search components
β”‚   β”‚   β”œβ”€β”€ safety/           # Safety check UI
β”‚   β”‚   └── ui/               # shadcn/ui components
β”‚   β”œβ”€β”€ lib/                  # Utilities and helpers
β”‚   β”œβ”€β”€ .env.local            # Frontend environment variables
β”‚   β”œβ”€β”€ .env.example          # Environment template
β”‚   β”œβ”€β”€ package.json          # Node dependencies
β”‚   └── README.md             # Frontend documentation
β”‚
β”œβ”€β”€ backend/                   # FastAPI Backend
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ main.py           # FastAPI entry point
β”‚   β”‚   β”œβ”€β”€ config.py         # Configuration
β”‚   β”‚   β”œβ”€β”€ api/              # API endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ chat.py       # POST /api/chat
β”‚   β”‚   β”‚   β”œβ”€β”€ search.py     # POST /api/search
β”‚   β”‚   β”‚   └── safety.py     # POST /api/safety
β”‚   β”‚   β”œβ”€β”€ services/         # Business logic
β”‚   β”‚   β”‚   β”œβ”€β”€ gemini_service.py
β”‚   β”‚   β”‚   └── qdrant_service.py
β”‚   β”‚   └── models/           # Data models
β”‚   β”‚       └── schemas.py    # Pydantic schemas
β”‚   β”œβ”€β”€ .env                  # Backend environment variables (gitignored)
β”‚   β”œβ”€β”€ .env.example          # Environment template
β”‚   β”œβ”€β”€ requirements.txt      # Python dependencies
β”‚   β”œβ”€β”€ test_api.py          # API testing script
β”‚   β”œβ”€β”€ README.md            # Backend documentation
β”‚   β”œβ”€β”€ QUICKSTART.md        # Beginner setup guide
β”‚   └── LEARNING_GUIDE.md    # Code explanations
β”‚
β”œβ”€β”€ .gitignore               # Git ignore rules
└── README.md                # This file (Main documentation)

πŸ“š API Documentation

Interactive API Docs

Visit http://localhost:8000/docs when the backend is running for interactive API documentation powered by Swagger UI.

Endpoints

1. Chat Endpoint

POST /api/chat
Content-Type: application/json

{
  "message": "What are the best places to visit in Dubai?",
  "user_id": "user_123",
  "history": []  // Optional conversation history
}

Response:

{
  "success": true,
  "response": "Dubai has many amazing attractions...",
  "error": null
}

2. Search Endpoint

POST /api/search
Content-Type: application/json

{
  "query": "romantic sunset spots",
  "limit": 10,
  "user_id": "user_123",
  "filters": {
    "category": "dining",
    "price_range": "medium"
  }
}

Response:

{
  "success": true,
  "results": [...],
  "count": 10,
  "error": null
}

3. Safety Check Endpoint

POST /api/safety
Content-Type: application/json

{
  "location_name": "Dubai Marina",
  "coordinates": {"lat": 25.08, "lng": 55.14},
  "time_of_day": "evening",
  "user_id": "user_123"
}

Response:

{
  "success": true,
  "risk_level": "low",
  "risk_score": 15,
  "analysis": "Dubai Marina is very safe...",
  "recommendations": [...]
}

πŸš€ Deployment

Step 1: Deploy Backend First

Choose one of these platforms for the FastAPI backend:

Railway (Recommended)

# Install Railway CLI
npm i -g @railway/cli

# Navigate to backend
cd backend

# Login and deploy
railway login
railway init
railway up

Render

  1. Connect GitHub repository
  2. Select backend folder as root directory
  3. Build command: pip install -r requirements.txt
  4. Start command: python -m app.main
  5. Add environment variables

Fly.io

# Install Fly CLI
cd backend
fly launch
fly deploy

Required Backend Environment Variables:

  • GEMINI_API_KEY - Your Google Gemini API key
  • CLERK_SECRET_KEY - Your Clerk secret key
  • QDRANT_URL (optional) - Qdrant cluster URL
  • QDRANT_API_KEY (optional) - Qdrant API key
  • CORS_ORIGINS - Update with your frontend URL

Step 2: Deploy Frontend to Vercel

  1. Push to GitHub
git init
git add .
git commit -m "Initial commit"
git remote add origin <your-repo-url>
git push -u origin main
  1. Deploy on Vercel

    • Visit Vercel
    • Click "Import Project"
    • Select your GitHub repository
    • Set Root Directory to frontend
    • Add environment variables:
      • NEXT_PUBLIC_API_URL - Your deployed backend URL (e.g., https://your-backend.railway.app)
      • NEXT_PUBLIC_APP_URL - Your Vercel URL
      • NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY - Clerk publishable key
      • CLERK_SECRET_KEY - Clerk secret key
      • NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
      • NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
      • NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/dashboard
      • NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/dashboard
    • Click "Deploy"
  2. Update Backend CORS

After deploying frontend, update your backend's CORS_ORIGINS environment variable to include your Vercel domain:

CORS_ORIGINS=http://localhost:3000,https://your-app.vercel.app
  1. Update Clerk Settings

In your Clerk dashboard, add both URLs to:

  • Allowed Origins
  • Redirect URLs

Done! Your full-stack app is now live!


🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgments

  • Google Gemini Team - For the powerful Gemini 2.5 Flash AI model
  • Qdrant - For the excellent vector database
  • Clerk - For seamless authentication
  • Vercel - For the amazing Next.js hosting

πŸ“ž Contact

Built by: Aritra Hackathon: LabLab.ai Technologies: Google Gemini 2.5 Flash, Qdrant, Clerk, Next.js 16, FastAPI, Vercel

Project Link: https://github.com/Rain-09x16/Dubify


πŸŽ“ Learning Resources

New to the technologies used in this project?


Built with ❀️

⭐ Star this repo if you find it helpful!

About

An AI tourism agent for Dubai featuring Gemini 2.5 Flash, semantic search, and real-time safety workflows. Built with Next.js 16, Clerk, and Qdrant.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published