# seanmorley15/adventurelog architecture

> Architecture diagram of the GitHub repository seanmorley15/adventurelog, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/seanmorley15/adventurelog
- Repository: https://github.com/seanmorley15/adventurelog

## Overview

##### Project type and purpose
- AdventureLog is a full-stack, open-source travel companion web application.
- Frontend: SvelteKit SPA with TailwindCSS and DaisyUI, uses Svelte MapLibre for maps.
- Backend: Django monolith (Django REST Framework, AllAuth, PostGIS) serving a REST API and server-rendered templates.
- Auxiliary “cdn” service to serve static assets and cache.

##### File structure
- Top-level directories:
- frontend/ – SvelteKit code, routes, components, build config, Dockerfile.
- backend/ – Django project, apps (adventures, achievements, integrations, users, worldtravel), Dockerfile, Nginx config, entrypoint.
- cdn/ – Python microservice (simple HTTP server + Nginx) for static files, Dockerfile.
- documentation/, brand/, .github/, tooling (docker-compose, Traefik kustomization).
- Deployment files: docker-compose.yml, docker-compose-traefik.yaml, kustomization.yml, GitHub Actions workflows for CI/CD.
- Configuration: .env.example files for frontend and backend; supervisord for process management; build scripts.

##### README
- Tech stack calls out SvelteKit, TailwindCSS, DaisyUI on client; Django + DRF + PostGIS + AllAuth on server.
- Features: logging adventures, map view, itineraries, sharing, world travel book.

##### Components
a. Client tier
- Web browser / mobile web → SvelteKit SPA
- Optional: Service Worker for offline caching
b. CDN tier
- Static assets (CSS, JS bundles, images, fonts) served by cdn/ service (Nginx + Python)
c. API & Web tier
- Traefik (or Docker-Compose reverse proxy) routes requests:
– /api/* → Django REST API (Gunicorn)
– /static/* → CDN service
– /* → SvelteKit SSR (via adapter in frontend) or direct SPA assets
- Nginx (inside backend container) fronts Gunicorn processes
- Django apps (adventures, users, integrations, worldtravel, achievements)
d. Data tier
- PostgreSQL with PostGIS extension (persistent data store)
- (Optional) Redis or in-memory cache if used for sessions / rate-limiting
e. External services
- OAuth providers via AllAuth (GitHub, OIDC, etc.)
- Email/SMS service for verification and notifications
- Tile provider (if MapLibre requires external tiles)
- Immich integration (optional photo storage)

##### Relationships & data flow
- User interacts with SvelteKit UI → HTTP(S) calls → Traefik → backend API → Django views/serializers → ORM queries Postgres → response → UI updates.
- Static asset fetches go → Traefik → CDN service → browser cache.
- Social login flows: backend ↔ external OAuth endpoint → callback to AllAuth in Django.
- Tiles: client direct to tile server or proxied through backend.

##### Architectural patterns & principles
- Monolithic service broken into Django “apps” (modular MVC pattern).
- Clear frontend-backend separation via REST API.
- Infrastructure as code with Docker Compose + Traefik + Kubernetes kustomization.
- CI/CD pipelines in GitHub Actions for each component.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    subgraph "Client Layer"
        direction TB
        Browser["Web Browser / Mobile Web"]:::client
        SW["Service Worker"]:::client
        SPA["SvelteKit SPA"]:::service
    end

    %% CDN Layer
    subgraph "CDN Layer"
        direction TB
        CDN["CDN Service\n(Nginx + Python HTTP)"]:::service
    end

    %% API & Web Layer
    subgraph "API & Web Layer"
        direction TB
        Traefik["Traefik Reverse Proxy"]:::service
        subgraph "Backend Container"
            direction TB
            Nginx["Nginx"]:::service
            Gunicorn["Gunicorn"]:::service
            subgraph "Django Monolith"
                direction TB
                DRF["Django REST Framework"]:::service
                subgraph "Apps"
                    direction TB
                    Adventures["Adventures App"]:::service
                    Achievements["Achievements App"]:::service
                    Integrations["Integrations App"]:::service
                    Users["Users App (AllAuth)"]:::service
                    WorldTravel["WorldTravel App"]:::service
                end
            end
        end
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        Postgres["PostgreSQL + PostGIS"]:::data
        Redis["Redis (optional)"]:::data
    end

    %% External Services
    subgraph "External Services"
        direction TB
        OAuth["OAuth Providers"]:::external
        EmailSMS["Email/SMS Service"]:::external
        MapTiles["Map Tile Provider"]:::external
        Immich["Immich Photo Storage (optional)"]:::external
    end

    %% Connections
    Browser -->|"Load SPA"| SPA
    Browser -->|"Offline Caching"| SW
    SPA -->|"HTTP GET /static/*"| Traefik
    SPA -->|"HTTP GET /api/*"| Traefik
    SPA -->|"SSR Requests"| Traefik

    Traefik -->|"route /static/*"| CDN
    Traefik -->|"route /api/*"| Nginx
    Traefik -->|"route /*"| CDN

    CDN -->|"Serve Assets"| Browser

    Nginx -->|"proxy_pass"| Gunicorn
    Gunicorn -->|"invoke views/serializers"| DRF
    DRF -->|"calls apps"| Adventures
    DRF -->|"calls apps"| Achievements
    DRF -->|"calls apps"| Integrations
    DRF -->|"calls apps"| Users
    DRF -->|"calls apps"| WorldTravel

    DRF -->|"SQL SELECT/INSERT"| Postgres
    DRF -->|"cache ops"| Redis

    Users -->|"OAuth token exchange"| OAuth
    DRF -->|"send emails/SMS"| EmailSMS
    SPA -->|"tile fetches"| MapTiles
    Integrations -->|"optional photo storage"| Immich

    %% Click Events
    click SPA "https://github.com/seanmorley15/adventurelog/tree/main/frontend/"
    click SW "https://github.com/seanmorley15/adventurelog/blob/main/frontend/src/service-worker/indes.ts"
    click CDN "https://github.com/seanmorley15/adventurelog/tree/main/cdn/"
    click CDN "https://github.com/seanmorley15/adventurelog/blob/main/cdn/nginx.conf"
    click CDN "https://github.com/seanmorley15/adventurelog/blob/main/cdn/entrypoint.sh"
    click CDN "https://github.com/seanmorley15/adventurelog/blob/main/cdn/main.py"
    click CDN "https://github.com/seanmorley15/adventurelog/tree/main/cdn/Dockerfile"
    click Traefik "https://github.com/seanmorley15/adventurelog/blob/main/kustomization.yml"
    click Traefik "https://github.com/seanmorley15/adventurelog/blob/main/docker-compose-traefik.yaml"
    click Traefik "https://github.com/seanmorley15/adventurelog/blob/main/docker-compose.yml"
    click Nginx "https://github.com/seanmorley15/adventurelog/blob/main/backend/nginx.conf"
    click Gunicorn "https://github.com/seanmorley15/adventurelog/blob/main/backend/entrypoint.sh"
    click Gunicorn "https://github.com/seanmorley15/adventurelog/tree/main/backend/Dockerfile"
    click DRF "https://github.com/seanmorley15/adventurelog/blob/main/backend/server/main/settings.py"
    click DRF "https://github.com/seanmorley15/adventurelog/blob/main/backend/server/main/urls.py"
    click DRF "https://github.com/seanmorley15/adventurelog/blob/main/backend/server/main/wsgi.py"
    click Adventures "https://github.com/seanmorley15/adventurelog/tree/main/backend/server/adventures/"
    click Achievements "https://github.com/seanmorley15/adventurelog/tree/main/backend/server/achievements/"
    click Integrations "https://github.com/seanmorley15/adventurelog/tree/main/backend/server/integrations/"
    click Users "https://github.com/seanmorley15/adventurelog/tree/main/backend/server/users/"
    click WorldTravel "https://github.com/seanmorley15/adventurelog/tree/main/backend/server/worldtravel/"
    click DRF "https://github.com/seanmorley15/adventurelog/blob/main/backend/supervisord.conf"
    click SPA "https://github.com/seanmorley15/adventurelog/blob/main/frontend/tailwind.config.js"
    click SPA "https://github.com/seanmorley15/adventurelog/tree/main/frontend/Dockerfile"
    click SPA "https://github.com/seanmorley15/adventurelog/blob/main/frontend/vite.config.ts"
    click SPA "https://github.com/seanmorley15/adventurelog/blob/main/frontend/svelte.config.js"
    click SPA "https://github.com/seanmorley15/adventurelog/blob/main/frontend/.env.example"
    click DRF "https://github.com/seanmorley15/adventurelog/blob/main/backend/server/.env.example"
    click CI1 "https://github.com/seanmorley15/adventurelog/blob/main/.github/workflows/frontend-*.yml"
    click CI2 "https://github.com/seanmorley15/adventurelog/blob/main/.github/workflows/backend-*.yml"
    click CI3 "https://github.com/seanmorley15/adventurelog/blob/main/.github/workflows/cdn-*.yml"
    click Dev1 "https://github.com/seanmorley15/adventurelog/blob/main/.devcontainer/devcontainer.json"
    click Dev2 "https://github.com/seanmorley15/adventurelog/blob/main/backend/.devcontainer/devcontainer.json"

    %% Styles
    classDef client fill:#D0E8FF,stroke:#333,stroke-width:1px
    classDef service fill:#D0FFD6,stroke:#333,stroke-width:1px
    classDef data fill:#FFE0A3,stroke:#333,stroke-width:1px
    classDef external fill:#E1D5FF,stroke:#333,stroke-width:1px
```
