๐๐ฎ๐ ๐ฐ๐ฌ/๐ญ๐ฌ๐ฌ
Imagine a customer changing product prices or staff deleting admin records. Thatโs what happens when everyone has the same access.
RBAC separates permissions by role: user, staff, and admin. The backend must enforce them.
#100DaysOfLearning
๐๐ฎ๐ ๐ฏ๐ต/๐ญ๐ฌ๐ฌ
While studying my backend, I also started building the frontend.
We moved from an admin dashboard to a login page, then planned a separate public product page where visitors can browse without logging in.
It's still a work in progress
#100DaysOfLearning
๐๐ฎ๐ ๐ฏ๐ด/๐ญ๐ฌ๐ฌ
Why track refresh sessions?
Because a token that expires in 7 days may need to be revoked before then.
Session tracking helps a backend handle logout, revoke compromised sessions, and manage logins across devices.
#100DaysOfLearning
๐๐ฎ๐ ๐ฏ๐ณ/๐ญ๐ฌ๐ฌ
What's the difference?
Access token: Accesses protected resources.
Refresh token: Gets a new access token when the current one expires.
In my MMS, access tokens last 1 hour, refresh tokens last 7 days.
#100DaysOfLearning
๐๐ฎ๐ ๐ฏ๐ฒ/๐ญ๐ฌ๐ฌ
Why should tokens expire?
If a token is stolen, an expiry time helps limit how long it can be used.
In my MMS backend:
Access token: 1 hour
Refresh token: 7 days
it is not just granting access, also control how long that access lasts.
#100DaysOfLearning
๐๐ฎ๐ ๐ฏ๐ฑ/๐ญ๐ฌ๐ฌ
35 days of learning, building, debugging, and growing.
Today is for resting, reflecting, and recharging.
Consistency isn't about never resting. It's about showing up again.
#100DaysOfLearning#Rest#Consistency
๐๐ฎ๐ ๐ฏ๐ฐ/๐ญ๐ฌ๐ฌ
What happens when you click "Forgot Passwordโ?
Generate a secure token โ Hash it โ Store the hash โ Send the reset link โ Verify the token โ Change the password.
#100DaysOfLearning#Security#PasswordHash
๐๐ฎ๐ ๐ฏ๐ฏ/๐ญ๐ฌ๐ฌ
Hashing โ Encryption.
Encryption lets you recover the original data with the right key. Hashing is designed to be one-way.
Thatโs why my MMS uses bcrypt to hash passwords instead of storing them in plain text.
#100DaysOfLearning#BackendDevelopment
๐๐ฎ๐ ๐ฏ๐ฎ/๐ญ๐ฌ๐ฌ
What if my MMS database were exposed and every password was stored in plain text?
That's why I use bcrypt. it hashes passwords and makes guessing them more expensive. My current setup uses a cost factor of 12.
#100DaysOfLearning#CyberSecurity#CRUD
๐๐ฎ๐ ๐ฏ๐ญ/๐ญ๐ฌ๐ฌ
I moved toward a minimal JWT payload: { id, iat, exp }.
Why? User roles and details changes. Fetching the current user from the database helps my backend use up-to-date information instead of relying on stale token data
#100DaysOfLearning#BackendDevelopment
๐๐ฎ๐ ๐ฏ๐ฌ/๐ญ๐ฌ๐ฌ
An admin, staff member, and user can all log in successfully. But should they have the same permissions?
Authentication identifies the user. Authorization decides what they can do.
#100DaysOfLearning#BackendDevelopment#API#SoftwareEngineering
๐๐ฎ๐ ๐ฎ๐ต/๐ญ๐ฌ๐ฌ
How my MMS backend recognize an authenticated user
Login โ Verify details โ Generate JWT โ Client sends token โ Server verifies โ Request
Authentication identifies user, authorization determines what they can do
#100DaysOfLearning#BackendDevelopment
๐๐ฎ๐ ๐ฎ๐ด/๐ญ๐ฌ๐ฌ
A rest day after a week of exploring PostgreSQL, database performance, transactions, and backend reliability.
Sometimes, progress means pausing, reflecting and allowing what you've learned to settle.
We continue tomorrow
#100DaysOfLearning#DeveloperJourney
๐๐ฎ๐ ๐ฎ๐ณ/๐ญ๐ฌ๐ฌ
Instead of guessing why my query is slow, I can ask PostgreSQL.
EXPLAIN reveals the query execution plan, helping me investigate table scans, index usage, the work PostgreSQL expects to perform.
Understand before optimizing.
#100DaysOfLearning#PostgreSQL
๐๐ฎ๐ ๐ฎ๐ฒ/๐ญ๐ฌ๐ฌ
Imagine searching 100,000 products for one spare part.
A database index is like a book's index: it helps PostgreSQL find matching records faster without scanning every row.
But indexes also have costs.
N/B: This is a demo app
#100DaysOfLearning#PostgreSQL
๐๐ฎ๐ ๐ฎ๐ฑ/๐ญ๐ฌ๐ฌ
While working on my order flow, I started thinking about who should calculate the final order total. The frontend can calculate it, the backend shouldn't blindly trust it.
It should verify the data give the final total.
#100DaysOfLearning#BackendDevelopment
๐๐ฎ๐ ๐ฎ๐ฐ/๐ญ๐ฌ๐ฌ
Stock = 1.
Request A sees 1.
Request B sees 1.
Both try to buy.
The code may work perfectly for one request, but concurrent requests can produce an incorrect result.
Thatโs a race condition.
#100DaysOfLearning#BackendDevelopment#SoftwareEngineering
๐๐ฎ๐ ๐ฎ๐ฏ/๐ญ๐ฌ๐ฌ
What happens when two customers try to buy the last item at the same time?
Both could see stock = 1. Thatโs where PostgreSQLโs SELECT FOR UPDATE comes in โ locking the row so concurrent requests don't oversell.
#100DaysOfLearning#PostgreSQL#Backend
๐๐ฎ๐ ๐ฎ๐ฎ/๐ญ๐ฌ๐ฌ
Today I started Week 4 with PostgreSQL transactions using my MMS order flow.
I learned how BEGIN โ operations โ COMMIT keeps related changes together, while ROLLBACK prevents partial changes when something fails.
#100DaysOfLearning#PostgreSQL#Database