All jobs / Full-stack developer / DevOps Basics
Full-stack developer interview question · 0–1 years
Someone wants to put the API URL and the database password in `.env` for Vite.
What can go in the frontend env?
The strongest answer
The public API base URL — anything in a `VITE_` / `NEXT_PUBLIC_` variable is visible in the downloaded JS
Why it works
Exactly. Frontend env is not a secret store. Put only what a stranger with View Source may see.
What a good answer covers
- Frontend env is public by construction.
- API origin, feature-flag client key — maybe.
- Database, payment, admin tokens — never.
- If it must stay secret, it never ships in JS.
Answers that fall short
- Close, but not the strongest: The database password, prefixed so Vite inlines it at build time
A build-time prefix is how secrets get published to every visitor. - Weak: The Stripe secret key; the bundle is minified so it is safe
Minification is not encryption. Secret keys stay on the server. - Red flag: A long-lived admin JWT so the UI can 'just work' in demos
A demo admin token in the bundle is a production incident waiting for a crawl.
Who gets asked this
More DevOps Basics questions
- A user says 'save failed'. You have UI logs and API logs and no join. How do you trace one click?
- You are deploying a SPA and its API for the first time on the same domain. How do you host them?
- How do you make it smaller, and what should not be in it at all?
- APM shows fast API spans. Users still wait two seconds after click. How do you see one click in the tracer?
- The pipeline builds the client three times, once per environment, because the API URL is baked in at build…
- A feature flag has been on for everyone for four months. Both code paths are still there. When is the flag…
- Every PR gets a preview URL. The default env still has the production API base. What must a preview deploy…
- Prod: 'submit does nothing'. API dashboards look calm. The SPA error rate ticked up after a mixed deploy…