Web Design AI Header

Lesson 4: Creating Custom Blueprints and Database Schemas

Learn to design custom database schemas, create new Flask blueprints with Claude AI assistance, and deploy your complete application to production environments.

Lesson Objectives

  • Create custom database schemas with Claude AI web research capabilities
  • Replace existing schemas and automatically deploy new table structures
  • Build Flask blueprints from existing templates with full CRUD functionality
  • Integrate blueprints by updating navigation and registering routes
  • Debug application errors by providing error messages to Claude
  • Deploy and test complete applications in production environments
  • Verify database operations using MySQL Workbench visualization tools

Watch: Creating Custom Blueprints and Database Schemas Tutorial

Creating Custom Blueprints and Database Schemas - Notes

Creating a Custom Database Schema

Project Example: Atlanta Braves Bullpen

In this lesson, we create a new database table for tracking Atlanta Braves bullpen pitchers for 2025.

Claude AI Prompt for Schema Creation:

"I want a single database table based on Atlanta Braves bullpen\npitchers for 2025. I want to track the pitchers names, jersey numbers,\nand college team they played for. Replace the schema.SQL and\nseed_data.SQL with this new database structure."

What Claude Does:

  • Goes to the web to find actual Braves bullpen roster information
  • Creates new table structure with first_name, last_name, jersey_number, college_team
  • Drops existing tables and creates new ones
  • Generates realistic seed data (may create fictional data if real data is limited)
  • Automatically deploys the new schema to your database

Verifying Database Changes

Using MySQL Workbench to Confirm Changes:

  • Open MySQL Workbench and connect to your database
  • Refresh the schema view to see the new "braves_bullpen" table
  • Click the table view icons to see your data:

MySQL Workbench Icons:

  • Info Icon (i): Shows table structure and metadata
  • Tool Icon: Edit table structure and properties
  • Excel-like Icon: View data in spreadsheet format

Verifying Seed Data:

  • Click the spreadsheet icon to view your pitcher data
  • Confirm all fields are populated correctly
  • Verify the data matches your schema requirements

Creating New Blueprints with Claude

Step 1: Create Blueprint and Template

"Create a new blueprint called pitchers based on the examples.py\nblueprint formatting and the schema.SQL in the database folder.\n\nThen create a new template file called pitchers.html and base it\non the examples.html file."

What Claude Does:

  • Creates the new pitchers.py blueprint file
  • Uses the existing examples blueprint as a template
  • Adapts the code to work with the new database schema
  • Creates corresponding pitchers.html template file
  • Ensures all modals (add, edit, delete) are included

Why Use the Examples Blueprint as Base:

  • Contains pre-built modal functionality
  • Has add, edit, and delete operations already working
  • Prevents Claude from creating unnecessary additional pages
  • Maintains consistent site structure and functionality

Updating Navigation and Registering Blueprints

Step 2: Complete the Blueprint Integration

"Go ahead and update the navigation, register the blueprints,\nand remove the example blueprint and template."

What This Command Does:

  • Update Navigation: Modifies base.html to include new "Pitchers" link
  • Register Blueprints: Updates __init__.py to register the new blueprint
  • Remove Old Files: Deletes examples.py and examples.html
  • Clean Up References: Removes any remaining references to the old blueprint

File Changes Made:

  • __init__.py: Blueprint registration (just 2 lines of code)
  • base.html: Navigation update (changes "Examples" to "Pitchers")
  • Deleted: examples.py and examples.html files

Testing and Production Deployment

Testing the Complete Application:

  • Navigate to the new "Pitchers" section
  • Verify all pitcher data displays correctly
  • Test delete functionality (e.g., remove Pierce Johnson)
  • Test add functionality for new pitchers
  • Confirm all CRUD operations work locally

Deployment to GitHub and Heroku:

Step 3: Deploy to Production

"Send all the changes to GitHub."

What Claude Does for GitHub Deployment:

  • Stages all the changes you've made
  • Creates descriptive commit messages
  • Pushes all changes to the master branch
  • May ask for permission since GitHub requires bash operations

Automatic Heroku Deployment:

  • Since auto-deploy is enabled, Heroku starts building immediately
  • Check Heroku → Activity to see the build process
  • Subsequent builds are faster because dependencies are cached
  • Once complete, click "Open App" to test production version

Production Testing:

  • Test all CRUD operations on the live site
  • Verify data persistence across operations
  • Confirm the cloud database is working correctly