How ronmeruudesuu/alkansya works
Alkansya is an IoT coin-saving system: an ESP32 detects deposits and sends them to a local PHP/MySQL application, where the dashboard reports savings and users manage goals, history, corrections, and withdrawals. The graph covers those documented features and the sampled PHP implementations. The README documents the hardware-to-server workflow; unsampled browser-script/API wiring is shown only as unverified where needed.
Main entry points: database.php Database connection · functions.php Savings data helpers · save_coin.php Deposit endpoint · get_data.php Dashboard data API
Components 25
Coin device
- ESP32 counter
Web experience
- Savings dashboard
index.php - Dashboard polling
assets/javascript/dashboard.js - Goals page
goals_page.php - Goals interactions
assets/javascript/goals.js - Transaction history
history.php - Withdrawal page
withdraw_page.php - Withdrawal interactions
assets/javascript/withdraw.js - Clear history page
history_clear.php - Clear history controls
assets/javascript/clear_history.js - Theme preferences
assets/javascript/theme.js
Application services
- Deposit endpoint
api/save_coin.php - Dashboard data API
api/get_data.php - Goals API
api/goals.php - Withdrawal API
api/withdraw.php - Coin correction
api/correct_last_coin.php - History deletion API
api/clear_history.php - Device heartbeat
api/heartbeat.php - Manual deposit API
api/manual_insert.php - Savings data helpers
includes/functions.php
Persistence
- Database connection
config/database.php - Relational schema
sql/schema.sql - MySQL / MariaDB
Other components
- Coin saver
- Local PHP server
Connections 30
- Coin saver → ESP32 counter: selects and deposits
README.md - ESP32 counter → Deposit endpoint: sends coin data
README.md - Deposit endpoint → Savings data helpers: validates and records
api/save_coin.php - Deposit endpoint → Device heartbeat: marks device seen
- Deposit endpoint → Database connection: opens connection
api/save_coin.php - Savings data helpers → Database connection: queries connection
- Savings dashboard → Dashboard polling: polls for updates
- Dashboard polling → Dashboard data API: requests dashboard data
README.md - Dashboard data API → Savings data helpers: reads savings data
api/get_data.php - Dashboard data API → Database connection: opens connection
api/get_data.php - Goals page → Goals interactions: loads interactions
- Goals interactions → Goals API: manages goals
- Goals API → Database connection: opens connection
api/goals.php - Transaction history → Savings data helpers: loads filtered pages
history.php - Transaction history → Database connection: opens connection
history.php - Withdrawal page → Withdrawal interactions: loads interactions
- Withdrawal interactions → Withdrawal API: submits withdrawals
- Withdrawal API → Savings data helpers: checks inventory
api/withdraw.php - Withdrawal API → Database connection: opens connection
api/withdraw.php - Coin correction → Savings data helpers: checks remaining coins
api/correct_last_coin.php - Coin correction → Database connection: opens connection
api/correct_last_coin.php - Clear history page → Clear history controls: loads controls
history_clear.php - Clear history controls → History deletion API: requests deletion
- History deletion API → Database connection: opens connection
api/clear_history.php - Device heartbeat → Database connection: opens connection
api/heartbeat.php - Manual deposit API → Savings data helpers: validates and marks seen
api/manual_insert.php - Manual deposit API → Database connection: opens connection
api/manual_insert.php - Theme preferences → Savings dashboard: sets display theme
- Relational schema → MySQL / MariaDB: defines tables
README.md - Database connection → MySQL / MariaDB: connects to
config/database.php