The purpose of this web app is to record and manage your money.
The HTML files are currently only in french.
Features supported (all the data are registered in a local SQLite DB):
- basic features for users
- record expenses per user, account and category
- stats:
- year by year with current balance available per account
- year by year or month by month per category
- advanced features for users
- manage recurrent expenses or gains
- handle multiple categories per user and allow budgeting for each, 2 budgeting options:
- reset the budget each period
- keep the rest of the last budget period and add it to the next
- handle multiple bank accounts per user and allow transfer between them
- validate or cancel each record
- lend / borrow with registered tiers
- import CSV files to insert/update data in bulk
- export CSV files to keep/use all the data with other apps
- generic features in app
- create users
- auth with 1 active session per user
- save general parameters preferences per user
- smartphone first front-end
- tested on the viewport:
- Screen Width: 360 pixels
- Screen Height: 640 pixels
- screen viewport on viewportsizer
- tested on Chrome for Android and Chrome for Windows Desktop
- if you have any visual trouble on a different Browser/OS combination, submit an issue
- tested on the viewport:
- admin features
- shutdown the application (also checkpoint SQLite, then clean the
db-shm
anddb-wal
files)
- shutdown the application (also checkpoint SQLite, then clean the
This application is a monolith with some endpoints for the API and others for the UI.
Both uses the same functions, but return JSON for the API and HTML for the UI.
- prerequisites :
- test the app :
# generate environment variables : export SQLITE_DB_FILENAME="test.db" export COOKIE_LENGTH=64 export EXE_PATH="/gofi" export ADMIN_EMAIL="[email protected]" export ADMIN_EMAIL_B="[email protected]" # run the tests (create a new DB named test.db) : cd /gofi go clean -testcache go test ./data/dbscripts/initDB go test ./back/api/test/users go test ./back/api/test/params go test ./back/api/test/records go test ./back/api/test/csv go test ./back/api/test/save go test ./back/api/test/shutdown
- run the app with the real database :
# only the first time. # exec initDB first to create DB file with required tables export SQLITE_DB_FILENAME="gofi.db" export EXE_PATH="/gofi" cd /gofi go run ./data/dbscripts/initDB # the DB is created in the "dbscripts" folder, move it under: "data/dbFiles"
export SQLITE_DB_FILENAME="gofi.db" export COOKIE_LENGTH=64 export EXE_PATH="/gofi" export ADMIN_EMAIL="[email protected]" export ADMIN_EMAIL_B="[email protected]" cd /gofi templ generate go run .
- on Windows Powershell:
- replace
export
with$Env:
- replace
cd /gofi
withcd c:\gofi\
- replace
- legend:
- this is a Go
package
- this is a standard folder
- Circular dependency is forbidden.
-
back
- routes
routes
- The routes package contains the configuration of the app.
- appmiddleware
appmiddleware
- The appiddleware package contains code executed on each request.
- api
- test
- All the behaviour testing of the back-end is done here under test subpackages.
api
- The api package contains all the handlers for the back-end part of the app.
- test
- routes
-
data
- appdata
appdata
- The appdata package contains global variables, funcs and go data structs.
- sqlite
sqlite
- The sqlite package contains all the database interaction.
- dbFiles
- contains the database files.
- dbscripts
- contains database script to execute manualy.
- appdata
-
front
- htmlComponents
htmlComponents
- All the HTML code is structured here with maximum usage of components to minimize repetition.
front
- The front package contains all the handlers for the front-end part of the app.
- htmlComponents
-
assets
- Everything here is used as file server for the front-end part.
- css
- fonts
- img
- js
Operation | HTTP Method | SQL Statement |
---|---|---|
Create | POST (body) | INSERT |
Read | GET (params) | SELECT |
FullEdit | PUT (body) | UPDATE |
PartEdit | PATCH (body) | UPDATE |
Delete | DELETE (params) | DELETE |
- POST + PUT + PATCH with JSON body
- GET + DELETE with URL params
- the HTML attribute
name
is used when a form is sent to the backend (application/x-www-form-urlencoded)- the used
name
in the HTML file must correspond to the struct name (case sensitive) - the form use (this package)[https://github.com/ajg/form]
- possible to bind struct in struct by joining with
.
:parent.child
- the used
- the struct
JSON name
is used for API calls with JSON body (case insensitive)