# 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.
## 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.
- Run a web application locally
- Navigate a project in Visual Studio Code
- Use the integrated terminal
- Install dependencies using npm
- Use Codex or Claude Code for basic development tasks
- Use basic Git and GitHub workflows
- Commit and push project changes
- Open Browser Developer Tools
## Authentication vs Application Data
Authentication and application data are related, but they solve two different problems.
- Creates and identifies users
- Maintains sign-in state
- Provides a unique user ID
- Handles credentials and authentication errors
- 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
## Firebase Authentication
Firebase Authentication gives your application a reliable way to know who is using it.
- User registration with email and password
- User sign-in
- User sign-out
- Authentication state: is somebody currently signed in?
- User ID: a stable identifier for each account
- Authentication errors and user feedback
- Protected functionality that only appears when a user is authenticated
What the application should know
- Whether a user is signed in
- Which user is signed in
- What UI should appear in each authentication state
- How to respond when sign-up or sign-in fails
## 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
A simple task document
{
"title": "Finish project outline",
"course": "CS 101",
"dueDate": "2026-09-10",
"completed": false,
"ownerId": "firebase-user-id"
}
## User Ownership & Security Rules
Authentication becomes useful when application data can be associated with the correct user. The Firebase user ID provides that connection.
- Store the authenticated user's ID with records that belong to that user
- Query for records owned by the current user
- Test with two different accounts
- Verify one account cannot see another account's private records
Filtering by ownerId controls what your interface requests.
Firebase Security Rules control what the database is actually willing to return or modify.
"Only request documents where ownerId matches the current user."
"Reject requests for records the authenticated user does not own."
Security mindset
- Authentication proves identity
- Queries select data
- Security Rules enforce access
- Test with more than one account
- Never assume hiding something in the interface makes it secure
## Debugging Full-Stack Applications
Full-stack debugging becomes much easier when you identify which layer is failing before changing code.
First locate the failing layer
UI ↓ Application Logic ↓ Authentication ↓ Firestore Request ↓ Security Rules ↓ Database
What to check before changing code
- What exactly did you expect to happen?
- What actually happened?
- Read the browser console error word for word
- Inspect the Network panel when a request is involved
- Check terminal output
- Check whether the current user exists
- Check the exact Firestore path or query
- Check Firebase Security Rules when requests are denied
- Give AI the collected evidence, not just the symptom
## Hooks & Workflow Automation
Optional / If Time AllowsOnce 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.
- Understand the task before automating it
- Prioritize hooks that prevent mistakes
- Prefer simple automations over complicated ones
- Understand exactly what a hook will execute
- Do not automate a process you do not understand
Example useful automation
AI modifies code
↓
Run lint / tests
↓
Report failures
↓
Developer reviews result
## Prompt Templates You Can Use
Use these as starting structures. Replace the bracketed fields with real evidence and project context.
## 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.
The complete walkthrough
- Open the Study Task Tracker from Day 1 and verify it still runs locally.
- Confirm that task data is currently local-only and disappears when appropriate.
- Create or open a Firebase project.
- Register the web application with Firebase.
- Install and initialize Firebase in the project.
- Enable Email/Password Authentication.
- Implement user registration.
- Implement sign-in and sign-out.
- Display the appropriate interface based on authentication state.
- Create a Cloud Firestore database.
- Design a simple task document structure.
- Store a task in Firestore.
- Attach the authenticated user's UID as ownerId.
- Retrieve only the current user's tasks.
- Add or review Security Rules for user-owned task data.
- Refresh the page and verify tasks persist.
- Test with a second account.
- Verify one account cannot access another account's private tasks.
- Introduce or encounter a real failure.
- Locate the failing layer using DevTools and Firebase evidence.
- Give that evidence to Codex or Claude Code.
- Evaluate the diagnosis and proposed fix.
- Apply the fix.
- Test again and verify the behavior.
- Commit the working result to GitHub.
## Your Exercise
Continue the Campus Event Board from Day 1 and convert it into a full-stack application.
Your target
Steps
- Open your Campus Event Board from Day 1.
- Verify the project runs locally.
- Create or configure a Firebase project.
- Connect Firebase to the application.
- Enable Email/Password Authentication.
- Implement user registration.
- Implement sign-in.
- Implement sign-out.
- Make the interface respond appropriately to authentication state.
- Create a Firestore database.
- Store event data in Firestore.
- Add the authenticated user's UID as ownerId when appropriate.
- Retrieve the correct event data for the authenticated user.
- Add or review Security Rules that protect user-owned records.
- Refresh the app and verify persistence.
- Sign out and sign back in.
- Verify the correct data still appears.
- Create or use a second account.
- Verify private user-owned data is not exposed across accounts.
- Use DevTools and Firebase evidence to investigate any errors.
- Use Codex or Claude Code to assist with diagnosis if needed.
- Test every proposed fix before trusting it.
- Commit the working checkpoint to GitHub.
You are done when...
- A user can create an account
- A user can sign in
- A user can sign out
- Authentication state affects application behavior
- Event data is stored in Firestore
- Stored data survives a page refresh
- User-owned records contain the correct ownerId
- Security Rules protect user-owned data
- You tested the application using two accounts
- You can locate browser errors using DevTools
- You can explain which application layer failed during a bug
- Your working Day 2 implementation is committed to GitHub
## Troubleshooting
When something fails, locate the layer before changing code.
Firebase fails immediately after setup
Sign-in works, but Firestore reads or writes fail
A user sees another user's private data
Permission denied
Data disappears after refreshing
AI keeps changing code but the bug remains
## Self-Check Before You Leave
If one of these is still unclear, flag an instructor before the workshop ends.
- I can explain the difference between authentication and application data
- I can create an account using Email/Password Authentication
- I can sign in and sign out
- I can detect authentication state in the application
- I can store and retrieve Firestore data
- I understand why user-owned records need an ownerId
- I understand the difference between filtering data and securing data
- I tested user-owned data with two different accounts
- I can identify which full-stack layer is failing during debugging
- I can give AI real evidence instead of only saying "fix it"
- I understand when hooks may be useful, even if I did not implement one
- My working Day 2 implementation is committed to GitHub
## Resources
Use the official documentation when you need more detail than the workshop can cover.