When I started building web applications, I quickly realised that keeping the frontend and backend as separate applications made development much easier.
My current setup looks like this:
project/
│
├── frontend/
│ ├── index.html
│ ├── config.js
│ ├── script.js
│ └── ...
│
├── backend/
│ ├── main.py
│ ├── auth.py
│ ├── ....
│ └── ...
│
└── README.md
I still keep everything in one Git repository, but the frontend and backend are deployed independently.
1.Frontend
HTML, CSS and JavaScript
Hosted on Netlify
2.Backend
FastAPI
Hosted on Render
3.Database
- MongoDB Atlas
Why this works well
Independent deployments
If I update the UI, I only redeploy Netlify.
If I add a new API endpoint, I only redeploy Render.
Neither deployment affects the other.
Cleaner codebase
The frontend focuses only on:
User interface
API requests
Client-side logic
The backend focuses only on:
Authentication
Database operations
Business logic
Security
Each application has a single responsibility.
Better security
Database credentials and secrets stay in the backend.
The frontend never contains:
MongoDB URI
API keys
Secret tokens
Instead, it communicates with the backend through HTTP requests.
Easier maintenance
When a bug appears, I immediately know where to look.
UI bug? → Frontend.
Database bug? → Backend.
Authentication bug? → Backend.
Easy hosting
Using different platforms allows each service to do what it does best.
Netlify serves static files quickly through its CDN.
Render runs the FastAPI server.
MongoDB Atlas manages the database.
Each service specialises in its own task.
Do you need separate repositories?
Not necessarily.
For solo developers and small teams, a single repository with separate frontend and backend folders is often a great choice. It keeps everything together while still maintaining a clear separation of concerns.
As projects grow, some teams move to separate repositories, while others continue using a monorepo. Both approaches can work well—the important part is keeping the frontend and backend independent enough that they can be developed and deployed separately.
Top comments (0)