## File: README.md

# 🌍 Dawarich: Your Self-Hostable Location History Tracker

[](https://discord.gg/pHsBjpt5J8) | [](https://ko-fi.com/H2H3IDYDD) | [](https://www.patreon.com/freika) | [](https://app.instapods.com/dashboard/pods/create?app=dawarich&ref=dawarich)

---

## Screenshots


*Map View*


*Timeline View*


*Insights Page*


*Family Page*


*Statistics Overview*


*Trips page*

---

## About Dawarich

If you're looking for Dawarich Cloud, where everything is managed for you, check out [Dawarich Cloud](https://dawarich.app).

**Dawarich** is a self-hostable web app designed to replace Google Timeline (aka Google Location History).
It enables you to:

- Track your location history.
- Visualize your data on an interactive map.
- Create trips and analyze your travel history.
- Share your location with family members.
- Integrate with photo management apps like Immich and Photoprism to visualize geotagged photos.
- Import your location history from Google Maps Timeline, OwnTracks, GPX, GeoJSON and some other sources
- Explore statistics like the number of countries and cities visited, total distance traveled, and more!
- Share your location with family members.

**Changelog**: Find the latest updates [here](CHANGELOG.md).

**Contribute**: See [CONTRIBUTING.md](CONTRIBUTING.md) for how to contribute to Dawarich.
---

## ⚠️ Disclaimer

### Updating strategy

- **DO NOT UPDATE AUTOMATICALLY**: Read release notes before updating. Automatic updates may break your setup.
- **Under active development**: Expect frequent updates, bugs, and breaking changes.
- **Do not delete your original data** after importing into Dawarich.
- **Backup before updates**: Always [backup your data](https://dawarich.app/docs/tutorials/backup-and-restore) before upgrading.
- **Stay up-to-date**: Make sure you're running the latest version for the best experience.

---

## 🧭 Supported Location Tracking

You can track your location with the following apps:

- 💫 [Dawarich for iOS](https://dawarich.app/docs/dawarich-for-ios/)
- 🤖 [Dawarich for Android](https://dawarich.app/docs/dawarich-for-android/)
- 🗺️ [Dawarich Community](https://github.com/sunstep/dawarich-android) (Android)
- 🌍 [Overland](https://dawarich.app/docs/tutorials/track-your-location#overland)
- 🛰️ [OwnTracks](https://dawarich.app/docs/tutorials/track-your-location#owntracks)
- 🧭 [GPSLogger](https://dawarich.app/docs/tutorials/track-your-location#gps-logger)
- 📱 [PhoneTrack](https://dawarich.app/docs/tutorials/track-your-location#phonetrack)
- 🏡 [Home Assistant](https://dawarich.app/docs/tutorials/track-your-location#home-assistant)

Simply install one of the supported apps on your device and configure it to send location updates to your Dawarich instance.

---

## How to Start Dawarich Locally

1. Clone the repository.
2. Run the following command to start the app:
   ```bash
   docker compose -f docker/docker-compose.yml up
   ```
3. Access the app at `http://localhost:3000`.

**To stop the app**, press `Ctrl+C`.

You can use default values or create a `.env` file based on `.env.example` to customize your setup.

---

## How to Install Dawarich

- **[Docker Setup](https://dawarich.app/docs/intro#setup-your-dawarich-instance)**
- **[Synology](https://dawarich.app/docs/tutorials/platforms/synology)**

**Default Credentials**
- **Username**: `demo@dawarich.app`
- **Password**: `safepassword`
Feel free to change them in the account settings.

---

## Features

### Location Tracking
- Track your live location using one of the [supported apps](#-supported-location-tracking).

### Location History Visualization
- View your historical data on a map with customizable layers:
  - Heatmap
  - Points
  - Lines between points
  - Fog of War

### Family Sharing
- Share your location with family members.
- View locations of family members on the map (with their consent).
- Each family member can enable or disable location sharing individually.

### Areas
- Draw areas on the map so Dawarich could suggest your visits there.

### Visits (Beta)
- Dawarich can suggest places you've visited and allow you to confirm or reject them.

### Statistics
- Analyze your travel history: number of countries/cities visited, distance traveled, and time spent, broken down by year and month.

### Insights

- Get insights about your location history, like "Your most visited place is home, with 120 visits", or "You spent 30 days in Paris in 2024".

### Days in country

- See how many days you've spent in each country. Useful for tax residency purposes or just to see where you spend most of your time.

### Trips
- Create a trip to visualize your travels between two points in time. You'll be able to see the route, distance, and time spent, and also add notes to your trip. If you have Immich or Photoprism integration, you'll also be able to see photos from your trips!

### Integrations
- Provide credentials for Immich or Photoprism (or both!) and Dawarich will automatically import geodata from your photos.
- You'll also be able to visualize your photos on the map!

### Import Your Data
- Import from various sources:
  - Google Maps Timeline
  - OwnTracks
  - Strava
  - Immich
  - GPX/GeoJSON files
  - Photos’ EXIF data

### Export Your Data
- Export your data to GeoJSON or GPX formats.

---

## 📚 Guides and Tutorials

- [Set up Reverse Proxy](https://dawarich.app/docs/tutorials/reverse-proxy)
- [Import Google Takeout](https://dawarich.app/docs/tutorials/import-existing-data#sources-of-data)
- [Track Location with Overland](https://dawarich.app/docs/tutorials/track-your-location#overland)
- [Track Location with OwnTracks](https://dawarich.app/docs/tutorials/track-your-location#owntracks)
- [Export Your Data](https://dawarich.app/docs/tutorials/export-your-data)

More guides available in the [Docs](https://dawarich.app/docs/intro).

---

## Environment Variables

Check the documentation on the [website](https://dawarich.app/docs/environment-variables-and-settings) for detailed information about environment variables and settings.

---

## Star History

As you could probably guess, I like statistics.

<a href="https://star-history.com/#Freika/dawarich&Date">
 
   
   
   
 
</a>

---

## File: docs/How_to_extract_geodata_from_photos.md

**User Guide: Importing GPS Coordinates from your photos into Dawarich**

Introduction:
This user guide provides step-by-step instructions on how to extract GPS coordinates from photos and import it into the Dawarich service.
This process is useful for adding points of interest from memorable locations into Dawarich, especially when Google Location History is unavailable or was not initially enabled.

Requirements:
- Mac OS operating system
- exiftool software installed
- exiftool template created

Steps to Import GPS Coordinates into Dawarich:

1. Download and install exiftool from the [official website](https://exiftool.org/).
2. Create an empty template text file, name it as `gpx.fmt` and paste the code provided below into it.
```
#------------------------------------------------------------------------------
# File:         gpx.fmt
#
#
# Usage:        exiftool -p gpx.fmt -ee3 FILE [...] > out.gpx
#
# Requires:     ExifTool version 10.49 or later
#
# Revisions:    2010/02/05 - P. Harvey created
#               2018/01/04 - PH Added IF to be sure position exists
#               2018/01/06 - PH Use DateFmt function instead of -d option
#               2019/10/24 - PH Preserve sub-seconds in GPSDateTime value
#
# Notes:     1) Input file(s) must contain GPSLatitude and GPSLongitude.
#            2) The -ee3 option is to extract the full track from video files.
#            3) The -fileOrder option may be used to control the order of the
#               generated track points when processing multiple files.
#------------------------------------------------------------------------------
#[HEAD]<?xml version="1.0" encoding="utf-8"?>
#[HEAD]<gpx version="1.0"
#[HEAD] creator="ExifTool $ExifToolVersion"
#[HEAD] xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
#[HEAD] xmlns="http://www.topografix.com/GPX/1/0"
#[HEAD] xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
#[HEAD]
#[HEAD]<number>1</number>
#[HEAD]
#[IF]  $gpslatitude $gpslongitude
#[BODY]
#[BODY]  <ele>$gpsaltitude#</ele>
#[BODY]  <time>${gpsdatetime#;my ($ss)=/\.\d+/g;DateFmt("%Y-%m-%dT%H:%M:%SZ");s/Z/${ss}Z/ if $ss}</time>
#[BODY]
#[TAIL]
#[TAIL]
#[TAIL]</gpx>
```
3. Create a separate directory for the photos from which you want to extract coordinates.
4. Move the necessary photos and `gpx.fmt` template to this directory.
5. Open Terminal and navigate to the directory containing the photos.

Command to Execute:
```
exiftool -if '$gpsdatetime' -fileOrder gpsdatetime -p ./gpx.fmt -d %Y-%m-%dT%H:%M:%SZ *JPG > output.gpx
```

Note: Ensure that exiftool is properly installed on your system, and the file 'gpx.fmt' is located in the same directory as the photos.

6. GPX-track based on photo's GPS-coordinates and dates will be placed as `output.gpx` file into the same directory.
7. Go to Dawarich webpage, select Imports, click "New Import" button, select source — gpx and choose `output.gpx` file.
8. After the import processed all GPX-points will be added to Dawarich map.

---

## File: docs/How_to_install_Dawarich_in_k8s.md

# How to install Dawarich on Kubernetes

> An **unofficial Helm chart** is available [here](https://github.com/Cogitri/charts/tree/master/charts/dawarich). For a manual installation using YAML manifests, see below.

## Prerequisites

- Kubernetes cluster and basic kubectl knowledge.
- Some persistent storage class prepared, in this example, Longhorn.
- Working Postgres and Redis instances. In this example Postgres lives in 'db' namespace and Redis in 'redis' namespace.
- Ngingx ingress controller with Letsencrypt integeation.
- This example uses 'example.com' as a domain name, you want to change it to your own.
- This will work on IPv4 and IPv6 Single Stack clusters, as well as Dual Stack deployments.

## Installation

### Namespace

```bash
kubectl create namespace dawarich
```

### Persistent volume claims

```yaml
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  namespace: dawarich
  name: public
  labels:
    storage.k8s.io/name: longhorn
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: longhorn
  resources:
    requests:
      storage: 1Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  namespace: dawarich
  name: watched
  labels:
    storage.k8s.io/name: longhorn
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: longhorn
  resources:
    requests:
      storage: 1Gi
```

### Deployment

```
/* Detailed source-code truncated for AI context efficiency. */
```

### Service and Ingress

```yaml
---
apiVersion: v1
kind: Service
metadata:
  namespace: dawarich
  labels:
    service: dawarich
  name: dawarich
spec:
  ports:
    - protocol: TCP
      port: 3000
      targetPort: 3000
  selector:
    app: dawarich
---
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  namespace: dawarich
  name: dawarich-ingress
  annotations:
    kubernetes.io/ingress.class: "nginx"
    cert-manager.io/cluster-issuer: letsencrypt-prod
    nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/proxy-body-size: 1000m
spec:
  tls:
    - hosts:
        - dawarich.example.com
      secretName: letsencrypt-prod
  rules:
    - host: dawarich.example.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: dawarich
                port:
                  number: 3000
```

---

## File: docs/How_to_install_Dawarich_on_Synology.md

# How to install Dawarich on Synology using Docker

# Preparation

## Container manager
Firstly you need to install [Container manager](https://www.synology.com/en-global/dsm/feature/container-manager) on your DSM.

- Open Synology DSM web UI.
- In the main menu open **Package Center**.
- Search **Container Manager** in the "open source" section.
- Install that.

## Web station
Do the same for [Web station](https://www.synology.com/en-global/dsm/packages/WebStation) packet.

## Project folder preparation

### Docker root share
If you don't yet have separate share for docker projects would be good to create it.

If you don't want to use dedicated share for projects installed by docker skip it and go to the next chapter.

- Open **Control panel** -> **Shared folder** -> **Create** -> **Create shared folder**
- Set name, for example **docker**, and location.
- Check **Hide this shared folder in "My Network Places"**. This hides this folder from listening by smb, afp, ftp shares.
- Click **Next** several times until you see **Configure user permissions** window.
- Check **Read/write** access for your user and **No Access** for all another.

### Dawarich root folder
1. Open your [Docker root folder](#docker-root-share) in **File station**.
2. Create new folder **dawarich** and open it.
3. Create folders **redis**, **db_data**, **db_shared** and **public** in **dawarich** folder.
4. Copy [docker compose](synology/docker-compose.yml) and [.env](synology/.env) files form **synology** repo folder into **dawarich** folder on your synology.

# Installation

## Project create
1. Open **Container Manager** -> **Projects** -> **Create**
2. In **create project window**.
   1. Set **project name** as you wish.
   2. Set **path** to [Dawarich root folder](#dawarich-root-folder).
      1. DSM asks about existed docker-compose file, choose **use existing a docker-compose.yml to create the project**.
   3. Click **Next**.
   4. Check **Set up web portal via Web Station**.
      1. Select container name, port, and **http** protocol (not https).
   5. Click "Next".
   6. Uncheck **Start the project once it is created**.
   7. Click "Done".
3. In the popup "dawarich has been created. Go to Web Station to configure the web portal for the container." click "OK". **Web station** Portal Creation Wizard will be opened.
4. Set **portal type** to  **Name-based**.
5. Set **hostname** as your wish. For example, if your DSM has hostname **my-syno.com**, you can use **dawarich.my-syno.com**.
6. Check **HTTPS settings - HSTS**
   >I expected that you have configured the certificate in DSM. See **Control panel** -> **Security** -> **Certificate**. For example, previously you configured **QuickConnect** or **DynDNS** (DDNS). See **Control panel** -> **External Access**
7. Click **Create**.

## Configuration
### DNS
On your local DNS server, you need to add new record with `dawarich.my-syno.com` and IP address of Synology (see **Control panel** -> **Network** -> **Network Interface** in your DSM) to provide correct access to Dawarich, or just use wildcard `*.my-syno.com` record to resolve all subdomains `my-syno.com` to Synology ip.

Please read the documentation of your DNS server to understand how to do it.

If you don't yet have a DNS server you can install [Synology DNS](https://www.synology.com/en-global/dsm/packages/DNSServer).
>Don't forget to reconfigure your DHCP server or all device settings in your local network to use this DNS server.

### Dawarich
1. Open /[Docker root folder](#docker-root-share)/[Dawarich root folder](#dawarich-root-folder)/.env file in any text editor. For example, you can use [Text editor](https://www.synology.com/en-global/dsm/packages/TextEditor) package or download it from **File station**, edit locally and upload it back, or get access by file share.
2. Update your `APPLICATION_HOSTS` value to include your **Dawarich hostname** that you set in **Web station**. In example above **dawarich.my-syno.com**. If you want to set multiple hosts, separate them by a comma: `dawarich.my-syno.com,dawarich2.my-syno.com`.
3. Set your current `TIME_ZONE`. The full list [here](https://github.com/Freika/dawarich/issues/27#issuecomment-2094721396).
4. Optionally change `DATABASE_USERNAME`, `DATABASE_USERNAME`, `DATABASE_NAME`.

5. Click on the name of your project.
6. Open **YAML Configurations** tab.

# Run
1. Open  **Container Manager** -> **Projects** ->**dawarich**
2. In the top right corner click **Action** -> **Build**
3. Wait until the popup writes that all is done and wait a few minutes more until all apps in containers start.
4. Open it by your hostname. In this example https://dawarich.my-syno.com

# Link in the Main menu
There are two possible options:
1. With **Web station**. But you will have the default web station icon.
2. With custom application for **Package Center**.
## Web station
- Open **Web station** -> **Web Portal** -> **dawarich (project)**.
- Check **Create shortcut on main menu** and set link name.

## Custom application
Synology allows you to create custom applications and install them by **Package Center**
[Here](https://github.com/vletroye/Mods) you can find a tool that creates dummy applications only with icon on the main menu.
You can use this tool and create your own app, or use the prepared one in this repo. But you need to change url to Dawarich inside it.

- Edit `update.sh` from `synology` folder. And in the first lines set correct values for `author` and `URL`.
- Run  `update.sh`. When the script finishes you will see the `spk` and `Dawarich.spk` in the same folder.

If you don't have Linux console you can create a temporal docker project to generate spk package.
- Create a new folder in [Docker root folder](#docker-root-share).
- Create subfolder `app` and  copy `update.sh` and `spk.tgz` into this subfolder.
- Open **Container Manager** -> **Projects** -> **Create**.
- Set any name, set a newly created folder, and set **Create docker-compose.yml**.
- Copy the text below to the text field.
```yaml
name: spk-template

services:
  spk-template:
    container_name: spk-template
    image: alpine
    restart: unless-stopped
    working_dir: /app
    volumes:
      - ./app:/app
    command:
      - /app/update.sh
```
- Click **Next**, **Next**, **Done**
The container should run and finish automatically.
- After that you can see `spk` and `Dawarich.spk` in the `app` folder.


- Check `url` in `spk/package/ui/config` file and `maintainer` and `distributor` in `spk/INFO` file.
- Open **Package Center**, click on **Manual Install**, select `Dawarich.spk`, agree with the security notice, and install it.

---

## File: docs/How_to_install_Dawarich_using_Docker.md

# How to install Dawarich using Docker

> To do that you need previously install [Docker](https://docs.docker.com/get-docker/) on your system.

To quick Dawarich install copy the contents of the `docker-compose.yml` file from project root folder to dedicated folder in your server and run `docker compose up` in this folder.

This command use [docker-compose.yml](../docker-compose.yml) to build your local environment.

When this command done successfully and all services in containers will start you can open Dawarich web UI by this link [http://127.0.0.1:3000](http://127.0.0.1:3000).

Default credentials for first login in are `demo@dawarich.app` and `safepassword`.

---

## File: docs/how_to_setup_reverse_proxy.md

## Setting up reverse proxy

### Environment Variable
To make Dawarich work with a reverse proxy, you need to ensure the APPLICATION_HOSTS environment variable is set to include the domain name that the reverse proxy will use.
For example, if your Dawarich instance is supposed to be on the domain name timeline.mydomain.com, then include "timeline.mydomain.com" in this environment variable.
Make sure to exclude "http://" or "https://" from the environment variable. ⚠️ The webpage will not work if you do include http:// or https:// in the variable. ⚠️

At the time of writing this, the way to set the environment variable is to edit the docker-compose.yml file. Find all APPLICATION_HOSTS entries in the docker-compose.yml file and make sure to include your domain name. Example:

```yaml
dawarich_app:
    image: freikin/dawarich:latest
    container_name: dawarich_app
    ...
    environment:
      ...
      APPLICATION_HOSTS: "yourhost.com,www.yourhost.com,127.0.0.1" <-- Edit this
```

```yaml
dawarich_sidekiq:
    image: freikin/dawarich:latest
    container_name: dawarich_sidekiq
    ...
    environment:
      ...
      APPLICATION_HOSTS: "yourhost.com,www.yourhost.com,127.0.0.1" <-- Edit this
      ...
```

For a Synology install, refer to **[Synology Install Tutorial](How_to_install_Dawarich_on_Synology.md)**. In this page, it is explained how to set the APPLICATION_HOSTS environment variable.

### Virtual Host

Now that the app works with a domain name, the server needs to be set up to use a reverse proxy. Usually, this is done by setting it up in the virtual host configuration.

Below are examples of reverse proxy configurations.

### Nginx
```nginx
server {

	listen 80;
	listen [::]:80;
	server_name example.com;

	brotli on;
	brotli_comp_level 6;
	brotli_types
		text/css
		text/plain
		text/xml
		text/x-component
		text/javascript
		application/x-javascript
		application/javascript
		application/json
		application/manifest+json
		application/vnd.api+json
		application/xml
		application/xhtml+xml
		application/rss+xml
		application/atom+xml
		application/vnd.ms-fontobject
		application/x-font-ttf
		application/x-font-opentype
		application/x-font-truetype
		image/svg+xml
		image/x-icon
		image/vnd.microsoft.icon
		font/ttf
		font/eot
		font/otf
		font/opentype;

	location / {
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header X-Forwarded-Proto https;
		proxy_set_header X-Forwarded-Server $host;
		proxy_set_header Host $http_host;
		proxy_redirect off;

		proxy_pass http://127.0.0.1:3000/;
	}

}

```

### Apache2

For Apache2, you might need to enable some modules. Start by entering the following commands so the example configuration below works without any problems.

```
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod headers
sudo a2enmod brotli
```

With the above commands entered, the configuration below should work properly.

```apache
<VirtualHost *:80>
	ServerName example.com

	ProxyRequests Off
	ProxyPreserveHost On

	
		Require all granted
	

	Header always set X-Real-IP %{REMOTE_ADDR}s
	Header always set X-Forwarded-For %{REMOTE_ADDR}s
	Header always set X-Forwarded-Proto https
	Header always set X-Forwarded-Server %{SERVER_NAME}s
	Header always set Host %{HTTP_HOST}s

	SetOutputFilter BROTLI
	AddOutputFilterByType BROTLI_COMPRESS text/css text/plain text/xml text/javascript application/javascript application/json application/manifest+json application/vnd.api+json application/xml application/xhtml+xml application/rss+xml application/atom+xml application/vnd.ms-fontobject application/x-font-ttf application/x-font-opentype application/x-font-truetype image/svg+xml image/x-icon image/vnd.microsoft.icon font/ttf font/eot font/otf font/opentype
	BrotliCompressionQuality 6

	ProxyPass / http://127.0.0.1:3000/
	ProxyPassReverse / http://127.0.0.1:3000/

</VirtualHost>
```

### Caddy
Here is the minimum Caddy config you will need to front Dawarich with.  Please keep in mind that if you are running Caddy separately from your Dawarich stack, you'll need to have a network that is shared between them.

First, create the Docker network that will be used between the stacks, if needed:
```
docker network create frontend
```

Second, create a Docker network for Dawarich to use as the backend network:
```
docker network create dawarich
```

Adjust the following part of your Dawarich docker-compose.yaml, so that the web app is exposed to your new network and the backend Dawarich network:
```yaml
networks:
  dawarich:
  frontend:
    external: true
services:
  ...
```

Lastly, edit your Caddy config as needed:
```caddy
{
	http_port 80
	https_port 443
}

timeline.example.com {
	reverse_proxy dawarich_app:3000

	encode brotli {
		match {
			content_type text/css text/plain text/xml text/x-component text/javascript application/x-javascript application/javascript application/json application/manifest+json application/vnd.api+json application/xml application/xhtml+xml application/rss+xml application/atom+xml application/vnd.ms-fontobject application/x-font-ttf application/x-font-opentype application/x-font-truetype image/svg+xml image/x-icon image/vnd.microsoft.icon font/ttf font/eot font/otf font/opentype
		}
	}
}

```
timeline.example.com is an example, use your own (sub) domain.

---

Please note that the above configurations are just examples and that they contain the minimum configuration needed to make the reverse proxy work properly. Feel free to adjust the configuration to your own needs.