Sign inSign up

jljl1337/xpense

By jljl1337

•Updated 10 months ago

A self-hosting friendly expense tracker

Image
0

9.2K

jljl1337/xpense repository overview

⁠xpense

Source Docker GitHub License

⁠Features

  • Self-contained: Everything in one image, no separate database instance required
  • Disaster-ready: Built-in automated database backups
  • Efficient: Lightweight and fast, built with Go and SQLite
  • Configurable: Easily customizable via environment variables

⁠Demo

Live demo available at: https://xpense.jljl1337.com⁠

Important

This is a public demo instance. Do not store any sensitive and/or critical data here. Data persistence and availability are not guaranteed.

⁠Install

Sample compose.yml:

services:

  xpense:
    image: jljl1337/xpense:latest # Use specific tag for production
    container_name: xpense
    restart: unless-stopped
    ports:
      - "8080:8080"
    volumes:
      - ./live:/xpense/data/live
      - ./backup:/xpense/data/backup
    environment:
      - SQLITE_BACKUP_CRON_SCHEDULE=0 * * * * # Backup every hour

⁠Configuration

All paths are relative to the binary location (/xpense in the Docker image).

All environment variables have the _FILE alternative, which allows reading the value from a file.

Environment VariableTypeDefault ValueDescription
SQLITE_DB_PATHstringdata/live/db/live.dbPath to the SQLite database file
SQLITE_BUSY_TIMEOUTstring30000SQLite database busy timeout in milliseconds
SQLITE_BACKUP_DB_PATHstringdata/backup/db/backup.dbPath to the backup SQLite database file
SQLITE_BACKUP_CRON_SCHEDULEstring0 0 * * *Cron schedule for SQLite database backups
SESSION_CLEANUP_CRON_SCHEDULEstring0 0 * * 0Cron schedule for session cleanup
LOG_LEVELint0Logging level for the application
LOG_HEALTH_CHECKboolfalseWhether to log health check requests
PORTstring8080Port number for the HTTP server
CORS_ORIGINSstring*Allowed CORS origins (comma-separated)
PASSWORD_BCRYPT_COSTint12Bcrypt cost factor for password hashing
SESSION_COOKIE_NAMEstringxpense_session_tokenName of the session cookie
SESSION_COOKIE_HTTP_ONLYbooltrueWhether the session cookie is HTTP-only
SESSION_COOKIE_SECUREboolfalseWhether the session cookie requires HTTPS
SESSION_TOKEN_LENGTHint32Length of generated session tokens
SESSION_TOKEN_CHARSETstringalphanumeric characters (case-sensitive)Character set for session token generation
SESSION_LIFETIME_MINint10080 (7 days)Session lifetime in minutes
SESSION_REFRESH_THRESHOLD_MINint1440 (1 day)Session will only be refreshed if remaining lifetime is below this threshold in minutes
PRE_SESSION_LIFETIME_MINint15Pre-session lifetime in minutes
CSRF_TOKEN_LENGTHint32Length of generated CSRF tokens
CSRF_TOKEN_CHARSETstringalphanumeric characters (case-sensitive)Character set for CSRF token generation
PAGE_SIZE_MAXint64100Maximum page size for paginated results
PAGE_SIZE_DEFAULTint6410Default page size for paginated results
SESSION_COOKIE_SAME_SITE_MODEstringlaxSameSite mode for session cookie (lax, strict, or none), other values are treated as none

⁠Development

  1. Install Go⁠, pnpm⁠, and air⁠
  2. Run pnpm install in the web directory to install frontend dependencies
  3. Run go mod download in the project root to install backend dependencies
  4. Start the development server with air

Tag summary

Content type

Image

Digest

sha256:0d97f3ca9…

Size

18 MB

Last updated

10 months ago

docker pull jljl1337/xpense