r/Backend • u/royalz007 • 2d ago
backend source code
how does backend to front end communication work for a website , and is it even possible to obtain the backend source code from the front end website url ?
0
Upvotes
11
u/Beregolas 2d ago
The backend usually exposes an API, most commonly a REST API specifically. The frontend can call the endpoints in that API to mutate data on the backend, and/or to receive data to display to the user.
If coded correctly, the backend code cannot be retrieved by people who have access to the frontend.
3
u/Gyoker_Macska 2d ago
π
2
u/boomkablamo 2d ago
Frontend doesn't need backend source code they just need to know the exposed API surface... If the API cannot efficiently support the frontends needs,, then their job is to communicate their needs to the backend dev so they can meet them.
1
u/Z33PLA 1d ago
π
1
u/martinbean 1d ago
lol, you canβt obtain backend source code from a website URL, otherwise everyone would be running around with the source code to sites like Facebook, Amazon, etc.
1
u/Glittering_Fault_353 1d ago
Reading real backend source code makes more sense when one request is traced from the route through the database and back, file by file. Bootdev could help build the fundamentals that make such code readable though steady code reading also works.
1
u/BannockHatesReddit_ 19h ago
Rest/soap API with js frontend
Server side html rendering
It is possible to configure a server to mistakenly serve your source files but it'd be a pretty big screw up
0
u/Discordbothost 2d ago
the practical leak is shipping source maps or a .env into the frontend build. the browser only sees what your api returns, so check what is actually in your dist folder.