+
+ Welcome to Backend Development
+ 🍵
+
+
+
+ Frontend vs Backend
+
+ Frontend: Write code, refresh
+ browser, see buttons and colors
+
+
+ Backend: Write code, run it... see
+ text in a terminal
+
+ Where did my pixels go?
+
+
+
+ Here's the thing...
+ Terminals existed before graphical interfaces
+ The command line isn't a step backward
+
+ It's where serious computing has always happened
+
+
+
+
+ Get comfortable with it
+ $ node index.js
+Server running on port 3000
+GET /api/teas - 200 OK (12ms)
+GET /api/teas/42 - 200 OK (3ms)
+POST /api/orders - 201 Created (45ms)
+ This is your new feedback loop
+
+
+
+ What is Data?
+ Before we manipulate it, let's understand it
+
+
+
+ Data is structured information
+ The same information can look different
+ Let's look at 3 teas from our tea shop...
+
+
+
+ As a Table
+
+
+
+ | id |
+ name |
+ origin |
+ pricePerGram |
+ organic |
+
+
+
+
+ | 1 |
+ Sencha |
+ Japan |
+ 0.12 |
+ true |
+
+
+ | 2 |
+ Earl Grey |
+ India |
+ 0.08 |
+ false |
+
+
+ | 3 |
+ Dragon Well |
+ China |
+ 0.25 |
+ true |
+
+
+
+
+ Familiar. Easy to read. Not great for computers.
+
+
+
+
+ As CSV
+ id,name,origin,pricePerGram,organic
+1,Sencha,Japan,0.12,true
+2,Earl Grey,India,0.08,false
+3,Dragon Well,China,0.25,true
+ Compact. Good for spreadsheets and imports.
+
+
+
+ As JSON
+ [
+ { "id": 1, "name": "Sencha", "origin": "Japan", "pricePerGram": 0.12, "organic": true },
+ { "id": 2, "name": "Earl Grey", "origin": "India", "pricePerGram": 0.08, "organic": false },
+ { "id": 3, "name": "Dragon Well", "origin": "China", "pricePerGram": 0.25, "organic": true }
+]
+
+ JavaScript's native format. This is what we'll use.
+
+
+
+
+ As JSONL (JSON Lines)
+ {"id":1,"name":"Sencha","origin":"Japan","pricePerGram":0.12,"organic":true}
+{"id":2,"name":"Earl Grey","origin":"India","pricePerGram":0.08,"organic":false}
+{"id":3,"name":"Dragon Well","origin":"China","pricePerGram":0.25,"organic":true}
+
+ One object per line. Great for streaming large datasets.
+
+
+
+
+ Same Data, Different Formats
+ The information is identical
+
+ Only the representation changes
+
+ We'll primarily work with JSON
+
+
+
+
+
+ Week 1: Array Methods
+ The application layer's daily bread
+ filter, map, reduce
+ Transform data between "as stored" and "as served"
+
+
+
+ Week 1: Real Example
+
+ You search for "green tea". Database returns 200 matches. But you
+ only want organic ones, sorted by price, showing just name and
+ price.
+
+
+ filter → sort →
+ map
+
+ Three lines of code. Happens on every request.
+
+
+
+ Week 2: Callbacks & Async
+ Why backends can't run top-to-bottom
+ Databases are slow. Networks are slow.
+
+ "Do this slow thing, here's what to do when you're done"
+
+
+
+
+ Week 2: Real Example
+
+ A cafe orders 50 teas. Check inventory, calculate shipping, charge
+ card, send email. If each step takes 500ms and you wait frozen...
+ that's 2 seconds. Meanwhile 100 other customers can't browse.
+
+ Callbacks let you handle other requests while waiting
+
+
+
+ Week 3: Promises & APIs
+ Speaking to other services
+ Backends rarely work alone
+
+ Payment providers, email services, external APIs
+
+
+
+
+ Week 3: Real Example
+
+ Customer checks out. Call Stripe for payment, PostNord for
+ shipping, inventory service to reserve stock. Three external
+ calls, any could fail.
+
+ "Do all three, if any fails, handle it gracefully"
+ Try writing that with nested callbacks...
+
+
+
+ Week 4: Classes
+ Modeling your domain
+ A tea isn't just a floating object
+
+ It has behaviors: validate itself, calculate weight, check stock
+
+
+
+
+ Week 4: Real Example
+
+ Every time you handle a tea: Is price valid? Stock above zero?
+ Steep time reasonable? You write these checks 50 times across your
+ codebase.
+
+ With a Tea class, you write them once
+ The logic lives with the data it protects
+
+