I recently finished building a full-stack Library Management System, with:
- 🖥️ Frontend in React, deployed on Vercel
- 🔧 Backend in Spring Boot, deployed on Railway
At the start, I was excited. But then... deployment hit me like a wall.
🧩 The Struggles
I didn't know:
- How to deploy the backend and frontend separately
- How to set up CORS and cookies properly
- Why my app worked in Firefox, but failed with 401 errors in Chrome
I tried debugging:
- Spring Security
- Session management
- Axios headers and cookies
I even rewrote parts of my code, thinking the problem was in my auth flow…
Turns out, Chrome had third-party cookies disabled. 😤
Three. Days. Gone.
🔐 What I Learned
Spring Security from Scratch
I learned how to create aSecurityFilterChainand handle login with session-based auth using a custom success handler.Backend over LocalStorage
Initially, I was storing the user inlocalStorageand using it for validation.
I later replaced this with a backend call to/check-auth, making it more secure and reliable.CORS + Cookie Configuration
.allowedOrigins("https://my-frontend.vercel.app")
.allowCredentials(true)
Axios:
withCredentials: true
- Cookie Headers
SameSite=NoneSecureHttpOnly
All crucial for cross-origin session persistence.
✅ Final Setup
- 🌐 Frontend: React + Vercel
- 🔧 Backend: Spring Boot + Railway
- 🔐 Auth: Session-based, cookie-secured
- 🧠 Learned: Spring Security, Session Auth, CORS, Deployment practices
🎯 Next Goal
Now that it’s stable, I’m planning to migrate the backend to AWS EC2 for a more production-like deployment.
Wish me luck 🤞
If you’ve ever been stuck debugging for days over something silly — you’re not alone. Keep going. It clicks eventually ✨
#SpringBoot #ReactJS #WebDev #FullStack #SpringSecurity #Debugging #AWS #DevJourney
Top comments (1)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.