A modern, real-time travel planning interface built with Svelte 5 that allows users to create AI-generated itineraries and track their status in real-time. Features dual functionality for both creating new travel plans and monitoring existing ones.
$state
, $derived
Frontend Architecture
βββ π Multi-Page Application (SvelteKit)
β βββ / (Homepage) - Create + Check toggle interface
β βββ /status - Dedicated real-time status tracking
βββ π₯ Real-time Data Layer (Firebase)
β βββ Firestore listeners with onSnapshot
β βββ Automatic connection recovery
βββ π¨ Component Architecture (Svelte 5)
β βββ Reusable UI components
β βββ Smart state management with runes
βββ πΊοΈ Google Maps Integration
β βββ Places API autocomplete
β βββ Fallback search system
βββ π Deployment (Cloudflare Pages)
βββ Static site generation
βββ Global CDN distribution
# Clone the repository
git clone <your-frontend-repo>
cd ai-itinerary-status-checker
# Install dependencies
npm install
# Copy environment template
cp .env.example .env
# Edit with your configuration
nano .env
Update .env
with your actual values:
# π₯ Firebase Configuration (Required for real-time features)
VITE_FIREBASE_API_KEY=AIzaSyBxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
VITE_FIREBASE_AUTH_DOMAIN=your-project-id.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your-project-id
VITE_FIREBASE_STORAGE_BUCKET=your-project-id.appspot.com
VITE_FIREBASE_MESSAGING_SENDER_ID=123456789012
VITE_FIREBASE_APP_ID=1:123456789012:web:abcdef1234567890
# πΊοΈ Google Maps API Key (Optional - enhances city search)
VITE_GOOGLE_MAPS_API_KEY=AIzaSyBxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# π Backend API URL (Update with your Cloudflare Worker URL)
VITE_API_BASE_URL=https://your-worker.workers.dev
# Start development server
npm run dev
# Open browser to http://localhost:5173
ai-itinerary-checker
</>
) to add web appItinerary Status Checker
.env
filerules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /itineraries/{jobId} {
allow read: if true; // Public read with jobId
allow write: if false; // Only server writes
}
match /{document=**} {
allow read, write: if false;
}
}
}
.env
file as VITE_GOOGLE_MAPS_API_KEY
1. User lands on homepage
β
2. "Create New" tab is selected by default
β
3. User types destination β Google Maps autocomplete appears
β
4. User selects duration (1 day to 1 month)
β
5. Clicks "Generate My AI Itinerary"
β
6. API call to backend β Receives Job ID
β
7. Success message β Auto-redirect to status page
β
8. Real-time tracking β Shows generation progress
β
9. Completed itinerary β Full day-by-day display
1. User clicks "Check Status" tab
β
2. Enters Job ID in input field
β
3. Clicks "View My Itinerary Status"
β
4. Redirects to /status?jobId=xxx
β
5. Real-time Firebase listener starts
β
6. Shows current status with live updates
β
7. Displays final itinerary when ready
src/lib/components/
βββ GooglePlacesInput.svelte # Smart city autocomplete
βββ StatusCard.svelte # Status display with progress
βββ ItineraryDisplay.svelte # Beautiful itinerary presentation
βββ ErrorMessage.svelte # User-friendly error handling
βββ LoadingSpinner.svelte # Consistent loading states
src/routes/
βββ +layout.svelte # Global layout and styles
βββ +page.svelte # Homepage (create/check toggle)
βββ status/
βββ +page.svelte # Dedicated status tracking page
// Svelte 5 Runes Examples
let currentView = $state('create'); // Reactive state
let statusConfig = $derived(getConfig(data)); // Computed values
let unsubscribe = null; // Firebase listener
npm run build
.svelte-kit/cloudflare
VITE_*
variables from your .env
file# Build the project
npm run build
# Deploy to Cloudflare Pages
npm run deploy
# Deploy to specific environments
npm run deploy:staging
npm run deploy:production
# Build for production
npm run build
# Deploy .svelte-kit/cloudflare/ folder to:
# - Vercel
# - Netlify
# - GitHub Pages
# - Any static hosting service
npm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
npm run check # Type checking
npm run deploy # Deploy to Cloudflare Pages
npm run deploy:staging # Deploy to staging environment
npm run deploy:production # Deploy to production environment
ai-itinerary-status-checker/
βββ src/
β βββ routes/
β β βββ +layout.svelte
β β βββ +page.svelte # Homepage with dual functionality
β β βββ status/
β β βββ +page.svelte # Real-time status tracking
β βββ lib/
β β βββ components/ # Reusable UI components
β β βββ firebase.js # Firebase configuration
β βββ app.html # HTML template
β βββ app.css # Global styles + Tailwind
βββ static/ # Static assets
βββ package.json # Dependencies and scripts
βββ svelte.config.js # Svelte configuration
βββ tailwind.config.js # Tailwind CSS configuration
βββ vite.config.js # Vite configuration
βββ .env.example # Environment template
βββ README.md # This file
// Svelte 5 Runes Pattern
let state = $state(initialValue);
let computed = $derived(transform(state));
// Event Handling
function handleSubmit(event) {
event.preventDefault();
// Handle form submission
}
// Component Props
let { value = '', onSelect = () => {} } = $props();
# Test in different browsers
- Chrome/Chromium
- Firefox
- Safari
- Edge
- Mobile browsers (iOS Safari, Chrome Mobile)
# Analyze bundle size
npm run build
npx vite-bundle-analyzer .svelte-kit/cloudflare
# Lighthouse audit
npm run preview
# Then run Lighthouse in browser dev tools
# Enable debug mode
VITE_DEBUG=true npm run dev
# Check console for:
# - Firebase connection status
# - Google Maps API loading
# - Component state changes
# - API request/response logs
// Built-in error boundaries
try {
await apiCall();
} catch (error) {
console.error('API Error:', error);
showUserFriendlyError(error);
}
// Firebase connection monitoring
unsubscribe = onSnapshot(docRef,
(doc) => handleSuccess(doc),
(error) => handleError(error)
);
# Clear cache and reinstall
rm -rf node_modules .svelte-kit package-lock.json
npm install
npm run build
# Check configuration
- Verify all VITE_FIREBASE_* variables are set
- Ensure Firestore rules allow read access
- Check browser console for Firebase errors
# Verify API key
- Check VITE_GOOGLE_MAPS_API_KEY is set
- Ensure Places API is enabled
- Verify domain restrictions (if set)
# Check environment variables in Cloudflare Pages
- Go to Pages Settings β Environment variables
- Ensure all VITE_* variables are configured
- Verify build output directory is correct
git checkout -b feature/amazing-feature
npm install
.env.example
to .env
and fill valuesnpm run dev
git commit -m 'Add amazing feature'
git push origin feature/amazing-feature
MIT License - see LICENSE file for details.
π Built with modern web technologies for the future of travel planning.
Ready to create amazing travel experiences? Get started with the setup guide above! βοΈ