Skip to content

michaelarie96/trip-planner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

37 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ—ΊοΈ Personal Trip Planner

AI-powered route planning application for cycling and trekking adventures with real-time weather forecasts and interactive maps.

React Node.js MongoDB Tailwind CSS

✨ Features

  • πŸ€– AI-Powered Route Generation - Generate realistic routes using Google Gemini 2.5 Pro
  • 🚴 Cycling Routes - 2-day city-to-city routes (max 60km/day)
  • πŸ₯Ύ Trekking Routes - Circular hiking routes (5-15km)
  • 🌀️ Weather Forecasts - 3-day forecasts from OpenWeatherMap
  • πŸ—ΊοΈ Interactive Maps - Beautiful maps with Leaflet.js and enhanced markers
  • πŸ’Ύ Route Management - Save, view, and manage your routes
  • πŸ” Secure Authentication - JWT-based auth with bcrypt password hashing
  • πŸ“± Responsive Design - Mobile-friendly interface with Tailwind CSS
  • πŸ–ΌοΈ Country Images - Beautiful destination photos from Unsplash

πŸ› οΈ Technology Stack

Frontend

  • React 19.1.1 with Vite for fast development
  • Tailwind CSS 3.4.17 for responsive styling
  • React Leaflet 5.0.0 for interactive maps
  • Axios 1.11.0 for API communication
  • React Router DOM 7.8.0 for navigation
  • Lucide React 0.539.0 for icons

Backend

  • Node.js with Express.js 4.21.2 framework
  • MongoDB 6.18.0 with Mongoose 8.17.1 ODM
  • JWT 9.0.2 for authentication
  • bcrypt 6.0.0 for password security
  • Helmet 8.1.0 for security headers
  • CORS 2.8.5 for cross-origin requests

External APIs

  • Google Gemini 2.5 Pro - AI route generation
  • Google Places API - Location geocoding
  • OpenWeatherMap - Weather forecasts
  • Unsplash API - Country images
  • OpenRouteService - Route optimization

πŸ“‹ Prerequisites

  • Node.js (v18 or higher)
  • MongoDB (local installation or MongoDB Atlas account)
  • Git for version control
  • API Keys for external services (see API Setup)

πŸš€ Quick Start

1. Clone the Repository

git clone <repository-url>
cd trip-planner

2. Backend Setup

# Navigate to server directory
cd server

# Install dependencies
npm install

# Create environment file
cp .env.example .env

# Configure your environment variables (see Environment Variables section)
# Start the server
npm run dev

The backend will run on http://localhost:5001

3. Frontend Setup

# Navigate to client directory (from project root)
cd client

# Install dependencies
npm install

# Create environment file
cp .env.example .env.local

# Start the development server
npm run dev

The frontend will run on http://localhost:5173

βš™οΈ Environment Variables

Backend (.env)

Create a .env file in the server directory:

# Database
MONGODB_URI=mongodb://localhost:27017/trip-planner
# or MongoDB Atlas: mongodb+srv://username:password@cluster.mongodb.net/trip-planner

# JWT Secret (use a strong random string)
JWT_SECRET=your-super-secret-jwt-key-here

# Google Gemini AI
GEMINI_API_KEY=your-gemini-api-key

# Google Places API
GOOGLE_GEOCODING_API_KEY=your-google-places-api-key

# Weather API
OPENWEATHER_API_KEY=your-openweather-api-key

# Images API
UNSPLASH_API_KEY=your-unsplash-api-key

# Routing API
OPENROUTESERVICE_API_KEY=your-ors-api-key

# Environment
NODE_ENV=development
PORT=5001

Frontend (.env.local)

Create a .env.local file in the client directory:

# API Base URL
VITE_API_URL=http://localhost:5001/api

πŸ”‘ API Setup

Google Gemini AI

  1. Visit Google AI Studio
  2. Create an API key
  3. Add to GEMINI_API_KEY in your .env file

Google Places API

  1. Go to Google Cloud Console
  2. Enable Places API
  3. Create credentials
  4. Add to GOOGLE_GEOCODING_API_KEY

OpenWeatherMap

  1. Sign up at OpenWeatherMap
  2. Get your free API key
  3. Add to OPENWEATHER_API_KEY

Unsplash API

  1. Create account at Unsplash Developers
  2. Create a new application
  3. Add to UNSPLASH_API_KEY

OpenRouteService

  1. Register at OpenRouteService
  2. Get API key
  3. Add to OPENROUTESERVICE_API_KEY

πŸ“Š Database Setup

Local MongoDB

# Install MongoDB locally
# macOS with Homebrew
brew tap mongodb/brew
brew install mongodb-community

# Start MongoDB service
brew services start mongodb/brew/mongodb-community

MongoDB Atlas (Cloud)

  1. Create account at MongoDB Atlas
  2. Create a new cluster
  3. Get connection string
  4. Update MONGODB_URI in .env

🎯 Usage Guide

1. Registration & Login

  • Create a new account or sign in
  • JWT tokens handle secure authentication

2. Plan a Route

  • Choose destination (country/city)
  • Select trip type:
    • Cycling: 2-day routes, max 60km/day
    • Trekking: Circular routes, 5-15km
  • AI generates realistic routes with actual locations

3. View Route Details

  • Interactive map with enhanced markers
  • 3-day weather forecast
  • Route statistics and waypoints
  • Save routes for future reference

4. Manage Routes

  • View saved routes in history
  • Filter by trip type
  • Search by location
  • Delete unwanted routes

πŸ“ Project Structure

trip-planner/
β”œβ”€β”€ client/                 # React frontend
β”‚   β”œβ”€β”€ public/            # Static assets
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/    # Reusable components
β”‚   β”‚   β”‚   β”œβ”€β”€ auth/      # Authentication components
β”‚   β”‚   β”‚   β”œβ”€β”€ layout/    # Layout components
β”‚   β”‚   β”‚   β”œβ”€β”€ route/     # Route-related components
β”‚   β”‚   β”‚   └── weather/   # Weather components
β”‚   β”‚   β”œβ”€β”€ contexts/      # React contexts
β”‚   β”‚   β”œβ”€β”€ hooks/         # Custom hooks
β”‚   β”‚   β”œβ”€β”€ pages/         # Page components
β”‚   β”‚   β”œβ”€β”€ providers/     # Context providers
β”‚   β”‚   β”œβ”€β”€ services/      # API services
β”‚   β”‚   └── index.css      # Global styles
β”‚   β”œβ”€β”€ package.json
β”‚   └── tailwind.config.js
β”œβ”€β”€ server/                # Express backend
β”‚   β”œβ”€β”€ config/           # Database configuration
β”‚   β”œβ”€β”€ middleware/       # Custom middleware
β”‚   β”œβ”€β”€ models/           # Mongoose models
β”‚   β”œβ”€β”€ routes/           # API routes
β”‚   β”œβ”€β”€ services/         # Business logic services
β”‚   β”œβ”€β”€ package.json
β”‚   └── server.js         # Entry point
β”œβ”€β”€ README.md
└── .gitignore

πŸš€ API Endpoints

Authentication

  • POST /api/auth/register - User registration
  • POST /api/auth/login - User login
  • GET /api/auth/verify - Token verification

Routes

  • POST /api/routes/generate - Generate new route
  • POST /api/routes/save - Save route
  • GET /api/routes/user - Get user routes
  • GET /api/routes/:id - Get specific route
  • DELETE /api/routes/:id - Delete route

Weather

  • GET /api/weather/forecast/:location - 3-day forecast
  • GET /api/weather/route/:routeId - Weather for saved route

Images

  • GET /api/images/country/:country - Get country image

πŸ“„ License

This project is licensed under the MIT License.

🀝 Contributing

  1. Fork the repository
  2. Create your 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

Built by Michael Arie using React, Node.js, and AI

About

Personal Trip Planner - Full-stack web application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •