All server-side code is invisible to the user. All client-side code is visible. If you publish to https, traffic is safe.
– Aug 08 '22 at 11:34
So... every api route runs on the server-side? And if I run my app with ssr all my code is gonna be invisible to the user?
– gabrielforsterAug 08 '22 at 11:46
2
Whichever type of populating your pages with data you use, it either a) happens directly on the server or b) happens via fetch(some_api_route) which again means your backend accesses the DB then forwards the loaded data to the client-side. Visible to the user is only a) rendered HTML b) client-side JavaScript
– Aug 08 '22 at 11:50
2
Eventhough users wont see your API routes' codes you should still use environment variables for database credentials.
– ApakAug 08 '22 at 11:57