An open-source project to create a map of safe spaces for people in need.
We provide docker images that are ready to deploy SafeHaven. You can find the releases in the packages view of the SafeHavenMaps organisation.
- A PostgreSQL server with PostGIS
Create a database:
CREATE DATABASE safehaven;SafeHaven leverages PostgreSQL's full text search capabilities. You can help the indexer by setting a locale on the database:
ALTER DATABASE safehaven SET default_text_search_config = 'pg_catalog.french';SafeHaven is initialized with a default user named admin with a random password, which can be retrieved from backend logs.
The administration panel will provide you with the ability to create new users and manage the application.
To learn more about the configuration, you can visit our documentation website.
docker run -d \
-e SH__DATABASE__URL="postgresql://user:password@host/safehaven" \ # Set the database path
-e SH__DATABASE__POOL_SIZE="5" \ # Set the number of connections to the database
-e SH__SECURE_COOKIE="true" \ # Activate if you have a reverse proxy with HTTPS.
-e SH__TOKEN_SECRET="SecretForValidatingAngSigningTokens" \ # Set a secret that will be used to sign sessions
ghcr.io/safehavenmaps/safehaven:1.0.0 # Change latest to the latest version, check the releasesWe welcome contributions from everyone.
To spin up a development environment, follow these steps:
- A PostgreSQL 16 server with the PostGIS extension
- Node 24 and npm
- A Rust toolchain with Cargo
A PostgreSQL server (1.) can be started using Docker Compose.
Node, npm (2.) and a Rust toolchain (3.) can be installed using the Nix flake (option B).
- Clone the repository
- Run
npm cito install the Node dependencies - In the
backenddirectory, runcargo run -- openapi ../frontend/openapi.jsonto regenerate the API specs - In the
frontenddirectory, runnpm run generate-apito regenerate the API client - Run
docker compose up -dto start a PostgreSQL server - Run
npm run devto start the development processes
- Clone the repository
- Run
nix developto enter the development environment - Run
npm cito install the Node dependencies - Run
regen_apito regenerate the API specs and client - Run
docker compose up -dto start a PostgreSQL server - To start the development processes, either:
- run
start_dev_envto use process-compose - run
npm run devto use npm-run-all2
- run
The admin panel should now be available at http://localhost:3000/admin.
If no admin user exists in the database, the backend creates one and displays its password in the logs.
You may use the admin panel to create an access token, which you can then use to access:
- The map view at
http://localhost:3000/map/<token> - The search view at
http://localhost:3000/search/<token> - The add view at
http://localhost:3000/add/<token>
If you use the Nix flake, you can run regen_api.
Otherwise, follow these steps:
- In the
backenddirectory, runcargo run -- openapi ../frontend/openapi.json - In the
frontenddirectory, runnpm run generate-api
This is only needed if you have modified one of the backend SQL queries.
In the backend directory, run cargo sqlx prepare --database-url postgresql://postgres:postgres@localhost/safehaven.
If you use the Nix flake, you can run cargo sqlx prepare without the --database-url argument.
Licensed under the GNU General Public License v3.0, see LICENSE.
