Skip to content

Expenses app is my new excuse to learn DDD and write some Go code.

Notifications You must be signed in to change notification settings

contre95/expenses-app

Repository files navigation

Expense App

My new excuse to keep on coding. Don't expect much doc.

It's just an API made with Fiber and no ORM which aims the help you with tracking expenses and let's you interact with them on Grafana

Expenses dashboard

A Grafana dashboard is automatically created and can be accesses from localhost:8080

image

Features

Configurations

All configurations are set in the .env file and passed as environment variables

# Set the .env
mv .env.example .env
# Install the dependencies
go mod tidy
# Source the env variables
. <(cat .env | grep -v -e '^$' | grep -v "#" | awk '{print "export " $1}')

Endpoints

Login

# Request /login
curl -d "user=admin&pass=secretpass" -X POST http://localhost:3000/login | jq
# Response
#   {
#     "token": "<jwt>"
#   }

Google Sheets Importer

# Request /importers/:importer_id
JWT=$(curl -d "user=admin&pass=secretpass" -X POST http://localhost:3000/login | jq ".token" | tr -d '"')
curl -H "Authorization: Bearer $JWT" \
     -d '{ "bypass_wrong_expenses": true }' \
     -H "Content-Type: application/json" \
     -X POST http://localhost:3000/importers/sheets | jq
# Response
#   {
#     "err": null,
#     "msg": {
#       "Msg": "All the expenses where imported",
#       "SuccesfullImports": 206,
#       "FailedImports": 0
#     },
#     "success": true
#   }

Healthcheck

# Request /ping
curl -H "Content-Type: application/json" -X GET http://localhost:3000/ping | jq
# Response
#   {
#     "ping": "pong"
#   }

TODO

  • Users
    • Implement JSON Storage for users
    • Validate user:password for users
    • CreateUser use case

About

Expenses app is my new excuse to learn DDD and write some Go code.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published