# AdventureLog: Self-Hosted Travel Log and Trip Planner

> Run AdventureLog, a self-hosted travel tracker and trip planner, with its SvelteKit frontend, Django backend and a PostGIS database.

- Category: Productivity & Collaboration
- Difficulty: intermediate
- Components: web, server, postgresql
- Tags: travel, maps, trip-planner, django, sveltekit, postgis, self-hosted
- Source: https://selfhostrecipes.com/productivity/adventurelog

## Overview

AdventureLog is an open-source, GPL-3.0 licensed travel companion that lets you log places you have visited, plan future trips and keep notes, photos and locations in one place that you host yourself. Locations are shown on a map, and you can group them into collections and share them with other people.

This recipe runs the three services the project documents for Docker. The web service is the SvelteKit frontend that you open in the browser. The server service is the Django backend, which provides the API and the admin interface and stores uploaded images in a named volume. The postgresql service is a PostGIS-enabled PostgreSQL database that holds all of your data, including geographic information.

The stack starts without a .env file. Every variable has a default, and the default passwords are placeholders that you must change before you expose anything. The frontend is published on port 8015 and the backend on port 8016. Your browser talks to both, so the URL variables must match the address you use to reach them.

## Features

- Log visited and planned locations on an interactive map
- Group locations into collections and itineraries for trips
- Attach notes, links and images to locations
- Share collections with other users on the same instance
- Django admin interface for managing users and data
- Creates the first admin account from environment variables on startup
- PostGIS-backed PostgreSQL storage for location data
- Uploaded media kept in a named volume

## Use cases

- Keep a personal record of every country and city you have visited
- Plan a multi-stop road trip with notes for each stop
- Share a trip collection with friends or family travelling together
- Replace a hosted travel-journal service with data you control
- Run a private travel log for a small group on a home server

## Prerequisites

- Docker Engine with the Compose plugin installed
- Ports 8015 and 8016 free on the host
- At least 1 GB of free RAM for the three containers
- A browser that can reach both the frontend and backend ports
- Willingness to edit the URL variables if you serve it from another hostname

## docker-compose.yml

```yaml
services:
  web:
    image: ghcr.io/seanmorley15/adventurelog-frontend:latest
    restart: unless-stopped
    environment:
      PUBLIC_SERVER_URL: ${PUBLIC_SERVER_URL:-http://server:8000}
      ORIGIN: ${FRONTEND_URL:-http://localhost:8015}
      BODY_SIZE_LIMIT: ${BODY_SIZE_LIMIT:-Infinity}
    ports:
      - "${FRONTEND_PORT:-8015}:3000"
    depends_on:
      - server

  server:
    image: ghcr.io/seanmorley15/adventurelog-backend:latest
    restart: unless-stopped
    environment:
      PGHOST: postgresql
      PGDATABASE: ${POSTGRES_DB:-database}
      PGUSER: ${POSTGRES_USER:-adventure}
      PGPASSWORD: ${POSTGRES_PASSWORD:-change-me}
      SECRET_KEY: ${SECRET_KEY:-change-me-secret-key}
      DJANGO_ADMIN_USERNAME: ${DJANGO_ADMIN_USERNAME:-admin}
      DJANGO_ADMIN_PASSWORD: ${DJANGO_ADMIN_PASSWORD:-change-me-admin}
      DJANGO_ADMIN_EMAIL: ${DJANGO_ADMIN_EMAIL:-admin@localhost}
      PUBLIC_URL: ${PUBLIC_URL:-http://localhost:8016}
      CSRF_TRUSTED_ORIGINS: ${CSRF_TRUSTED_ORIGINS:-http://localhost:8016,http://localhost:8015}
      FRONTEND_URL: ${FRONTEND_URL:-http://localhost:8015}
      DEBUG: ${DEBUG:-False}
    ports:
      - "${BACKEND_PORT:-8016}:80"
    depends_on:
      postgresql:
        condition: service_healthy
    volumes:
      - adventurelog_media:/code/media/

  postgresql:
    image: postgis/postgis:16-3.5
    restart: unless-stopped
    environment:
      POSTGRES_DB: ${POSTGRES_DB:-database}
      POSTGRES_USER: ${POSTGRES_USER:-adventure}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-change-me}
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
      interval: 10s
      timeout: 5s
      retries: 10
    volumes:
      - postgres_data:/var/lib/postgresql/data/

volumes:
  postgres_data:
  adventurelog_media:
```

## .env

```bash
# All values are optional; defaults are built into the compose file.
FRONTEND_PORT=8015
BACKEND_PORT=8016
FRONTEND_URL=http://localhost:8015
PUBLIC_URL=http://localhost:8016
PUBLIC_SERVER_URL=http://server:8000
CSRF_TRUSTED_ORIGINS=http://localhost:8016,http://localhost:8015
POSTGRES_DB=database
POSTGRES_USER=adventure
POSTGRES_PASSWORD=change-me
SECRET_KEY=change-me-secret-key
DJANGO_ADMIN_USERNAME=admin
DJANGO_ADMIN_PASSWORD=change-me-admin
DJANGO_ADMIN_EMAIL=admin@localhost
DEBUG=False
```

## Usage notes

- First login: open http://localhost:8015 and sign in with the admin account created on first start (username admin, password change-me-admin unless you set DJANGO_ADMIN_USERNAME and DJANGO_ADMIN_PASSWORD).
- Change POSTGRES_PASSWORD, SECRET_KEY and DJANGO_ADMIN_PASSWORD before exposing the service to anyone else.
- The frontend is on http://localhost:8015 and the backend API and admin interface are on http://localhost:8016.
- If you serve AdventureLog from another hostname or port, update FRONTEND_URL, PUBLIC_URL and CSRF_TRUSTED_ORIGINS to match what the browser uses.
- The admin user is only created the first time the backend starts; later changes to the DJANGO_ADMIN_* variables do not alter it.
- Data lives in the postgres_data and adventurelog_media named volumes; back both up before upgrading the images.

## Troubleshooting

- Login or form submissions fail with a CSRF error: make sure CSRF_TRUSTED_ORIGINS contains the exact origin you type in the browser, including the port.
- Images or links point to the wrong address: set PUBLIC_URL and FRONTEND_URL to the addresses you actually use to reach the backend and frontend.
- Backend keeps restarting with database errors: confirm POSTGRES_PASSWORD matches what the data volume was first created with; if you changed it later, remove the postgres_data volume (this deletes data) or change the password inside PostgreSQL.
- Frontend shows a server error on load: check that the server container is running with docker compose logs server, and that PUBLIC_SERVER_URL still points to the server service on port 8000.
- Cannot log in as admin after changing DJANGO_ADMIN_PASSWORD: the admin user is only created on first start, so change the password in the Django admin interface instead.
- Uploaded images disappear after recreating containers: keep the adventurelog_media volume and do not run docker compose down -v.

