Skip to content

birabittoh/rainbbit

Repository files navigation

Rainbbit

A lightweight and self-hosted weather service.

Desktop screenshot

Rainbbit does the following:

  • reads free weather data from OpenWeatherMap;
  • saves said data into a local SQLite database;
  • plots several useful info;
  • displays said plots without the need for JavaScript.

All of this is done in a single binary file that weighs less than 30MB.

TODO

  • Add a light theme.
  • Cache the database requests.
  • Cache the plots.

API endpoints

GET /api/records

Retrieves weather records stored in the database.

GET /api/latest

Gets the latest weather record.

GET /api/conditions

Fetches all possible weather conditions.

GET /api/meta

Provides the zone name, lists plottable measures and available themes.

GET /api/plot/{measure}

Generates an SVG plot for any measure.

GET /api/temp

Generates a custom SVG plot for temperature.

GET /api/pressure

Generates a custom SVG plot for pressure.

GET /health

Health check endpoint. Performs a SELECT 1 on the database and returns 204 No Content if successful.

Instructions

First of all, create your own .env file:

cp .env.example .env

You should set your latitude and longitude, as well as a free OpenWeather 2.5 API key.

You can then either start the service locally:

go run .

Or use Docker:

docker compose up -d

Optional variables

Name Default value
OWM_CRON 0 0/30 * * * *
APP_ADDRESS :3000
DATABASE_URL (If set, PostgreSQL is used instead of SQLite)

Migration to PostgreSQL

If you want to migrate your existing SQLite data to PostgreSQL:

  1. Set DATABASE_URL in your .env file.
  2. (Optional) Set SQLITE_PATH if your database is not in data/data.sqlite.
  3. Run the migration script:
go run ./cmd/migrate

License

Rainbbit is licensed under MIT.

About

A lightweight and self-hosted weather service.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors