Skip to main content
Reading progress: 0%

Lesson 4.1: How Apps Work and Selecting a Tech Stack

Lesson Quick-Jump (10 Sections)

1. What Are We Learning?​

In this lesson, you will learn how to:

  • Understand the four core pieces of most web applications: frontend, backend, APIs, and databases.
  • Understand what a technology stack (tech stack) is.
  • Select a simple, beginner-friendly tech stack appropriate for your MVP—without getting swept up in hype.

2. Why Does It Matter?​

info

If you ask an AI agent to choose a tech stack without guidance, it often recommends complex enterprise architectures meant for companies with 50 engineers (separate microservices, message queues, heavy cloud infrastructure). That unnecessary complexity makes setup painful, debugging confusing, and deployment expensive.

Understanding how the pieces fit together empowers you to pick the simplest reliable stack that solves your problem.


3. Simple Explanation for a Complete Beginner​

Imagine visiting a restaurant:

  1. The Frontend (The Dining Room & Menu): Everything the customer sees and touches—tables, menu, order button. In a web app, this runs inside the user's browser (using HTML, CSS, and JavaScript/TypeScript).
  2. The API (The Waiter): You don't walk into the restaurant kitchen yourself to grab food from the stove. The waiter takes your structured order to the kitchen and brings back the kitchen's response. An API (Application Programming Interface) is the messenger between the frontend and backend.
  3. The Backend (The Kitchen): Hidden from customers. It verifies orders, checks permissions (are you allowed to see this?), runs business rules, and talks to storage.
  4. The Database (The Pantry & Ledger): Where ingredients and records live permanently so nothing disappears when the restaurant closes for the night.

A Tech Stack is simply the specific tools you pick for each layer (for example: React/Next.js or plain HTML/JS for frontend, Node.js or Python for backend, SQLite or PostgreSQL for database).


4. Practical Example​

Let's compare two projects so you see why stack choice depends on the MVP:

Case A: Single-user Daily Habit Tracker (No multi-device sync yet)

  • Could run entirely in the browser with localStorage, OR use a simple full-stack framework with a single-file database like SQLite.
  • Does it need separate frontend and backend servers, Docker containers, or Redis? No. One unified project keeps setup and deployment easy.

Case B: Bookmark & Reading Vault (Users log in from phone & laptop)

  • Needs real user accounts, private saved bookmarks per user, and a persistent database.
  • A solid beginner-friendly stack:
    • Frontend + Backend together (Full-stack web framework) or clean Frontend + Python/Node API
    • Database: PostgreSQL (managed cloud Postgres) or SQLite (for small single-server apps)
    • Why: Well-documented, widely supported by every AI coding agent, easy to host, zero exotic setup.

5. Step-by-Step Instructions​

  1. Check your PRD from Phase 2 and answer 4 key questions:
    • Does my app need user accounts / login, or is it single-user / local?
    • Does data need to be shared across devices or users?
    • Does my app call external APIs (like payments, email, or AI models) that require secret keys? (Mandatory rule: secret API keys must NEVER live in frontend code—if you have secret keys, you MUST have a backend!)
    • Are there heavy background jobs or real-time multiplayer updates?
  2. Ask AI to propose 2–3 simple tech stack options tailored to your answers—explicitly asking for the simplest boring option with strong documentation.
  3. Compare the options on three criteria:
    • Number of moving parts to run locally (fewer is better for beginners).
    • Ease of deployment on standard beginner-friendly platforms.
    • How easy it is to inspect and read the code.
  4. Lock in one stack before moving to Lesson 4.2.

6. Ready-to-Use AI Prompt​

Context:
I am selecting a technology stack for my MVP. I am a beginner working with an AI coding agent and want the simplest, most reliable, mainstream stack—not enterprise over-engineering.

My MVP requirements summary:
- Core features: [list 3-4 MVP features]
- Needs user accounts/login? [Yes / No]
- Needs to store data across devices? [Yes / No]
- Needs secret API keys or backend logic? [Yes / No]

Objective:
Recommend 2 straightforward, beginner-friendly tech stack options and explain the tradeoffs clearly.

Boundaries:
- Avoid microservices, Kubernetes, complex monorepos, or obscure brand-new frameworks.
- Prefer widely used, well-documented tools that minimize the number of separate servers I must manage.
- Explain every technical term simply.

Expected Output:
1. Option A (Simplest possible) vs. Option B (Standard full-stack), showing Frontend, Backend, Database, and Hosting fit.
2. Pros, cons, and approximate complexity of each for a beginner.
3. Your concrete recommendation based on my MVP answers—and what could force me to outgrow it later.

7. What to Expect from the AI Agent​

Good ResponseWarning Sign
The AI explains why a unified full-stack framework or simple frontend+API fits your exact needs, warns you if you need a backend to protect secret keys, and avoids buzzwords.The AI proposes 6 different cloud services, message brokers, or GraphQL + microservices for a 3-screen CRUD app. Push back: "Too complex for an MVP. Give me a single-app or two-part setup with minimal moving pieces."

8. What You Must Personally Verify​

  • Are secret keys protected? If your app uses any paid or private API key, verify your chosen architecture puts that call on the backend, never inside browser frontend code.
  • Do you understand the role of every piece in your chosen stack? You don't need to know the syntax yet, but you should be able to point to each item and say "That draws the screen, that handles rules/auth, that stores data."
  • Is the stack widely supported? Mainstream, boring technologies (like standard JavaScript/TypeScript, Python, SQL databases) produce far fewer AI hallucinations than niche tools.

9. Common Mistakes​

  1. Chasing trendy tools: Using a brand-new framework released last month means both documentation and AI knowledge are weak. Boring and proven wins.
  2. Splitting frontend and backend unnecessarily: Maintaining two completely separate repositories and servers doubles deployment friction if a unified framework handles both cleanly—though separate frontend + backend is fine when intentional.
  3. Putting database queries or secret keys in the frontend: Anyone can inspect browser code (View Source / DevTools). Sensitive logic belongs on the backend.

10. Small Practical Exercise​

  1. Answer the 4 questions in Step 1 for your MVP.
  2. Run the AI prompt above to compare 2 simple stack options.
  3. Pick your winner and write 3 sentences in your own words explaining:
    • What runs in the browser (Frontend)
    • What runs on the server (Backend, if applicable)
    • Where data lives permanently (Database)

Completed the exercise? Track your progress

Check off this lesson in PROGRESS-CHECKLIST.md once you have verified every step in Section 8.