Self-Hosting Guide
This guide will walk you through the process of setting up Chat2Geo in your local environment.
Prerequisites
Before installing Chat2Geo, ensure you have the following:
- Node.js 18.x or higher
- npm or yarn package manager
- A Google Earth Engine (GEE) account and project
- Access to Google Cloud Platform (GCP)
- A Supabase account for database and authentication
Important Note
Google Earth Engine is currently only free for non-commercial use. You will need to create a GEE account or the analysis features will not be available.
Step 1: Clone the Repository
Start by cloning the Chat2Geo repository from GitHub:
git clone https://github.com/GeoRetina/chat2geo.git
cd chat2geo
Step 2: Install Dependencies
Install all the required dependencies:
npm install
# or
yarn install
Step 3: Set Up Environment Variables
Create a .env.local
file in the root directory with the following variables:
# Base URL
BASE_URL=http://localhost:3000
# Google Cloud Platform
GOOGLE_MAPS_API_KEY=your_google_maps_api_key
VERTEXTAI_ENDPOINT_BASE_URL=your_vertexai_endpoint
GEE_CLOUD_RUN_URL=your_gee_cloud_run_url
GCP_BUCKET_NAME=your_gcp_bucket_name
GCP_SERVICE_ACCOUNT_KEY=your_gcp_service_account_key
# LLM API Key
OPENAI_API_KEY=your_openai_api_key
# Supabase
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
Make sure to replace all placeholder values with your actual credentials.
Step 4: Set Up the Database
Chat2Geo uses Supabase for database and authentication. You can set up the required database schema using the scripts in the db-schema
folder.
If you want to use the Knowledge Base feature, create a storage bucket named documents_bucket
in your Supabase project.
Step 5: Run the Development Server
Start the development server:
npm run dev
# or
yarn dev
Visit http://localhost:3000
in your browser to view the application.
Troubleshooting
Cannot Access GEE Functions
If you're having issues with Google Earth Engine functions:
- Verify your GCP Service Account has the required permissions
- Ensure your GEE project is properly set up and initialized
- Check that all environment variables are correctly configured
Authentication Issues
For Supabase authentication problems:
- Confirm your Supabase URL and anon key are correct
- Verify that authentication is enabled in your Supabase project
- Check for any CORS issues if you're running on a custom domain