saifahn / expenseus Goto Github PK
View Code? Open in Web Editor NEWA serverless expense tracking app
A serverless expense tracking app
I think it would make more sense to have the WebService as its own package.
However, it has to import some things such as the User, ExpenseDetails, Expense etc., and these are also imported by other packages.
These should probably be split into two different packages, and the logic for the webservice stuff can be kept separate.
I wrote a whole thing about followers in Redis and I accidentally deleted it. That was super not great.
It was basically talking about whether or not to keep a personal timeline for each user and update it upon follow/unfollow and post. I didn't think it made sense beforehand, but it's actually reasonably good to keep a sorted timeline that you can just fetch from.
The alternative is to fetch from several different sorted sets and use the scores to sort them. There is a WITHSCORES option on ZRANGE.
ZUNIONSTORE and ZADD could be used for adding, and ZREM for removing.
Maybe I should fork the project. One half should be used for the real, practical app, and one to replicate the Twitter Clone
As far as the connections thing on Expenseus goes, that needs a different approach.
I should probably create a new issue for this.
Ideally, I should just use one DynamoDB table to hold my data, and I would model the data so that it can be queried efficiently.
Some resources:
This is one of the first pieces of information we can put about the expense - it can give us an idea of what kind of expense it was right from that.
I think it would be nice to even make it an autocomplete option or something. This should probably come later though, maybe with some database migration.
I think this page actually technically exists, under the Expenses tab...
Maybe I should leave this for now.
I'm not even sure what this would do. Some kind of CI/CD?
But probably not for now... I haven't even decided on the stack I want to end up at.
There's a little bit of exploration at #17.
This feature is also very important for its original intended use case.
It unfortunately is also one of the more complicated ones...
payer == loggedInUser
, then look at the percentage splituser := loggedInUser
defaultSplit := 0.5
totalOwed := 0
for _, t := range transactions {
isPayer := transaction.payer = user
split := transaction.split || defaultSplit
if isPayer {
totalOwed += transaction.amount * split
} else {
totalOwed -= transaction.amount * split
}
}
{
"debts": [
{
"debtor": "otherUserInTracker",
"debtee": "loggedInUser",
"amountOwed": -152523
}
],
"numberOfTransactions": 23
}
- After your app works locally, log in to the EC2 instance you created via SSH
- Set up Redis on the instance (installed variant or docker variant is okay)
- No need to install minio on the EC2 since it has direct access to AWS S3
- Install your app on the server
- Install nginx for TLS termination (HTTPS). For SSL certificate, use Let’s Encrypt.
- Do not use Go's standard library's HTTP package for TLS termination
- Finally, put your app behind nginx and have the app start on instance startup by using systemd, supervisord, etc.
I made the scripts without the correct understanding of how environment variables work. I can clean them up.
精算?
To begin with, it can just calculate all the expenses up until now.
Pressing "finish" would mark all of the current expenses as settled.
In the future, it would be great to go serverless and not have to run a database on a server. I think DynamoDB would be a good option, and pretty good as a stepping stone in moving off of AWS.
Currently, the API related code is defined within the React components. It would be nicer to have it in its own place.
This probably should be split into a few issues:
Japanese
English
This is like the most important part of the expenses!
// build out empty struct of category amounts?
totals := TotalByCategory{}
for _, t := range transactions {
totals.total += t.amount
totals[t.category] += t.amount
}
return totals
If I make the Layout component do the login check, then it will work on every route, even if the app is not acting as an SPA.
I can also show the "Sign in" button on each page more easily.
I should also add the Log out button to the nav instead of only on the Home page...
It would be nice to connect things up to see the server in action.
It doesn't need to be anything fancy.
I'm considering Next.js with TailwindCSS. I'd like to see how Tailwind holds out in a project.
Next.js because I haven't used it before, and I want to play around with some newer version of React. I would try Svelte otherwise.
Ultimately, I'd like to have this set up as kind of a JAMStack project, and Vercel looks reasonable for Next.js?
We can always change things in the future.
You have to choose your username before you can continue.
For simplicity, you can't change your username?
I would like to display the usernames on the transactions, and this would make it easier 🤔
This should be easier than #60 because the calculation doesn't have to deal with anyone else and based on who paid, as personal transactions are always from yourself.
I prefer dark mode.
Look into tailwind dark mode.
Looks reasonable enough, but will have to add in logic to manually toggle between on and off.
Should probably use a localStorage value so it can be saved across sessions and also when leaving and coming back to the app (e.g. when signing in).
Upgrade Tailwind
USER#<user_id>
and SK of TRANSACTION#<new_transaction_id>
Three problems to solve:
users > 2
, use 1 / users
perecentage split for every transactionusers == 2
, use the "payer split" field for the percentage split for each transaction
I wrote some stuff down in the user flows document, but it doesn't seem to be particularly helpful. I'll probably have to watch more about single table database design first.
USER#<user_id>
, SK of TRANSACTION#<transaction_id>
Definitely need to keep track of the date.
Currently, the front end and back end will be running from different domains (different ports on localhost locally), so CORS needs to be allowed so that they can communicate with one another.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.