Question Locked

Best ways to build a lightweight balance-check feature for a web app?

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hey everyone,

I’m experimenting with a small personal web app and want to add a simple feature that lets users check a current balance or points total after logging in.

What’s the most efficient and secure way to structure this on the backend?
I’m debating whether to:

Store the value in a local database and refresh it through a PHP/Node API, or

Pull it dynamically from an external service with proper authentication.

Also wondering what’s best practice for caching or limiting requests so it doesn’t overload the server.

Would love to hear how others would approach this — especially if you’ve built something similar for dashboards or account pages.

Thanks!

4 replies

by kees_b

I would look in the database(s) of the application that store the current balance or current points total and the login data (usrname and password) of the customer. That's the best data you have.

Without knowing the details of that database and the options you have for location and language of the backend of your app it's impossible to say more.

I don't expect performance problems if it's a simple app that only needs two database accesses (1 for the login and 1 for the data to display) per transaction.

by h8257510

Store balances in your own database and expose them via a small authenticated API (PHP/Node).
If you need data from an external service, cache it locally and refresh in the background.
Use JWT/session auth and basic rate limiting to keep it secure and lightweight.

by BenDunk8190 edited

A lightweight balance-check feature usually works best when the data is stored locally in a database with a secure API endpoint. Pulling values from an external service can add latency, so caching recent results for a short interval can improve performance and reduce server load. Proper authentication and rate limiting are essential for security.

This discussion is closed to new replies.