All subjects

WS 101 · BSIT 2nd Year

Web Systems & Technologies

Every deck from class — prelims through ship — in one page. Open a presentation, read the recap, then test yourself without leaving.

One app, growing every module

  1. MODULE 01

    You see the finished app and the map to reach it

  2. MODULE 02

    A real-looking listings page — styled, but static

  3. MIDTERM · 03

    The form works; a new card appears on click

  4. MIDTERM · 04

    The three limits of vanilla code, felt firsthand

  5. MIDTERM · 05

    You can name why frameworks exist

  6. UPGRADE · 06

    Same marketplace in Next.js — components and routes

  7. PRE-FINAL · 07

    Listings live in PostgreSQL — refresh keeps them

  8. PRE-FINAL · 08

    Photos on Cloudinary. Live URL on Vercel

How to use this page

  1. 1

    Open a presentation and step through it exactly as we did in class — the controls work the same way.

  2. 2

    Read the recap beside each module. If a line surprises you, go back into that deck.

  3. 3

    Finish with the self-check. Say the answer out loud before you reveal it.

Prelims coverage

Modules 1–4 visuals from class — orientation through the first look at the three walls. Midterm discussion decks for Modules 3–5 are in the next section.

01

Orientation

No code yet — the vision and the map

Presentations from class

What you must be able to explain

  • What the Student Marketplace capstone is, and what it must do by the end of the course
  • The eight modules in order, and what the app can do after each one
  • Why we build with plain HTML, CSS, and JavaScript before touching a framework
  • Which tool arrives in which module, and the need that makes it necessary

Lines worth memorising

Feel the problem before the solution.

You never start over — every module upgrades the same marketplace.

The video comes first; class time is lab time.

02

Build the Marketplace UI

A styled listings page — three cards, fake data

Presentations from class

What you must be able to explain

  • The eight tags the whole page is built from: html, head, body, nav, h1, p, img, div
  • How a tag works — open, content, close
  • Where the stylesheet is linked, and why the link belongs in the head
  • The three parts of every CSS rule: selector, property, value
  • Flexbox twice over: the nav bar row, and the listings grid
  • The card pattern — white background, rounded corners, soft shadow
index.htmlpage skeleton
<!DOCTYPE html>
<html>
  <head>
    <title>Student Marketplace</title>
    <link rel="stylesheet" href="style.css">
  </head>
  <body>
    <nav>
      <h1>Student Marketplace</h1>
      <a href="#" class="btn-post">+ Post an Item</a>
    </nav>
    <main>
      <h2>Available Listings</h2>
      <div class="listings-grid">
        <div class="card">
          <img src="https://placehold.co/300x200" alt="Laptop">
          <h3>Second-Hand Laptop</h3>
          <p class="price">₱8,500</p>
          <p class="description">Good condition. Charger included.</p>
        </div>
      </div>
    </main>
  </body>
</html>
style.cssnav, grid, card
nav {
  background-color: #1d4ed8;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.listings-grid {
  display: flex;
  gap: 24px;
}

.card {
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 16px;
}

Lines worth memorising

HTML is the structure. CSS is the design.

display: flex lines the cards up in a row; gap puts space between them.

justify-content: space-between pushes the title left and the Post button right.

03

Make It Interactive

A form that posts a listing to the page instantly

Presentations from class

What you must be able to explain

  • Find the elements you need with getElementById and querySelector
  • Listen for a click with addEventListener
  • Read title, price, description, and image URL with .value
  • Build a card (with photo) using createElement and innerHTML
  • Put it on the page with appendChild — no reload involved
  • Why the listing is gone after a refresh, and why that is not your mistake
app.jsthe whole flow
const postBtn    = document.getElementById('postBtn');
const titleInput = document.getElementById('itemTitle');
const grid       = document.querySelector('.listings-grid');

postBtn.addEventListener('click', function () {
  const title = titleInput.value;

  const newCard = document.createElement('div');
  newCard.className = 'card';
  newCard.innerHTML = `<h3>${title}</h3>`;

  grid.appendChild(newCard);
});

Lines worth memorising

HTML is structure, CSS is design, JavaScript is behavior.

Nothing reloads — the card is added to the page that is already open.

The listing lives in browser memory, and memory is wiped on refresh.

04

Hitting the Wall

Same app — but now you can name what is wrong with it

Presentations from class

What you must be able to explain

  • Problem 1 — data disappears on refresh, because browser memory is not storage
  • Problem 2 — a second page means copy-pasting the nav bar, and every copy can drift
  • Problem 3 — one file holds every feature, so the code gets harder to read as it grows
  • The name of each problem: no persistence, no reuse, no organization
  • The solution each problem points to: a database, components, a framework

Lines worth memorising

These are not beginner mistakes — they are the exact problems that led developers to build frameworks.

Midterm coverage

Modules 3–5 — make the marketplace interactive, feel the three walls of vanilla code, then name the solutions (components, routing, database) before Next.js.

M1

Midterm

Make It Interactive

Form + app.js — a new card appears without reloading

Presentations from class

What you must be able to explain

  • JavaScript is behavior — HTML structure and CSS design stay; JS responds to actions
  • Post form fields: title, price, description, and image URL
  • Read inputs with .value; blank image falls back to placehold.co
  • Build a card with createElement + innerHTML (photo included); show it with appendChild
  • Click a card → sessionStorage + listing-detail.html shows the same item
  • Posted cards vanish on refresh — that is browser memory, not a bug you made
app.jspost with image → card
const image = imageInput.value.trim() || 'https://placehold.co/300x200';

const newCard = document.createElement('div');
newCard.className = 'card';
newCard.innerHTML = `
  <img src="${image}" alt="${title}">
  <h3>${title}</h3>
  <p class="price">₱${price}</p>
`;
listingsGrid.appendChild(newCard);
app.jsclick → detail
function openDetail(listing) {
  sessionStorage.setItem(
    'selectedListing',
    JSON.stringify(listing)
  );
  window.location.href = 'listing-detail.html';
}

Lines worth memorising

Every listing card should show a photo — from the form URL or a placeholder.

Click opens a detail page; refresh still wipes posted data.

M2

Midterm

Hitting the Wall

Feel three limits — persistence, reuse, organization

Presentations from class

What you must be able to explain

  • Wall 1 — posted data (and photos) disappear on refresh (no persistence)
  • Wall 2 — click-to-detail works, but listing-detail.html copy-pastes the nav (no reuse)
  • Wall 3 — post, click, detail fill all pile into growing JS files (no organization)
  • sessionStorage moves one listing between pages — it is still not a database
  • Name each wall and the direction of the fix before learning Next.js
listing-detail.htmlfull page · Wall #2
<!DOCTYPE html>
<html>
  <head>
    <title>Listing Detail</title>
    <link rel="stylesheet" href="style.css">
  </head>
  <body>
    <nav>
      <h1>Student Marketplace</h1>
    </nav>
    <main>
      <img id="detail-image" src="" alt="">
      <h2 id="detail-title"></h2>
      <p id="detail-price" class="price"></p>
      <p id="detail-description" class="description"></p>
      <p><a href="index.html">← Back to listings</a></p>
    </main>
    <script src="listing-detail.js"></script>
  </body>
</html>
listing-detail.jsfill from sessionStorage
const detailImg = document.getElementById('detail-image');
const detailTitle = document.getElementById('detail-title');
const detailPrice = document.getElementById('detail-price');
const detailDescription = document.getElementById('detail-description');

const listing = JSON.parse(
  sessionStorage.getItem('selectedListing')
);

detailImg.src = listing.image;
detailImg.alt = listing.title;
detailTitle.textContent = listing.title;
detailPrice.textContent = '₱' + listing.price;
detailDescription.textContent = listing.description;

Lines worth memorising

Feel the problem before the solution.

No persistence → database. No reuse → components. No organization → framework.

M3

Midterm

Why Frameworks Exist

Ideas first — components, routing, database — then Next.js

Presentations from class

What you must be able to explain

  • A component is a reusable UI piece written once and used on every page
  • Routing means the framework maps URLs to pages without copy-pasting whole HTML files
  • A database (+ server) gives listings a permanent home outside browser memory
  • Next.js is one framework that packages those ideas for full-stack web apps
  • Your HTML, CSS, and JavaScript knowledge is the foundation — not thrown away

Lines worth memorising

Write once, use everywhere — that is the point of a component.

Next.js arrives as the answer to walls you already felt.

The Next.js upgrade

Module 6 — after midterm. Same marketplace, better home. Files are .tsx — that is what create-next-app creates now. Fake data stays fake until Pre-final Module 7.

06

After midterm

The Next.js Upgrade

Same marketplace — components, layout, two routes

Presentations from class

Hands-on activity

Step-by-step: create-next-app (tsx) → layout → ListingCard → home + detail.

Open activity

What you must be able to explain

  • Next.js is an upgrade of the same app, not a new subject
  • create-next-app now makes .tsx files — edit them, do not rename to .js
  • app/layout.tsx wraps every page — that is where the navbar lives once
  • A component is a function that returns UI; props pass title, price, description
  • app/page.tsx maps a listings array to ListingCard — you do not paste cards by hand
  • app/listings/[id]/page.tsx is one file for every detail URL — await params first
  • Link from next/link moves between pages without copying listing-detail.html
  • The array is still fake — persistence waits for Pre-final Module 7
app/layout.tsxnavbar once
export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <body>
        <nav>Student Marketplace</nav>
        {children}
      </body>
    </html>
  );
}
app/page.tsxmap + Link
{listings.map((item) => (
  <Link key={item.id} href={'/listings/' + item.id}>
    <ListingCard
      title={item.title}
      price={item.price}
      description={item.description}
    />
  </Link>
))}

Lines worth memorising

Nothing you learned is thrown away — Next.js is a better-organized home.

Write the navbar once in layout.tsx. Write the card once in ListingCard.tsx.

Fake data is correct in Module 6. A database is Pre-final Module 7.

Pre-final · Real data

Module 7 starts the pre-final period — Neon, Prisma 6, and route.ts. Post a listing, refresh, it stays. Photos and a public URL are Module 8, still this period.

07

Pre-final

Real Data

Post a listing, refresh — it is still there

Presentations from class

Hands-on activity

Step-by-step: Neon → Prisma 6 → route.ts → home + form.

Open activity

What you must be able to explain

  • This is the start of Pre-final — Wall 1 finally gets a real home
  • GET /api/listings reads. POST /api/listings writes. Same route.ts, two verbs
  • Pin Prisma 6. Neon hosts PostgreSQL. DATABASE_URL lives only in .env
  • lib/db.ts is one Prisma client — import it on the API, home, and detail
  • Home and detail read the table with findMany / findUnique
  • 'use client' + useState on /post only so the form can remember what you type
  • Detail must leave the fake array — database ids are not the old 1, 2, 3
GET vs POSTroute.ts
GET  /api/listings  → prisma.listing.findMany()
POST /api/listings  → prisma.listing.create()
app/page.tsxno fake array
export default async function Home() {
  const listings = await prisma.listing.findMany({
    orderBy: { createdAt: 'desc' },
  });
}

Lines worth memorising

Refresh keeps the listing because it is a row in PostgreSQL, not browser memory.

Never commit .env. The connection string is a password.

Deploy and ship

Pre-final · Module 8 — Cloudinary photos and a live Vercel URL. Last build module.

08

Pre-final

Deploy and Ship

Photos on Cloudinary. A URL that works on a phone.

Presentations from class

Hands-on activity

Step-by-step: Cloudinary → upload route.ts → check localhost → Vercel.

Open activity

What you must be able to explain

  • Vercel has no folder for student photos — uploaded files vanish after the request
  • Cloudinary stores the file; the database stores the URL
  • Add imageFile state + a file input on the post form before you can upload
  • Wire three places: listings create(imageUrl), ListingCard prop, home imageUrl={item.imageUrl}
  • Upload first (POST /api/upload), then save the listing with imageUrl
  • Home already reads Prisma; the form already uses relative /api/ — both work on Vercel
  • Search for localhost:3000 and delete it. Do not add a listings-url helper
  • "postinstall": "prisma generate" so Vercel can build Prisma Client
  • Paste DATABASE_URL and Cloudinary keys in Vercel before Deploy — never commit .env
  • Submit the live Vercel URL. GitHub Pages is the wrong host for Next.js
app/api/upload/route.tsfile in, URL out
const result = await new Promise<{ secure_url: string }>((resolve, reject) => {
  cloudinary.uploader.upload_stream(
    { folder: 'marketplace' },
    (error, uploaded) => error || !uploaded ? reject(error) : resolve(uploaded)
  ).end(buffer);
});
return Response.json({ url: result.secure_url });
app/post/page.tsxupload then save
let imageUrl = 'https://placehold.co/300x200';
if (imageFile) {
  const uploadData = new FormData();
  uploadData.append('file', imageFile);
  const uploadRes = await fetch('/api/upload', { method: 'POST', body: uploadData });
  imageUrl = (await uploadRes.json()).url;
}
await fetch('/api/listings', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ title, price, description, imageUrl }),
});
package.jsonVercel build
"scripts": {
  "dev": "next dev",
  "build": "next build",
  "postinstall": "prisma generate"
}

Lines worth memorising

The database stores a URL, not a file.

If the photo uploads but the card stays a placeholder, you forgot imageUrl on create or on ListingCard.

If the live home page is empty, you still hardcoded localhost — or forgot DATABASE_URL on Vercel.

Cheat sheet

The patterns most likely to appear from HTML through Module 8.

The eight tags that build the page

<html>

Root wrapper. Every page has exactly one.

<html> ... </html>
<head>

Hidden metadata: the title and the CSS link.

<title>Marketplace</title>
<body>

Everything the visitor actually sees.

<body> ... </body>
<nav>

The navigation bar across the top.

<nav><h1>...</h1></nav>
<h1>

The main heading. Big and bold.

<h1>Student Marketplace</h1>
<p>

A paragraph of text.

<p class="price">₱8,500</p>
<img>

An image. src points at the file.

<img src="photo.jpg">
<div>

A container that groups things together.

<div class="card"> ... </div>

Every CSS rule has three parts

.card {
  background-color: white;
  border-radius: 12px;
}
Selector
Who to style — here, every element with class "card".
Property
What to change — background-color, border-radius.
Value
How to change it — white, 12px.

Posting a listing, in five steps

  1. 1

    Find the elements

    document.getElementById('postBtn')
  2. 2

    Listen for a click

    postBtn.addEventListener('click', fn)
  3. 3

    Read what was typed

    titleInput.value
  4. 4

    Create the card

    document.createElement('div')
  5. 5

    Add it to the page

    grid.appendChild(newCard)

The three walls — and what each one is called

Know the problem, the name of the problem, and the solution. That is the whole of Module 4.

Problem 1

Data disappears on refresh

JavaScript keeps listings in browser memory, which is wiped every time the page reloads.

A database

Problem 2

Every page duplicates code

A second page means a second copy of the nav bar. Ten pages, ten copies, ten chances to forget one.

Components

Problem 3

No structure as the app grows

Search, edit, delete, and user tracking all land in one file, and it stops being readable.

A framework

Module 6 — the upgrade map

Same tags. Same cards. New home. Data is still fake until Module 7.

Shared chrome

app/layout.tsx

Wraps every page. Put the navbar here once — home and detail both get it.

Reusable UI

components/ListingCard.tsx

The Module 2 card as a function. Pass title, price, description as props.

Routes

app/page.tsx + app/listings/[id]/page.tsx

Home maps the array. [id] is one file for every detail URL. await params, then Link.

Module 7 — how data moves

The page asks. The API talks to Neon. Refresh keeps the row.

Database

Neon + prisma/schema.prisma

Listing rows live on Neon. DATABASE_URL stays in .env — never in Git.

API

lib/db.ts + app/api/listings/route.ts

One Prisma client. GET findMany. POST create.

Form

app/post/page.tsx

'use client' so inputs remember text. Submit writes a row, then go home.

Module 8 — how it ships

The file lives on Cloudinary. The URL lives in Neon. The app lives on Vercel.

Photos

Cloudinary + app/api/upload/route.ts

The file goes to Cloudinary. The listing row stores the URL — Vercel has no upload folder.

Safety check

No localhost:3000 in the repo

Home already calls Prisma. The form already uses /api/listings. Delete any leftover laptop URL.

Host

Vercel + postinstall

Paste env vars before Deploy. prisma generate in postinstall so the build can see Prisma Client.

Check yourself

Answer out loud first, then reveal. If you can explain all of these without notes, you are ready.