# Sure

Sure is a self-hosted personal finance app, the community fork of Maybe Finance

[Sure](https://github.com/we-promise/sure) continues the open source Maybe Finance app after the original company shut down. It is a Ruby on Rails application with Hotwire, Sidekiq for background jobs, PostgreSQL and Redis, and it can easily be deployed with Hatchbox.

## Requirements

Create a PostgreSQL database and a Redis database from the app&#39;s Databases tab. Hatchbox attaches them as `DATABASE_URL` and `REDIS_URL`. Redis is required for Sidekiq and the Rails cache.

## Repository

Set the Git URL to the GitHub repository:

```
https://github.com/we-promise/sure.git
```

And use the `main` branch. Upstream publishes release tags and a `stable` Docker image, but there is no stable branch, so Hatchbox deploys `main`. To pin a release, fork the repository and create a branch from the tag you want.

## Environment Variables

```
SELF_HOSTED=true
APP_DOMAIN=finance.example.com
```

`SELF_HOSTED` enables the self-hosting features and settings page. `APP_DOMAIN` is the host used in links in emails. Hatchbox sets `RAILS_ENV` and `SECRET_KEY_BASE` for you.

To send email (password resets, reports), set `SMTP_ADDRESS`, `SMTP_PORT`, `SMTP_USERNAME`, `SMTP_PASSWORD` and `EMAIL_SENDER`. Exchange rates and stock prices come from Yahoo Finance with `EXCHANGE_RATE_PROVIDER=yahoo_finance` and `SECURITIES_PROVIDER=yahoo_finance`, or from Twelve Data with `TWELVE_DATA_API_KEY`. AI features need `OPENAI_ACCESS_TOKEN`. All of these can also be set later on the Self-Hosting settings page.

Also set `ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY`, `ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY` and `ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT` before you connect any bank or brokerage accounts (generate a set with `bin/rails db:encryption:init`). Without them Sure logs a warning on every boot and stores provider tokens and other sensitive fields unencrypted.

## Processes

Hatchbox will automatically detect and configure the Rails server and Sidekiq for background jobs.

## First Login

Open your domain. A new instance with no users sends you straight to the sign-up page (from the login page, use &quot;Create account&quot;). The first user registered on an instance becomes the super admin. Set `ONBOARDING_STATE=closed` or `invite_only` afterwards to stop further public sign-ups.

## Notes

Uploads use Active Storage on local disk, stored in `storage/`, which Hatchbox keeps in the app&#39;s shared directory. That works on a single-server cluster. For multiple servers set `ACTIVE_STORAGE_SERVICE=amazon` with the `S3_ACCESS_KEY_ID`, `S3_SECRET_ACCESS_KEY`, `S3_BUCKET` and `S3_REGION` variables.

Sure forces and assumes SSL in production by default, which is correct behind Hatchbox&#39;s Caddy proxy.
