How ellite/wallos works
Purpose and runtime
Wallos is a self-hosted PHP 8.3 subscription/recurring-expense tracker. It serves server-rendered pages plus JavaScript-driven actions, persists data in SQLite, and can run behind NGINX/Apache or in Docker. Main browser entry points include index.php, subscriptions.php, calendar.php, stats.php, settings.php, and admin.php. Container startup is defined by Dockerfile, startup.sh, and docker-compose.yaml.
Request, authentication, and persistence boundary
PHP pages and mutation endpoints share session/user validation and database connection infrastructure. Core boundaries are:
• SQLite access and endpoint-specific connections: includes/connect.php, includes/connect_endpoint.php, db/wallos.empty.db
• Session/login/user guards: includes/checksession.php, includes/checkuser.php, includes/validate_endpoint.php
• Schema evolution: includes/run_migrations.php, endpoints/db/migrate.php, migrations/000001.php
Initial registration creates the first account; migrations are runnable through web or CLI. Persistent Docker volumes retain the database and uploaded logos.
Subscription domain flow
Subscriptions are the central entity. UI pages load client behavior from scripts/dashboard.js, scripts/subscriptions.js, and scripts/subscription-details.js; these call server endpoints to create, fetch, modify, clone, renew, delete, and export subscription data:
• endpoints/subscription/add.php, endpoints/subscription/get.php, endpoints/subscription/renew.php
• endpoints/subscriptions/get.php, endpoints/subscriptions/export.php
• API equivalents under api/subscriptions/get_subscriptions.php and api/subscriptions/set_subscriptions.php
Supporting category, payment-method, household, budget-period, and currency data determine organization and cost reporting.
Presentation, reporting, and calendar
Server-rendered dashboards expose subscriptions through reusable calculations and listing logic. Statistics and budgets derive recurring costs from stored subscriptions; calendar feeds provide external-calendar integration:
• includes/list_subscriptions.php, includes/stats_calculations.php, includes/budget_period_calculations.php
• stats.php, calendar.php, endpoints/subscription/exportcalendar.php
• api/subscriptions/get_ical_feed.php, includes/ical_helper.php
Localization is split between PHP and browser translation catalogs under includes/i18n/ and scripts/i18n/.
Scheduled operations and notifications
Cron scripts perform asynchronous maintenance rather than serving browser requests: next-payment recalculation, exchange-rate refresh, yearly-cost snapshots, update checks, account mail queues, notifications, and AI recommendation generation. Key jobs:
• endpoints/cronjobs/updatenextpayment.php, endpoints/cronjobs/updateexchange.php
• endpoints/cronjobs/sendnotifications.php, endpoints/cronjobs/sendcancellationnotifications.php
• endpoints/cronjobs/generaterecommendations.php
Notification configuration and test/send paths support email plus Discord, Gotify, Mattermost, ntfy, Pushover, Pushplus, ServerChan, Telegram, and generic webhooks under endpoints/notifications/.
External integrations and security controls
Fixer supplies currency rates; logo lookup uses web search; AI recommendations target ChatGPT, Gemini, or local Ollama. Relevant integration points are includes/currency_rates.php, endpoints/currency/update_exchange.php, endpoints/logos/search.php, and includes/ai_client.php.
Authentication supports password login, TOTP, and OIDC/OAuth. OIDC can source runtime settings from environment variables and performs discovery; outbound OIDC, SMTP, and webhook destinations are guarded against SSRF unless allowlisted:
• includes/oidc/oidc_login.php, includes/oidc/handle_oidc_callback.php
• includes/ssrf_helper.php, includes/oidc_settings.php
• libs/OTPHP/TOTP.php, libs/PHPMailer/PHPMailer.php
Administrative and programmatic interfaces
Admin controls manage users, registration/security policy, OIDC, SMTP, notifications, and cleanup. Publicly organized REST-like API routes mirror major settings and subscription operations:
• admin.php, endpoints/admin/savesecuritysettings.php, endpoints/admin/enableoidc.php
• api/admin/set_oidc_settings.php, api/settings/set_settings.php, api/users/set_budget.php
health.php is the operational health endpoint; NGINX configuration resides in nginx.conf and nginx.default.conf.
Main entry points: connect.php SQLite access · updatenextpayment.php Scheduled jobs · index.php Browser pages · add.php Subscription endpoints
Components 20
Web application
Server-rendered pages and browser actions.
- Browser pages · Dashboards, subscriptions, calendar, stats, settings, and admin.
index.php - Browser actions · Dashboard and subscription interactions call PHP endpoints.
scripts/subscriptions.js - Session & user guards · Shared page and endpoint authentication validation.
includes/checksession.php - Admin & settings API · Programmatic policy, OIDC, settings, and budget administration.
api/admin/set_oidc_settings.php
Subscription domain
Core subscription and reporting behavior.
- Subscription endpoints · Create, retrieve, renew, export, and mutate subscriptions.
endpoints/subscription/add.php - Subscription API · Programmatic subscription read/write interface.
api/subscriptions/get_subscriptions.php - Subscription listings · Reusable subscription loading and listing calculations.
includes/list_subscriptions.php - Stats & budgets · Derives recurring costs and budget reporting.
includes/stats_calculations.php - Calendar export · Produces external calendar data from subscriptions.
api/subscriptions/get_ical_feed.php - SQLite access · Page and endpoint database connection boundary.
includes/connect.php - Wallos database · Persistent subscriptions, users, settings, and related data.
db/wallos.empty.db
Operations
Scheduled work and deployment surfaces.
- Schema migrations · Runnable through web or CLI migration endpoint.
includes/run_migrations.php - Scheduled jobs · Recalculates payments, rates, notifications, and recommendations.
endpoints/cronjobs/updatenextpayment.php - Notification delivery · Email and webhook-channel test/send paths.
- Container runtime · Persistent database and logo volumes are initialized at startup.
Dockerfile - Health endpoint
health.php
External services
Outbound providers and guarded clients.
- OIDC & TOTP login · Supports OIDC discovery and time-based one-time passwords.
includes/oidc/oidc_login.php - Outbound SSRF guard · Guards OIDC, SMTP, and webhook destinations unless allowlisted.
includes/ssrf_helper.php - Currency rates · Refreshes exchange rates from Fixer.
includes/currency_rates.php - AI recommendations · Uses ChatGPT, Gemini, or local Ollama.
includes/ai_client.php
Connections 20
- Browser pages → Session & user guards: validates user
- Browser pages → Subscription listings: renders subscriptions
- Browser pages → Stats & budgets: renders stats and budgets
- Browser actions → Subscription endpoints: mutations and fetches
- Subscription endpoints → Session & user guards: validates endpoint access
- Subscription endpoints → SQLite access: persists subscriptions
- Subscription API → SQLite access: reads and writes
- Subscription listings → SQLite access: loads subscriptions
- Stats & budgets → SQLite access: derives costs
- Calendar export → Subscription listings: exports schedule
- SQLite access → Wallos database: SQLite connection
- Schema migrations → Wallos database: evolves schema
- Scheduled jobs → SQLite access: maintains stored data
- Scheduled jobs → Notification delivery: triggers delivery
- Scheduled jobs → Currency rates: refreshes rates
- Scheduled jobs → AI recommendations: generates recommendations
- Notification delivery → Outbound SSRF guard: checks webhook targets
- OIDC & TOTP login → Outbound SSRF guard: checks OIDC destination
- Admin & settings API → SQLite access: updates administration settings
- Container runtime → Wallos database: persists volume