Stop 14 · Deployment & PerformanceProjects · 1/1

Deploy a Full-Stack App Live

Part of the Web Development Roadmap

In short

A live URL that works end to end, sign-up to logout, is the strongest proof on your resume. This project puts the frontend, backend and database of your notes app on the internet, talking to each other.

Deploy your notes app end to end: frontend on a static host, backend on a server platform and database on a hosted service, all connected with environment variables and a working URL.

The jaadu cuts a ribbon at the doorway of a brightly decorated new restaurant, with marigold garlands hanging above the entrance.

Think of it like this

Opening a restaurant on launch day

The kitchen works perfectly at home, but launch day is different: the dining room opens on the main road, the kitchen moves to a commercial space, the cold store comes from a supplier. Everything must be connected with the right addresses and phone numbers, or orders get lost. Deployment is moving your app's three parts out and wiring them together.

Watch it happen

The order to deploy in

Database
Backend
Frontend
Connect
Test live

1/5Create the hosted database first, since the backend needs its URL.

The big ideas

What you need to know

Config, not code changes

URLs and secrets come from environment variables, so the same code runs locally and live.

CORS and cookies

Different domains for frontend and API need CORS with credentials: true and cookies set with secure: true and sameSite: "none".

Use the host's port

Platforms tell your app which port to use: listen on process.env.PORT, with a local fallback.

Read the logs

When the live site breaks, the backend host's logs and the browser's Network panel show you why.

See it in code

Walk through the code

js
1// server/index.js (production-ready bits)2const allowed = process.env.CLIENT_URL || "http://localhost:5173";3app.use(cors({ origin: allowed, credentials: true }));4 5const isProd = process.env.NODE_ENV === "production";6const cookieOptions = {7  httpOnly: true,8  secure: isProd,9  sameSite: isProd ? "none" : "lax",10};11 12const port = process.env.PORT || 4000;13app.listen(port, () => console.log("API listening on " + port));14 15// client/src/api.js16const API = import.meta.env.VITE_API_URL || "http://localhost:4000";17export const getNotes = () =>18  fetch(API + "/api/notes", { credentials: "include" }).then((r) => r.json());

1/4Allow only your real frontend's address, and allow cookies to be sent.

The handful of lines that usually break on deploy. Note that Vite only exposes variables that start with VITE_, and they're baked in at build time.

Save yourself the pain

Common mistakes

Oops

Leaving http://localhost:4000 hard-coded in the React app.

Do this instead

Visitors' browsers can't reach your laptop. Use VITE_API_URL and set it on the frontend host before building.

Oops

Testing only the homepage after deploying.

Do this instead

Walk through every feature live: sign-up, login, refresh while logged in, create, edit, delete, logout.

Your mission

Ship it

~180 min

Quick check

The live React app gets a CORS error calling the API. What's the most likely fix?

Go deeper

  1. 1Test sign-up, login and every feature on the live site, not just locally.
  2. 2Add the live link and a short architecture note to the README.
  3. 3Ask two friends to try it on their phones and fix what confuses them.

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge