A full-stack web application that generates personalized travel itineraries using Google Gemini AI. Users can describe their dream trip, upload an inspiration image, and receive a structured itinerary in JSON format.
- Modern UI: Responsive React + TypeScript frontend with Tailwind CSS
- AI-Powered: Backend powered by Google Gemini AI with FastAPI
- Structured Data: Strongly typed JSON itinerary responses
- Image Support: Upload inspiration images for mood-based trip planning
- Customizable: Filter trips by budget, duration, and trip type
- Real AI Integration: Uses Google Gemini for generating realistic travel itineraries
- Email + OTP Authentication: Secure login system with email verification via EmailJS
agentic-travel-planner/
├── backend/
│ ├── app/
│ │ ├── routers/
│ │ │ └── auth.py
│ │ └── services/
│ │ ├── ai_planner.py
│ │ ├── otp_service.py
│ │ └── emailjs_service.py
│ ├── main.py
│ ├── schemas.py
│ └── requirements.txt
└── frontend/
├── src/
│ ├── components/
│ ├── contexts/
│ ├── services/
│ ├── types.ts
│ ├── App.tsx
│ └── main.ts
├── index.html
├── package.json
├── tsconfig.json
├── vite.config.ts
├── tailwind.config.js
└── postcss.config.js
-
Navigate to the backend directory:
cd backend -
Create a virtual environment:
python -m venv venv
-
Activate the virtual environment:
- On Windows:
venv\Scripts\activate
- On macOS/Linux:
source venv/bin/activate
- On Windows:
-
Install the required dependencies:
pip install -r requirements.txt
-
Set up your Google Gemini API key:
- Copy
.env.exampleto.env:cp .env.example .env
- Get your Gemini API key from Google AI Studio:
- Sign in with your Google account
- Click "Get API key"
- Create a new API key
- Copy the key and paste it in the
.envfile
- Copy
-
Set up EmailJS for OTP emails:
- Go to EmailJS and create an account
- Create an Email Service (Gmail, Outlook, etc.)
- Create an Email Template with variables:
to_emailotp_codeapp_name
- Copy Service ID, Public Key (Template Access Token), Template ID
- Add to backend/.env:
EMAILJS_SERVICE_ID=service_abc123 EMAILJS_PUBLIC_KEY=user_xyz789 EMAILJS_TEMPLATE_ID=template_def456
-
Run the backend server:
python main.py
The backend will be available at
http://localhost:8000
-
Navigate to the frontend directory:
cd frontend -
Install the dependencies:
npm install
-
Start the development server:
npm run dev
The frontend will be available at
http://localhost:5173
GET /health- Check if the backend is running
POST /auth/request-otp- Request OTP for email authenticationPOST /auth/verify-otp- Verify OTP and get JWT token
POST /api/generate-itinerary- Generate a travel itinerary based on user input (requires authentication)
- User enters email on the login screen
- Backend generates a 6-digit OTP and sends it via EmailJS
- User receives OTP via email
- User enters OTP in the app
- Backend verifies OTP and returns a JWT token
- Frontend stores token and allows access to the planner
Create this template in your EmailJS dashboard:
Subject: Your Agentic Travel Planner Login Code
Hi there,
Your 6-digit login code is: {{otp_code}}
This code expires in 10 minutes.
Happy trip planning!
{{app_name}}
The backend is built with FastAPI and includes:
- Pydantic models for request/response validation
- Google Gemini AI integration for generating realistic itineraries
- Email + OTP authentication system with EmailJS
- JWT token-based security
To extend the functionality:
- Modify
schemas.pyto update data models - Enhance
app/services/ai_planner.pyto improve itinerary generation logic - Add new endpoints in
main.pyas needed
The frontend is built with React, TypeScript, and Tailwind CSS:
- Responsive design that works on mobile and desktop
- Component-based architecture
- TypeScript for type safety
- Vite for fast development
- React Router for navigation
- JWT-based authentication
To extend the frontend:
- Add new components in
src/components/ - Update styling in
src/style.css - Modify API calls in
src/services/api.ts
For production deployment:
- Set the
GEMINI_API_KEYenvironment variable through your hosting platform's settings - Set the
JWT_SECRET_KEYto a strong secret key - Configure EmailJS settings:
EMAILJS_SERVICE_ID: Your EmailJS service IDEMAILJS_PUBLIC_KEY: Your EmailJS public keyEMAILJS_TEMPLATE_ID: Your EmailJS template ID
For production deployment:
- Build the frontend:
npm run build
- Serve the built files with a web server
- Deploy the backend to a Python hosting service
- Configure environment variables as needed
This project has been converted to a desktop app version that can run locally:
- Double-click on
launch-app.batto start the app - Open your browser and go to http://localhost:3000
- The app will be running locally on your computer
See APP_INSTRUCTIONS.md for more detailed instructions on using the desktop version.
This project also includes a React Native mobile app version that can be installed on Android and iOS devices:
- Navigate to the
TravelPlannerMobiledirectory - Install dependencies with
npm install - Start the app with
npm start - Scan the QR code with Expo Go on your mobile device
See TravelPlannerMobile/MOBILE_APP_README.md for more detailed instructions on using the mobile version.
note that you need to add your device IP address to the .env file for the mobile app to run
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a pull request
This project is licensed under the MIT License.