hellooooo everyone!!!
I am back again with a journey update📹
AND This girl’s learning by DOING❤️
I am done with Express and now,
I finally unlocked the M in MERN stack — MongoDBBBBBB☁️💚
(or mangoDB for me because my brain loves fruits...😭)
🌸And What I did...
So the idea was simple in my head —
I wanted to build a todo app
but this time not storing things locally like arrays 😭
this time with real database stuff like MongoDB (NoSQL)…
Main concept was — users can sign up
and log in
with their info,
and then their todos
will get added/updated
directly into the database (MongoDB cloud 🌥️).
I used JWTs
& tokens
for authentication,
Postman
for testing,
bcrypt + salt
for password hashing (no plain text drama here 😤),
Zod
for input validation,
and of course handled all the random errors and bugs that came my way 🐛
...anddd trust me, many more things I cried over but figured out eventually 😭✨
And it was my first time doing all thisss...
Like for real, I had zero clue in the beginning.🥹
But here I am now —
sharing my actual journey of how I built this MongoDB-powered Todo App💚
I’ll be sharing all the resources, the mistakes, and the little “OMG IT’S WORKING” moments 😭
And yes — after every single bug fix or code run,
I was literally like:
"IT’S WORKINGGGG!!!" (😭 screaming alone in my room lol)
Also big win for me —
I’m finally able to maintain a real coding streak and this time it feels so so real 🫶
So here’s a little breakdown of everything I did,
and if you’re a beginner — I promise, you can build this too 🫶
🌸Also… here's the link to my GitHub repo if you wanna check it out or run with me → https://github.com/khushikumari239/TODO-DB.git
🌸Let’s build the backend skeleton first!
So after setting up the project, I started creating the main backend structure —
and trust me this was the part where things finally started to feel real-real🌼
🛠️4 Core Routes I Created : -
POST /signup POST /login POST /todo (authenticated) GET /todos (authenticated)
So after setting up MongoDB and Compass (yupp I did the full ritual 😭)...
I created a file called db.js
where I wrote the schema for my app using Mongoose.
Using two collections : -
users
todos
and my database looks something like this📸
🌸Mongoose docs here : - https://www.npmjs.com/package/mongoose
After setting up my schema in db.js,
I imported the models inside index.js like this : -
const { UserModel, TodoModel } = require("./db");
Now I could actually start doing the fun part — working with real data!
Postman literally became my BFF during this whole process 😭
I used it to : -
- Send user data for signup/login
- Test protected routes with tokens
- Create and fetch todos
📸 Here's a shot from the Postman chaos 👇
anddd every time I got a 200 OK response,
I literally screamed “Yesss it’s workingggg” like 3 times 😭
💀PLOT TWIST : -
Imagine Paytm or BigBasket gets hacked…
and they were storing passwords in plain text 😩
Now my villain finds the leaked data —
and sees: "khushiiii@mail.com"
→ "mainCharactervibes12"
😭
And because I reused that password (don’t judge 🥲),
they now have access to my Insta, Gmail… basically my whole digital life.
Lesson learned : - no more plain passwords.
We hash. We salt. We protect. 🔐
🌸 A BLOG I Found (That Saved Me 😭)
So while I was figuring out how to hash passwords properly,
I came across this amazing blog : -
👉 https://heynode.com/blog/2020-04/salt-and-hash-passwords-bcrypt/
It explains hashing, salting, and bcrypt so well —
I swear if you’re also confused like I was,
this will help you breathe again 😭💗
Anddd ofc I went to the docs and read a bit like a serious dev 😤
Look at these screenshots I took:
MongoDB Auto Update Moment 💚 : -
- And look at this!!
MongoDB auto-updated the stored password with the hashed version —
no plain text, no drama ✨
😭 Silly Mistake I Made (Classic Dev Moment™)
So at one point my DB was only showing the email
, not the password.
..
And I was like : -
"Wait... where's my hashed password???"
Turns out — in my db.js
schema, I had written Password
(with a capital P) instead of password
(small p) 💀
And MongoDB was like : girl, I don’t know what you’re trying to save, but okay??
After fixing that — boom 💥
Password saved correctly, hashes looking good, all chill 😌
Finally felt so relaxed after that fix… like yes,
I’m still learning, but I’m figuring it out 🫶
⚠️ Error Handling(aka: why is my server screaming!? 😭)
Did some quick error handling using try–catch because my server was crashing when I used the same email twice 😩
Now it doesn’t cry every time I mess up 😭
Doneeee. Finallyyyy. ✅
-- My server's smart now 😤
Thanks to Zod, it checks if your inputs are in the right format — or throws a tantrum 😌
📦 Installed with: npm install zod
Docs: https://zod.dev/
Clean. Safe. No random junk hitting my DB anymore ✅
🧾Code? Yup, it’s all on GitHub! : -
I built the whole logic from scratch —
from defining schemas in db.js, to writing routes, hashing passwords, JWT auth, input validation... everything 🔥
But instead of pasting pages of code here,
check out my full GitHub repo 👉 (https://github.com/khushikumari239/TODO-DB)
(it’s neater there, I promise 😭💗)
Still, here’s a sneak peek 👀👇
💌 If You’re Coding Along…
The code above is for anyone building this with me —
copy, break it, fix it, vibe with it🌼
Happy coding everyone! 💗
What’s Next???💚
This week’s packed...
👾 I just started React (yes, the frontend glow-up begins!)
👾 Planning a big project combining all the backend stuff I’ve learned
👾 Also doing a code challenge I’ve been scared of for weeks…
🌸 A Little Real Talk...
There was a time I kept asking myself : -
“Why would they choose me? What if I try and fail? Why even apply?”
But then I was like...
Wait Khushi — why NOT you??
If I don’t try, how will I know what I’m capable of?
So this time, I’m doing it.
I’ll give it my honest best.
If I win — yay. If I don’t — I’ll still learn a LOT.
And that’s always a win, right?❤️
I’ll share the whole journey of the challenge too —
how I planned, wrote code, tackled bugs, everything!
But for now…
just know that I’m coding fearlessly this time 🫶
and I’d love your support along the way 💌
Top comments (0)