https://github.com/amalsultanov/trip_planner
AI based Flask travel itinerary planner
https://github.com/amalsultanov/trip_planner
ai docker docker-compose flask gemini python python3 sqlalchemy
Last synced: about 2 months ago
JSON representation
AI based Flask travel itinerary planner
- Host: GitHub
- URL: https://github.com/amalsultanov/trip_planner
- Owner: AmalSultanov
- Created: 2025-01-28T11:22:07.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-06-23T19:13:15.000Z (about 1 year ago)
- Last Synced: 2025-07-30T17:40:38.854Z (11 months ago)
- Topics: ai, docker, docker-compose, flask, gemini, python, python3, sqlalchemy
- Language: Python
- Homepage:
- Size: 66.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AI-Powered Travel Itinerary Planner
## Overview
The **AI-Powered Travel Itinerary Planner** is a Flask-based web application that generates personalized travel plans using AI. Users can enter trip details, and the system suggests an itinerary, which can be viewed and downloaded as a PDF.
## Features
- AI-powered travel plan generation
- User authentication using JWT tokens
- Plan storage and retrieval from the database
- PDF download for travel plans
- Docker support for containerized deployment
## Installation
### Prerequisites
- Python 3.10+
- Docker
- Docker Compose
- A valid API key from [Google Gemini API](https://ai.google.dev/gemini-api/docs/api-key)
- A registered account on [GeoNames](https://www.geonames.org) to obtain a username
### Steps
1. **Clone the Repository:**
```bash
git clone https://github.com/AmalSultanov/trip_planner.git
cd trip_planner
```
2. **Set Up Environment Variables:**
- Copy the example environment file:
```bash
cp .env.example .env
```
- Open the `.env` file and fill in the required values:
```ini
GEONAMES_USERNAME=
API_KEY=
FLASK_SECRET_KEY=
POSTGRES_DB=
POSTGRES_USER=
POSTGRES_PASSWORD=
POSTGRES_HOST=
POSTGRES_PORT=
SQL_DATABASE_URI=
FLASK_JWT_SECRET_KEY=
FLASK_JWT_ACCESS_TOKEN_MINUTES=
FLASK_JWT_REFRESH_TOKEN_DAYS=
FLASK_JWT_TOKEN_LOCATION=
```
- Visit [GeoNames](https://www.geonames.org) to register and obtain your username, which will be the value for `GEONAMES_USERNAME`.
- Visit [Google Gemini API](https://ai.google.dev/gemini-api/docs/api-key) to get your API Key, which will be the value for `API_KEY`.
- The values for `FLASK_SECRET_KEY` and `FLASK_JWT_SECRET_KEY` can be generated using `secrets.token_hex([nbytes=None])`.
- The value for `SQL_DATABASE_URI` should be in the format:
```
postgresql://user:password@host:port/db_name
```
- Values for `FLASK_JWT_ACCESS_TOKEN_MINUTES` and `FLASK_JWT_REFRESH_TOKEN_DAYS` should be numeric.
3. **Run the Application with Docker Compose:**
```bash
docker compose up --build
```
The app will be available at **[http://127.0.0.1:5001/](http://localhost:5001/)**.
**Or, install manually:**
If you prefer to run the application without Docker, follow these steps:
- **Create a Virtual Environment:**
```bash
python3 -m venv venv
```
- **Activate the Virtual Environment:**
- On Windows:
```bash
venv\Scripts\activate
```
- On macOS/Linux:
```bash
source venv/bin/activate
```
- **Install Dependencies:**
```bash
pip install -r requirements.txt
```
- **Start Your Local PostgreSQL Server**
- **Run the Application:**
```bash
flask run
```
The app will be available at **[http://127.0.0.1:5000/](http://localhost:5000/)**.
## API Endpoints
| Method | Endpoint | Description |
|--------|------------------------|----------------------------|
| `GET` | `/` | Home page |
| `POST` | `/plans` | Generate a new travel plan |
| `GET` | `/plans//download` | Download plan as PDF |
| `POST` | `/login` | User login |
| `POST` | `/register` | User registration |
| `GET` | `/logout` | User logout |
## Contributing
Contributions are welcome! Feel free to fork this repository and submit a pull request.