ABCsteps lesson path
Frontend and Backend: The Full Picture
Map the browser, server, and database responsibilities before building a leaderboard system. Build one artifact, keep one review trail, and make the work easy to inspect later.
- Lesson
- 12
- Time
- 45 min
- Access
- public lesson
Learning objective
Separate browser, server, and storage responsibilities clearly.
Lab outcome
Draw and implement the first full-stack boundary.
Module milestone
Build a small full-stack leaderboard with persistent data.
Lesson proof workflow
Read, build, then review the evidence.
- Step 1ReadStart with Frontend backend split before touching tools.
- Step 2BuildBuild toward: Draw and implement the first full-stack boundary.
- Step 3ReviewReview the evidence using API contracts.
Toolchain
Full-stack thinking separates browser, server, and storage jobs.
These are the practical surfaces used in this lesson. Learn the habit first, then connect it to the wider engineering ecosystem.
Represent the browser-side layer clearly.
Handle logic and API boundaries on the server side.
Keep frontend and backend data agreements explicit.
Proof of work
Leave one inspectable trail from this lesson.
The useful output is not a passive note. It is a small artifact another person can inspect: a working file, a command result, a commit, a screenshot, a README note, or a demo link.
Lesson lab: Draw and implement the first full-stack boundary.
Tool and platform logos are ecosystem references only: no affiliation, endorsement, interview access, hiring promise, salary promise, or placement guarantee.
Build
Produce the artifact
Complete the lab and keep the result visible: Draw and implement the first full-stack boundary.
Record
Save review evidence
Capture what changed, what broke, and how Frontend backend split became clearer through the work.
Explain
Write the vocabulary
Use your own words for System boundaries and API contracts; this is what makes the lesson inspectable later.
Skills companies recognize
Translate the lesson into inspectable work language.
This lesson turns one small lab into the language a learner can use in a README, demo note, or technical conversation. The point is not to collect logos; the point is to explain work clearly enough that another engineer can inspect it.
Where this skill appears
Full-stack teams screen for boundary thinking because unclear responsibilities create fragile products.
Ecosystem references
Platform and company logos are ecosystem references only: no affiliation, endorsement, interview access, hiring preference, salary outcome, or placement guarantee.
README line
Name the artifact
Lab proof: Draw and implement the first full-stack boundary. Connect it to Frontend backend split so the result reads like work, not a passive note.
Review line
Explain the stack
Use Vue.js, Node.js, JSON to explain System boundaries and what changed between the first attempt and the inspected result.
Conversation line
Answer with evidence
If a team asks about API contracts, use this proof line: Show a diagram or README section that separates browser, server, data contract, and storage responsibilities.
Proof translation
Skill signal
Frontend backend split is the market word. The lesson makes it visible through a small working artifact.
Proof artifact
The inspectable artifact is: Draw and implement the first full-stack boundary.
Interview answer
Use System boundaries and API contracts to explain what changed, what failed, and how you verified it.
Paid guidance
Read publicly. Upgrade when guidance will help you finish.
This lesson remains part of the public written syllabus. Paid help is online-only and human-led: video walkthroughs as they roll out, live class context, WhatsApp Q&A, and project review around the same work.
No account wall, automated checkout, or placement promise is introduced here. Enrollment stays human-led by WhatsApp or call, and the useful proof remains the learner's own artifact.
Public
Written lesson stays open
Read the prepare and review material for lesson 12 on the public site before buying anything.
Recorded
Recorded and live guidance clarify the work
Paid guidance can add founder-led video walkthroughs as they roll out and live online class context; the teaching explains the work, but does not replace the written lesson.
Human
Questions use real context
When stuck, useful guidance starts from the route, error, screenshot, repo fragment, and the lab artifact: Draw and implement the first full-stack boundary.
Phase 1 · Briefing
Lesson briefing
Before You Study (5 mins)
Lesson focus: Every web application — Instagram, your bank, Netflix, the small e-commerce shop your cousin runs — is a system with three roles split across at least two physical machines: a frontend that runs in the user's browser or app, a backend that runs on a server you control, and (in Lesson 14) a database that persists data. Today we cleanly separate these roles. By the end, you will have built a Node.js + Express backend running alongside your Snake game frontend, and you will be able to articulate, with no fuzziness, why certain code lives on the server and certain code lives in the browser.
What you should have ready:
- Node.js installed (
node --versionshould print 18 or higher) - Your Snake game (the frontend you've been building)
- Lesson 11's
ai.jsfrom yesterday — we'll reuse the LLM call from a backend route - About 60 minutes
- An
npm init -yready to run in a freshbackend/directory
The Concept
A web application's code lives in at least two places, and the boundary between them is one of the most important architectural distinctions you will learn:
┌────────────────────────┐ ┌────────────────────────┐
│ FRONTEND │ HTTP requests (JSON) │ BACKEND │
│ (browser / mobile) │ ◀─────────────────────▶ │ (your server) │
│ │ │ │
│ • HTML / CSS / JS │ │ • Node.js + Express │
│ • What user sees │ │ • Business logic │
│ • User input handling │ │ • Auth & sessions │
│ • Visual rendering │ │ • Talks to DB │
│ • Lives on the user's │ │ • Calls 3rd-party APIs│
│ device │ │ • Lives on a server │
│ │ │ you control │
└────────────────────────┘ └────────────────────────┘
Public — anyone can Private — only you
view source code and your team see it
The reason this split exists is simple: anything you put in the frontend is visible to every user. If you write your LLM API key into a <script> tag, someone can open DevTools, copy your key, and burn through your provider quota by tomorrow morning. If you compute a "10% off" discount in JavaScript, anyone can change it to 100%. If you check if (user.role === "admin") in the browser, the user can edit user.role in DevTools and become an admin.
The inverse is also true: the backend cannot run on the user's screen. It has no DOM, no clicks, no visual rendering. The server's job is to execute logic, talk to other servers, and return data. The frontend's job is to render that data and capture user intent.
Three categories of code, and where each one belongs:
| Category | Lives on | Why |
|---|---|---|
| Rendering UI | Frontend | Only the browser has a screen and a DOM |
| User input handling | Frontend | The user clicks/types in the browser |
| Business logic / rules | Backend | The user can't tamper with code on a server they can't see |
| Database queries | Backend | The DB credentials and connection live on the server |
| Calling 3rd-party APIs with secrets | Backend | API keys must never leave the server |
| Auth checks (real ones) | Backend | The frontend can lie; the backend cannot |
| Form validation (UX) | Both | Frontend for instant feedback; backend for the actual rule |
The two halves communicate over HTTP, almost always with JSON bodies. The frontend sends a request (POST /api/scores with { "name": "Divyanshu", "score": 100 }), the backend processes it (validates, stores in DB, computes a response), and sends back JSON ({ "rank": 4, "topScores": [...] }). This is the same request-response cycle from Lesson 09 — but now you control both ends.
The third role — database — is the persistence layer. The backend talks to it; the frontend never does directly. We add this in Lesson 14.
The most common architectural mistake in early full-stack work is putting backend code in the frontend (exposing API keys, computing prices in JavaScript, checking auth in the browser) or putting frontend code in the backend (returning HTML strings instead of JSON). The boundary is the contract; respect it and the system stays clean.
Quick Concepts
| Term | Simple Meaning |
|---|---|
| Frontend | Code that runs in the browser; the user can see it |
| Backend | Code that runs on a server you control; users can only call it via HTTP |
| Server | A computer that listens on a network port for incoming requests |
| Client | The party making the request — usually a browser, sometimes another server |
| Express.js | The most popular Node.js framework for building HTTP servers |
| Endpoint | A specific path on your server (/api/scores, /api/login) |
What We Will Build
By the end of this lesson, you will have done these specific things:
- Created a
backend/directory alongside your Snake game's frontend, rancd backend && npm init -yto initialize a Node.js project. Inspected the resultingpackage.json. - Installed Express:
npm install expressandnpm install --save-dev nodemon. Read thepackage.jsondependenciesfield — recognize that this is JSON (Lesson 08's lesson paying back). - Wrote your first server in
backend/server.js:(Note: injavascriptimport express from 'express' const app = express() app.use(express.json()) // parse JSON bodies app.get('/', (req, res) => { res.json({ message: 'Hello from your backend!' }) }) app.get('/api/health', (req, res) => { res.json({ status: 'ok', uptime: process.uptime() }) }) const PORT = 3001 app.listen(PORT, () => console.log(`Backend running on http://localhost:${PORT}`))package.jsonadd"type": "module"so theimportsyntax works.) - Ran the server with
node server.js. Visitedhttp://localhost:3001in your browser. Saw the JSON response. Usedcurl http://localhost:3001/api/healthto confirm from the terminal. - Set up
nodemonfor hot reload: inpackage.json, add"dev": "nodemon server.js"to the scripts, then runnpm run dev. Edit a string in your route handler. Watch the server auto-restart. - Added your first cross-origin call from the frontend. In your Snake game's HTML, add a button "Test backend" that calls
fetch('http://localhost:3001/api/health')and displays the result. Discovered the CORS error in the browser console (Cross-Origin Resource Sharing — the browser blocks frontend-on-port-3000 from calling backend-on-port-3001 by default). - Solved CORS by installing
corsand adding two lines to your server:Reloaded the page. Watched the call succeed. Noted that this is the precise moment most full-stack newcomers get stuck — and now you've solved it deliberately.javascriptimport cors from 'cors' app.use(cors()) - Moved the LLM call from Lesson 11 into a backend route: created
POST /api/ai-tipthat takes{ prompt: "..." }, calls the Gemini API server-side (with the API key safely on the server, not exposed to the browser), and returns the response. Added a "Get AI tip" button on the game's loading screen that calls this endpoint.
Step 8 is the architectural moment. The browser sends a prompt to your backend. Your backend uses your secret key to call the model. The browser never sees the key. This is the shape of every production AI app.
Think About
Before studying, consider:
- If your Snake game's leaderboard saved scores in
localStorage(the browser's local storage), every player sees only their own scores — there is no shared leaderboard. What would have to be true for two players on different devices to see each other's scores? (A shared place where both browsers can write. That place is the backend talking to a database. Module C lessons 13-15 build it.) - Imagine your backend is on a different continent — Tokyo, while your user is in Mumbai. The HTTP round trip is ~150ms. How does that change what kind of work you'd want on the backend vs. inline in the browser? (Hint: things that don't need to feel instant — like saving a score — are fine on the backend; things that need to feel instant — like rendering the snake's next position — must be in the frontend.)
By the End
After this lesson, you'll:
- ✅ Have a Node.js + Express backend running on port 3001
- ✅ Have a frontend (your game on port 3000) successfully calling that backend
- ✅ Have solved your first CORS error deliberately
- ✅ Be able to articulate which code belongs in the frontend vs. backend
- ✅ Have moved your LLM call to the backend so your API key is server-side
- ✅ Understand what
reqandresare in an Express handler - ✅ Be ready for Lesson 13 — making your backend into a real REST API
Two halves, one application. The boundary is the contract. 🧠
Next lesson · 13
Create Your Own API
Build an Express.js server to receive and return data so the app can do more than display a static screen.