A simple app to track your daily weight, with charts.
The goal is to allow for easy daily recording, and to see your progress on (hopefully) nice and useful charts.
Developed with Roda, Sequel, PostgreSQL, Rodauth,Bootstrap and Chart.js.
It's fully functional but could be updated in the future, see next features and known bugs.
You can review the code here.
- One entry per user and per day
- An entry must have a date and a weight
- An entry can have an associated note
- An entry can have an associated alcohol consumption info
- An entry can have an associated sport activity info
- Every entry is linked to one (and only one) batch, to allow you to group entries by specific time periods
- Each batch can have an associated target weight
- Each entry has a delta to target attribute to show the remaining weight to loose / gain before reaching target
- Each entry has the delta with the last entry
- If you enter your height on the account page, each entry has a body mass index indicator (bmi)
- Entries are by default assigned to the currently active batch, which is the more current scenario. If you want to record it into another batch, you must make it active first (on the batches page)
- There can only be one active batch at a time
- If you delete a batch, all related entries are permanently destroyed
- Entries and batch info's can be downloaded in JSON format on the Account -> Export page
- Create Account
- Verify Account
- Verify Account Grace Period
- Close Account
- Login
- Logout
- Change Login
- Verify Login Change
- Reset Password
- Change Password
- Change Password Notify
- Active Sessions
- Audit Logging
- Lockout
- OTP
- Recovery Codes
- Admin can see a list of all accounts, with the following information's for each account :
- user name
- account status (unverified, verified, closed)
- 2 factor authentication enabled ?
- is an admin user ?
- total number of batches
- total number of entries
- date of the last entry
- admin can perform the following actions on accounts (except on admin accounts):
- verify an account
- close an account
- open an account (if closed)
- delete an account
- admin accounts can only be handled at the database level
- closing an account simply makes it unavailable (no login possible), but does not delete any data
- deleting an account permanently deletes all associated data
- from the web app, an admin user has NO ACCESS to individual entries and cannot see weight, notes and batch target weight. But see important note in the "Encryption" title hereafter.
The following data are encrypted before being saved in the database :
- Entries
- weight
- note
- alcohol consumption
- sport
- batches
- target weight
- Mensuration
- height
So even if someone gains an unauthorized access to the database, all these data will be gibberish.
Note that the developer must know the encryption/decryption key and can thus technically decrypt the data, so you'll have to trust him.
- Install latest stable ruby version (use a version manager like rbenv, rvm or asdf).
- Install PostgreSQL and create a database (and a test database if you want to run the tests).
- Clone or download the repository.
cdinto it.- run
bundle install. - The app assumes the following environment variable are set (do not put them under version control):
- DATABASE_URL ==> The connection info to your PostgreSQL database (same variable name for development and production)
- TEST_DATABASE_URL ==> Connection info to your test database, if you want to run the tests
- SESSION_SECRET ==> must be a string of at least 64 bytes and should be randomly generated. More info in the Roda::RodaPlugins::Session documentation
- SEQUEL_COLUMN_ENCRYPTION_KEY ==> Key to encrypt/decrypt the data before being saved into the database. More information here.
- WT_EMAIL ==> The email address the app will send from
- MY_EMAIL ==> The email address where admin notifications will be sent in production mode
- SMTP_PORT, SMTP_DOMAIN, SMTP_ADDRESS, SMTP_USERNAME and SMTP_PASSWORD for your SMTP provider
- Run
rake db:migrateto create the database tables (if theTEST_DATABASE_URLenvironment variable is set, it will also create the test database). - (optional) run
rake db:seedto insert the seed data. - (optional) run
raketo run the test to confirm that everything works as expected. - In development mode, you can use the mailcatcher gem in order to send email to a local SMTP server
- For a development server with auto reloading feature, run
rake ds - For a development server without reloading feature, run
rake s - For a production server, run
rake ps - For a list of all rake tasks, run
rake -T
See a bug or something you want to improve ? Great :
- Fork the repository ;
- Create your own branch (git checkout -b my-new-feature) ;
- Make your feature addition or bug fix ;
- Add tests for it (important);
- Commit on your own branch ;
- Push to the branch (git push origin my-new-feature) ;
- Create a new pull request ;
Or simply open an issue on GitHub.
MIT