JAM.26
ARCHIVE / DAY 2 / Full-Stack Development & Debugging
YOUR EXERCISE_
SEASON 2026 // DAY 02 OF 03
ai-programming-jam.shoug-tech.com / workshops / day-2
README.md

# Full-Stack Development
and Debugging

Yesterday you learned how to move from requirements to a planned, locally running application. Today that application becomes full stack: users can sign in, data can persist, and the app can behave differently for different accounts.

You will connect Firebase Authentication and Cloud Firestore, learn how user identity connects to application data, and practice debugging full-stack problems using real evidence from DevTools and Firebase.

The goal is not simply to "make Firebase work." The goal is to understand the path from interface to application logic to authentication to database and know where to investigate when one layer fails.

Today you'll practice
Auth → Persistence → Ownership → Debugging
You'll use
Firebase Auth, Firestore, DevTools, Codex, Claude Code
By the end
A working authenticated feature with persistent user data
00

## Before You Start

Day 2 builds directly on the workflow from Day 1. Flag an instructor if one of these is not working before the practical portion begins.

Bring the project you worked on during Day 1. The instructor example continues the Study Task Tracker, while the participant exercise continues the Campus Event Board.
Accounts
Firebase / Google account GitHub Claude OpenAI / Codex
Software
Visual Studio Code Git Node.js npm Modern Browser Claude Code Codex
Workshop standard: everyone will use Firebase Email/Password Authentication today. Standardizing the authentication path makes setup and debugging much easier for a beginner workshop.
01

## Authentication vs Application Data

Authentication and application data are related, but they solve two different problems.

Authentication answers "Who is this user?"  |  Firestore answers "What should the application remember?"
Authentication
  • Creates and identifies users
  • Maintains sign-in state
  • Provides a unique user ID
  • Handles credentials and authentication errors
Application Data
  • Stores tasks, events, records, and other app information
  • Persists beyond a page refresh
  • Can be associated with a user ID
  • Must be protected by appropriate database rules
Never store user passwords manually in Firestore. Firebase Authentication is responsible for credentials.
02

## Firebase Authentication

Firebase Authentication gives your application a reliable way to know who is using it.

Sign Up → Firebase Authentication → User Account → User ID → Application

What the application should know

IMAGE
Firebase Authentication Screenshot
Add a screenshot showing Email/Password authentication enabled in the Firebase console.
03

## Persistent Data with Firestore

Cloud Firestore stores application data so it survives refreshes and future sessions.

  • Collection: a group of related documents
  • Document: one stored record
  • Field: a value inside a document
  • Create data
  • Read data
  • Update data
  • Delete data
  • Use document IDs and ownership fields
User Action → Interface → Application Logic → Firestore → Stored Data

A simple task document

Firestore document model tasks / task-id
{
  "title": "Finish project outline",
  "course": "CS 101",
  "dueDate": "2026-09-10",
  "completed": false,
  "ownerId": "firebase-user-id"
}
Persistence test: create data, refresh the browser, and confirm the data is still there. If refresh destroys your data, it is not actually persistent yet.
IMAGE
Firestore Console Screenshot
Add a screenshot showing the example collection, documents, fields, and ownerId.
04

## User Ownership & Security Rules

Authentication becomes useful when application data can be associated with the correct user. The Firebase user ID provides that connection.

A QUERY IS NOT A SECURITY BOUNDARY.

Filtering by ownerId controls what your interface requests. Firebase Security Rules control what the database is actually willing to return or modify.

Frontend Query

"Only request documents where ownerId matches the current user."

Security Rules

"Reject requests for records the authenticated user does not own."

Authenticated User → UID → Query + Security Rules → User's Firestore Data

Security mindset

05

## Debugging Full-Stack Applications

Full-stack debugging becomes much easier when you identify which layer is failing before changing code.

Expected → Observed → Evidence → Hypothesis → Fix → Test → Verify

First locate the failing layer

debugging map follow the request
UI
 ↓
Application Logic
 ↓
Authentication
 ↓
Firestore Request
 ↓
Security Rules
 ↓
Database

What to check before changing code

Do not debug five layers at once. Confirm what is working, locate the first layer that fails, then investigate there.
06

## Hooks & Workflow Automation

Optional / If Time Allows

Once you have repeated a workflow enough times, you may notice checks or actions that are worth automating. Hooks can remove useful repetition from an AI-assisted development workflow.

Use AI → Observe Workflow → Identify Repetition → Automate Carefully

Example useful automation

example workflow after code changes
AI modifies code
      ↓
Run lint / tests
      ↓
Report failures
      ↓
Developer reviews result
Hooks are a bonus topic. If Firebase setup or debugging needs more time, skip this section and return to it later.
07

## Prompt Templates You Can Use

Use these as starting structures. Replace the bracketed fields with real evidence and project context.

01 / plan Firebase integration
I want to add Firebase to this application. For this workshop I need: - Email/password authentication - Persistent Firestore data - Data associated with the authenticated user - Firebase Security Rules that protect user-owned data Before modifying anything, inspect the existing project. Explain: 1. How Firebase should integrate with the current structure 2. Which files will likely need to change 3. Which dependencies are required 4. Which Firebase console settings I must configure 5. Which client configuration values are needed 6. How user ownership should be represented in Firestore 7. How Security Rules should protect the data Do not implement anything yet.
Use this: before implementation so the assistant understands the project and the intended security model.
02 / implement authentication
Implement email/password authentication for this project. Required behavior: - A user can create an account - A user can sign in - A user can sign out - The app can detect authentication state - The interface responds appropriately when no user is signed in - Authentication errors are shown clearly to the user First inspect the existing project and identify the relevant files. Do not rewrite unrelated functionality. After implementation, explain: 1. What changed 2. How authentication state is handled 3. What I should test 4. Any remaining assumptions or risks
Use this: after Firebase is configured and you are ready to add authentication behavior.
03 / implement user-owned Firestore data
I want to persist the following application data in Firestore: [DATA TYPE] Requirements: - Records must survive page refreshes - Each record must store the authenticated user's UID as ownerId - The app should request only records owned by the current user - Firebase Security Rules must prevent one authenticated user from reading or modifying another user's records Before changing code, inspect the current data flow and explain the proposed Firestore structure. Then implement the smallest appropriate change. After implementation, tell me how to test this using two different accounts.
Use this: when converting local-only data into persistent, user-owned Firestore data.
04 / debug with evidence
I am debugging the following problem. Expected behavior: [EXPECTED BEHAVIOR] Actual behavior: [ACTUAL BEHAVIOR] Browser console: [ERROR OR OUTPUT] Network information: [RELEVANT INFORMATION] Firebase / Firestore information: [RELEVANT INFORMATION] Authentication state: [SIGNED IN? USER ID?] Other context: [CONTEXT] First identify which layer is most likely failing: - UI - Application logic - Authentication - Firestore request - Security Rules - Database Explain what evidence supports your diagnosis before changing code. Then propose the smallest appropriate fix and tell me exactly how to verify it.
Use this: when something fails. The goal is diagnosis before modification.
05 / discover useful hooks
Based on how I have been using Claude Code in this project, identify repetitive actions or checks that could be automated with hooks. Suggest only hooks that would improve productivity, code quality, testing, or debugging. For each suggestion, explain: 1. What triggers the hook 2. What the hook would do 3. Why it would be useful 4. Any disadvantages or risks Do not implement anything yet.
Use this: only after you have enough real workflow repetition to analyze.
08

## Worked Example

The instructor will continue the Study Task Tracker from Day 1 and turn it from a local-only frontend into an authenticated application with persistent, user-owned tasks.

Study Task Tracker → Sign Up → Sign In → Save Tasks → ownerId → Security Rules → Sign Out → Sign In Again → Tasks Persist

The complete walkthrough

  1. Open the Study Task Tracker from Day 1 and verify it still runs locally.
  2. Confirm that task data is currently local-only and disappears when appropriate.
  3. Create or open a Firebase project.
  4. Register the web application with Firebase.
  5. Install and initialize Firebase in the project.
  6. Enable Email/Password Authentication.
  7. Implement user registration.
  8. Implement sign-in and sign-out.
  9. Display the appropriate interface based on authentication state.
  10. Create a Cloud Firestore database.
  11. Design a simple task document structure.
  12. Store a task in Firestore.
  13. Attach the authenticated user's UID as ownerId.
  14. Retrieve only the current user's tasks.
  15. Add or review Security Rules for user-owned task data.
  16. Refresh the page and verify tasks persist.
  17. Test with a second account.
  18. Verify one account cannot access another account's private tasks.
  19. Introduce or encounter a real failure.
  20. Locate the failing layer using DevTools and Firebase evidence.
  21. Give that evidence to Codex or Claude Code.
  22. Evaluate the diagnosis and proposed fix.
  23. Apply the fix.
  24. Test again and verify the behavior.
  25. Commit the working result to GitHub.
IMAGES
Worked Example Screenshots
Add screenshots showing Authentication, Firestore data, Security Rules, DevTools evidence, and the working Study Task Tracker.
VIDEO
Instructor Demo Recording
Add the Day 2 walkthrough recording here when it is ready.
Watch the transformation: Local Website → Authenticated Application → Persistent Data → User-Owned Data → Debugged Full-Stack Feature.
09

## Your Exercise

Continue the Campus Event Board from Day 1 and convert it into a full-stack application.

Your target

Campus Event Board → Account → Saved Events → ownerId → Security Rules → Persistence

Steps

  1. Open your Campus Event Board from Day 1.
  2. Verify the project runs locally.
  3. Create or configure a Firebase project.
  4. Connect Firebase to the application.
  5. Enable Email/Password Authentication.
  6. Implement user registration.
  7. Implement sign-in.
  8. Implement sign-out.
  9. Make the interface respond appropriately to authentication state.
  10. Create a Firestore database.
  11. Store event data in Firestore.
  12. Add the authenticated user's UID as ownerId when appropriate.
  13. Retrieve the correct event data for the authenticated user.
  14. Add or review Security Rules that protect user-owned records.
  15. Refresh the app and verify persistence.
  16. Sign out and sign back in.
  17. Verify the correct data still appears.
  18. Create or use a second account.
  19. Verify private user-owned data is not exposed across accounts.
  20. Use DevTools and Firebase evidence to investigate any errors.
  21. Use Codex or Claude Code to assist with diagnosis if needed.
  22. Test every proposed fix before trusting it.
  23. Commit the working checkpoint to GitHub.

You are done when...

10

## Troubleshooting

When something fails, locate the layer before changing code.

If this happens

Firebase fails immediately after setup

Likely causes Incorrect initialization, missing dependencies, configuration mistakes, environment configuration problems, or the wrong Firebase project.
What to do Check browser console output, terminal output, installed packages, Firebase initialization, and the exact project configuration. Determine whether Firebase itself is unreachable or only one Firebase service is failing.
If this happens

Sign-in works, but Firestore reads or writes fail

Likely causes Firestore configuration, incorrect collection paths, Security Rules, malformed data, or a query problem.
What to do Confirm authentication works independently. Then inspect the exact Firestore request, browser error, collection path, user ID, and Security Rules.
If this happens

A user sees another user's private data

Why it happens Ownership is missing, queries are too broad, Security Rules are too permissive, or all three.
What to do Inspect the stored ownerId, inspect the current user's UID, inspect the query, and inspect the Security Rules. Fix the security model, not only the interface.
If this happens

Permission denied

What it means Firebase received the request but Security Rules rejected it.
What to do Confirm the user is authenticated, inspect the document ownership field, inspect the requested path, and compare the request against the active rules. Do not solve the problem by making the database broadly public.
If this happens

Data disappears after refreshing

Likely cause The application may still be reading from local state instead of loading data from Firestore.
What to do Confirm the record actually exists in Firestore, then confirm the application reads it again when the authenticated session starts or the page reloads.
If this happens

AI keeps changing code but the bug remains

Why it happens The assistant does not have enough evidence, or the failing layer has not been isolated.
What to do Stop making changes. Return to Expected → Observed → Evidence. Identify the first failing layer and give the AI specific console, network, authentication, or Firebase evidence.
11

## Self-Check Before You Leave

If one of these is still unclear, flag an instructor before the workshop ends.

12

## Resources

Use the official documentation when you need more detail than the workshop can cover.

Auth: Sign Up → Authenticate → UID → Application
Data: User Action → Firestore → Persistent Record → Reload
Security: Authenticated UID → Query + Rules → Authorized Data
Debugging: Expected → Observed → Evidence → Hypothesis → Fix → Test → Verify
Your goal is not to memorize Firebase. Understand the system boundaries, know how identity connects to data, know that Security Rules enforce access, and know how to investigate failures with evidence.