Vibe Coding For Beginners: Guide + Notes + Commands

Learn Claude AI Course: ChatBot, MCP, Skills, Artifacts, vibe coding Etc
You are currently viewing Vibe Coding For Beginners: Guide + Notes + Commands
Learn Claude AI Course: ChatBot, MCP, Skills, Artifacts, vibe coding Etc

Vibe Coding For Beginners: Guide + Notes + Commands

Before we dive into Vibe Coding with AI. I want you to teach some concepts for non techie.

Table of Contents

Lets first discuss frontend in any application.

Frontend Components (HTML, CSS, JavaScript)

Now let’s zoom into the frontend, the part of a web application users see and interact with.

Every website you’ve ever visited is built with three core technologies working together.

Think HTML = Car Structure, CSS = Color of Car and JavaScript = Engine of Car. HTML, CSS, Javascript allow any application to build structure, style it and functions it.

Learn more about it here.

Python for Vibe Coding

Python is very flexible with AI. Every big creators use Python for Vibe Coding with VS Code is perfect combination.

Just understand Python is Programming Language which we will use to do coding, but where we will do coding? Answer is in VS Code a place to write code with AI.

Don’t worry, I suggest you to setup and understand Python with VS Code basics from below video which will be sufficient:

More Info here about Python.

How to Install Claude Code in VS Code

Step 1: Install Claude Code CLI

The VS Code extension needs the CLI installed on your machine first.

Mac / Linux:

curl -fsSL https://claude.ai/install.sh | bash

Windows (PowerShell)

irm https://claude.ai/install.ps1 | iex

Step 2: Install Git (Windows Only)

winget install --id Git.Git -e --source winget

Step 3: Install the Claude Code VS Code Extension

Quick Terms You Saw

  • Frontend-only app
    An app that runs entirely in the browser (no server, no database)
  • Client-side
    Code that runs on the userโ€™s device, not on a server
  • Plan Mode
    AI first plans the project before writing any code
  • Drag & Drop Zone
    An upload area where users drag files instead of clicking a button

Modularity + AI = Power

Modular structure makes AI work better:

  • AI reads smaller files
  • Context is reduced
  • Fewer hallucinations
  • More accurate updates
  • Less chance of breaking unrelated code

AI edits only what needs to be changed.

The Rule to Remember

When starting any project, always include this instruction:

Build it using a fully modular structure for easy updates, scaling, and maintainability.

These words matter.

Understanding Packages

What is a Package?

A package (or library) is pre-written code you can use directly in your projects instead of building everything from scratch.

TermWhat it means
Package / LibraryReusable code for a specific purpose
FrameworkA larger structure that shapes how you build (packages are more focused)

Popular Python Packages

PackagePurpose
pygameGame development (100,000+ lines of code)
requestsHTTP requests โ€” download files, send data, interact with URLs
numpyMath operations, essential for machine learning
SimplerLLMBuild AI-powered apps easily
DjangoWeb framework (installed as a package)

How to Install Packages

Single package:

pip install pygame

Multiple packages (using a requirements file):

pip install -r requirements.txt

Virtual Environments

The Problem: Package Version Conflicts

When you install packages directly on your computer, every project shares the same versions. This causes conflicts when different projects need different versions of the same package.

ProjectNeedsProblem
Project Arequests==2.0Breaks if 2.31 is installed
Project Brequests==2.31Breaks if 2.0 is installed

The Solution: Virtual Environments

Each project gets its own isolated environment with its own packages and versions.

Commands Reference

Check installed package version:

pip show pygame

Install a specific version:

pip install simplerllm==0.3.22

Create a virtual environment:

python -m venv venv

Activate the virtual environment:

Windows:

venv\Scripts\activate

Mac/Linux:

source venv/bin/activate

Deactivate:

deactivate

Key Takeaway

Every time you start a new project:

  1. Create a virtual environment
  2. Activate it before installing any packages

Resource

๐Ÿ”— PyPI.org โ€” Browse and search all Python packages

Databases & Django ORM

What is a Database?

A database is a way to save and organize data so you can easily search and retrieve it. Think of it like an Excel sheet with tables, columns, and rows.

OperationWhat it does
AddInsert a new record (e.g., new user signs up)
UpdateModify existing data
DeleteRemove a record
SearchFind and retrieve specific data

What is an ORM?

ORM (Object-Relational Mapping) is like a universal adapter between your code and the database.

Your Python Code  โ†’  Django ORM  โ†’  Any Database

Why it matters: You can switch databases (SQLite โ†’ PostgreSQL โ†’ MySQL) without changing your code. The ORM handles the translation automatically.

Example

# This Python code works with ANY database thanks to ORM
User.objects.filter(age__gt=18)

The ORM translates this to the correct database languageโ€”whether you’re using SQLite, PostgreSQL, or MySQL.

Django has a built-in ORM. You don’t need to worry about.

Django in Action (Demo)

Running a Django Project

# 1. Create virtual environment
python -m venv venv

# 2. Activate it
venv\Scripts\activate        # Windows
source venv/bin/activate     # Mac/Linux

# 3. Install Django
pip install django

# 4. Start Django project
django-admin startproject projectname

# 5. Move into the project folder
cd projectname

# 6. Run migrations (creates database tables)
python manage.py migrate

# 7. Create superuser (for admin panel)
python manage.py createsuperuser

# 8. Run the server
python manage.py runserver

Then open: http://127.0.0.1:8000

Django Built-in Features (Demo)

FeatureWhat you get
Admin PanelFull dashboard at /admin to manage your data
AuthenticationUser login, logout, permissionsโ€”ready to use
AuthorizationUser groups and permissions system
Database ManagementAdd, edit, delete records through the UI
Command Line ToolsManage your app without touching the code

Creating Users

Option 1: Admin Panel

  • Go to /admin โ†’ Users โ†’ Add User

Option 2: Command Line

python manage.py createsuperuser

Useful Commands

python manage.py help           # See all available commands
python manage.py runserver      # Start the web server
python manage.py createsuperuser # Create an admin user

Building a Simple Blog

Now what ever we learned, lets create a simple mini project of building a simple blog website to understand how vibe coding works. Follow below steps:

First do all the setup in terminal:

# 1. Create virtual environment
python -m venv venv

# 2. Activate it
venv\Scripts\activate

# 3. Install Django
pip install django

Then paste the prompt to AI ๐Ÿค–

The Prompt You can Use

I want to build a new Python Django app.

I already installed Django.

I will use Django ORM for the database (SQLite).

Use the built-in Django admin for all admin and management tasks.

Use my existing virtual environment (venv).

I want to create a simple blogging system where I can add and publish blog posts and view them on the home page.

Core feature: Create and delete blog posts.

Ask me questions to fully understand the project before beginning.

Why This Prompt Works

LinePurpose
Python Django appTells AI the language + framework
I already installed DjangoSaves time, skips installation steps
Django ORM + SQLiteSpecifies database setup
Built-in Django adminUses what Django already provides
Use my existing virtual environmentPrevents AI from creating a new one
Core feature: Create and delete blog postsFocuses on main functionality first
Ask me questionsGets AI to clarify before building

Pillar #3: Core Feature First

Always focus on the main functionality before adding extras.

  • โŒ Don’t ask for colors, styles, and extra features upfront
  • โœ… Get the core working first, then add features

Commands Used

# Create superuser
python manage.py createsuperuser

# Run the server
python manage.py runserver

What is JSON?

JSON (JavaScript Object Notation) is a structured text format that makes data easy to read and use in code.

Plain text (hard to use):

The keyword best AI tools has 1000 searches and is trending...

JSON (easy to use):

{
  "keyword": "best AI tools",
  "searches": 1000,
  "trending": true
}

JSON Anatomy

PartExample
Field (key)"keyword"
Value"best AI tools"
Pair"keyword": "best AI tools"

Key Takeaway

APIs return data in JSON format because it’s structured and easy to work with in any programming language.

Practical Example : Keyword Research Tool

A keyword research tool powered by two APIs:

  1. Google Suggestions API (free) โ€” get keyword suggestions
  2. Keyword Metrics API (paid) โ€” get search volume, CPC, difficulty

New Concept: Documentation Injection

When using APIs, always inject the documentation into your prompt so AI knows exactly how to use it.

Include:

  • API endpoint URL
  • Example response (JSON)
I will use the following API:
[https://suggestqueries.google.com/complete/search?output=toolbar&q=how+to+learn]

Example response:
[<toplevel>
<CompleteSuggestion>
<suggestion data="how to learn english"/>
</CompleteSuggestion>
<CompleteSuggestion>
<suggestion data="how to learn ai"/>
</CompleteSuggestion>
<CompleteSuggestion>
<suggestion data="how to learn trading"/>
</CompleteSuggestion>
<CompleteSuggestion>
<suggestion data="how to learn coding"/>
</CompleteSuggestion>
<CompleteSuggestion>
<suggestion data="how to learn japanese language"/>
</CompleteSuggestion>
<CompleteSuggestion>
<suggestion data="how to learn"/>
</CompleteSuggestion>
<CompleteSuggestion>
<suggestion data="how to learn python"/>
</CompleteSuggestion>
<CompleteSuggestion>
<suggestion data="how to learn korean language"/>
</CompleteSuggestion>
<CompleteSuggestion>
<suggestion data="how to learn german language"/>
</CompleteSuggestion>
<CompleteSuggestion>
<suggestion data="how to learn sanskrit"/>
</CompleteSuggestion>
</toplevel>]

The Prompt Structure

I want to build a Python Django app.

The project should be fully modular for easy updates and scalability.

App description:
The app is a keyword research tool powered by two APIsโ€”one for keyword suggestions and one for keyword data.

Phase 1: Build keyword suggestions tool.
Users enter a keyword and we use Google auto suggestions API.

API endpoint: [paste URL]
Example response: [paste JSON]

I don't want any home or landing pages, just the tool page.

Ask me questions to make sure you understood what I want.

For Example API Endpoint and Response click Here.

New Concept: API Keys

Most APIs require a key to:

  • Identify you
  • Track your usage
  • Bill you (for paid APIs)

Store keys in a .env file:

Step 1 โ€” Install python-dotenv

bash

pip install python-dotenv

Step 2 โ€” Create .env file in your project root

GST/
โ”œโ”€โ”€ .env        โ† create this file here
โ”œโ”€โ”€ manage.py
โ”œโ”€โ”€ config/
โ””โ”€โ”€ keywords/

Inside .env write your keys like this:

OPENAI_API=xyz
PAYPAL_API=pqr
GOOGLE_API=abc

Your app reads keys from this fileโ€”never hardcode them in your code.

Resource

๐Ÿ”— RapidAPI.com โ€” Thousands of APIs you can use (and you can sell your own APIs there too)

Key Takeaways

  1. Documentation injection โ€” Always give AI the API endpoint + example response
  2. API keys โ€” Store them in .env file, never in code
  3. Build in phases โ€” Phase 1 (suggestions), then Phase 2 (metrics)

What is an API?

An API (Application Programming Interface) is a way to access data or services from another applicationโ€”through code instead of a website.

Think of it as: A layer or broker that lets your app talk to other services.

For vibe coding understanding API is very important as you will use in 90% case.

Examples

What you see in browserWhat you access via API
Google search suggestionsSame data in structured format
Weather websiteWeather data you can use in your app
Scrolling Twitter/X manuallyHundreds of posts read automatically

Real Example: Google Suggestions

In browser: Type “how to learn” โ†’ see suggestions dropdown

Via API:

https://suggestqueries.google.com/complete/search?client=toolbar&q=how+to+learn

โ†’ Returns the same suggestions as structured data

Popular APIs

APIWhat it does
OpenAI APIAccess ChatGPT in your app
Stripe / PayPal APIAccept payments
Google Maps APIAdd maps and location services
SendGrid APISend emails
Twilio APISend SMS messages
X (Twitter) APIRead/post tweets

Key Takeaway

90% of applications are powered by APIs. They let you connect to external services and data, without building everything yourself.

AI Prompting

Garbage in, garbage out.

If you want real value from AI with vibe coding, forget basic prompts. This is where prompt engineering comes inโ€”structuring prompts to get exactly what you want.

Level 1: Basic Prompting (What 99% Do)

Give me 5 titles for a YouTube video about building micro SaaS

โŒ Works, but gives generic results with no control over output.

Level 2: Structured Prompting (The Foundation)

Use the 4 Pillars:

PillarWhat it doesExample
RoleNarrows AI focus to a specific field“You are a YouTube growth strategist and copywriter”
TaskDefines what you want“Generate high-performing video titles about {topic}”
ContextProvides background info“Target audience: entrepreneurs. Goal: maximize CTR”
RulesControls the output“Keep under 60 characters. Output only 5 titles as numbered list”

โœ… Better results, controlled output format.

Level 3: Data-Driven Prompting (What Makes Your Tool Unique)

Inject your own data, templates, or frameworks into the prompt.

Example: Instead of generic title generation, pass proven YouTube title frameworks:

Use these successful title templates:
- "How I [achieved result] in [timeframe]"
- "[Number] [things] That [benefit]"
- "Why [common belief] Is Wrong"
- "The [adjective] Guide to [topic]"

Generate titles following these patterns.

โœ… Output is based on proven formulas you collectedโ€”not generic AI responses.

Temperature & Top P Parameters

ParameterWhat it controlsLow ValuesHigh Values
TemperatureCreativity levelPredictable, factual (code, Q&A)Creative (stories, brainstorming)
Top PVocabulary rangeFocused, limited word choicesDiverse, more options

Default: Temperature 0.7 works for most use cases.

Access these in OpenAI Playground, not available in ChatGPT interface.

Recommended Values by Use Case

Use CaseTemperatureTop P
Code generation0.0 – 0.30.1 – 0.3
Factual Q&A0.0 – 0.30.1 – 0.3
Creative writing0.7 – 0.90.9 – 1.0
Title generation0.7 – 0.90.8 – 1.0
With custom templates0.5 – 0.70.8 – 0.9

Key Takeaway

Level 3 prompting is what makes your AI tool unique:

  • Collect proven frameworks/templates in your niche
  • Inject them into your prompts
  • Your output becomes data-driven, not generic AI fluff

Building an AI App – YouTube Title Generator

A YouTube title generator that:

  • Takes a video topic as input
  • Uses OpenAI API to generate 5 title suggestions
  • Stores the prompt in a separate file for easy updates
  • Uses custom frameworks (Level 3 prompting)

The Basic AI App Pattern

User Input โ†’ Your App โ†’ AI API โ†’ Response โ†’ Display Results

This is the foundation of most AI applicationsโ€”connect to an AI API, send a prompt, get a response.

AI API Options

ProviderAPI
OpenAIChatGPT API
AnthropicClaude API
GoogleGemini API

For popular APIs like OpenAI, you don’t need to inject documentationโ€”AI already knows how to use them.

Getting Your OpenAI API Key

  1. Go to platform.openai.com
  2. Navigate to API Keys in the dashboard
  3. Click “Create new secret key”
  4. Copy the key and paste it in your .env file:
OPENAI_API_KEY=your_key_here

Keeping prompts in separate files makes them easy to update without touching code.

Making Your Tool Unique: Inject Custom Frameworks

Instead of generic AI output, inject your own frameworks into the prompt:

Please update the prompt to generate based on the following 
successful YouTube title frameworks:

[paste your frameworks here]

Why this matters: Your tool produces unique output based on proven templatesโ€”not generic AI responses.

Understanding Temperature & Top P in Your App

ParameterLow Values (0-0.3)High Values (0.7-0.9)
TemperaturePredictable, factualCreative
Top PFocused responsesDiverse responses

Pro tip: If using structured templates, use lower temperature (0.5-0.7) so AI follows your templates closely.

Key Learning: Debate with AI

Don’t just accept AI’s suggestionsโ€”argue and clarify:

  • “But in my case, I’m using templates…”
  • “Why exactly these values?”
  • “Explain why this is better”

Example from the lecture:

  • AI suggested temperature 0.8-0.9 for creative titles
  • After clarifying we use templates, AI adjusted to 0.5-0.7
  • Small tweaks like this significantly improve output quality

Key Takeaways

  1. AI apps are simple: User input โ†’ AI API โ†’ Display response
  2. Store prompts in separate files for easy updates
  3. Inject your own data/frameworks to make output unique (Level 3)
  4. Adjust temperature/top P based on your use case
  5. Debate with AI โ€” don’t just accept defaults, question and clarify

Build Step by Step Tool

Step 1 โ€” Create a new folder

Create a folder on Desktop
Name it: youtube-title-generator

Step 2 โ€” Open folder in VS Code

Open VS Code
File โ†’ Open Folder โ†’ select your folder

Step 3 โ€” Open terminal in VS Code

Terminal โ†’ New Terminal

Step 4 โ€” Create virtual environment

bash

python -m venv venv

Step 5 โ€” Activate it

bash

venv\Scripts\activate

You’ll see (venv) appear in terminal โœ…


Step 6 โ€” Install Django

bash

pip install django

Step 7 โ€” Get your OpenAI API Key

1. Go to platform.openai.com
2. Click API Keys
3. Click "Create new secret key"
4. Copy the key โ€” save it somewhere safe!

Step 8 โ€” Paste this prompt into Claude Code

I want to build a new Django python app.

use the venv already created.
Django is already installed.

The project structure should be fully modular 
for easy updates and scalability.

My App:
YouTube Title Generator Tool

We will use OpenAI API to take user input 
"video topic" and generate 5 titles.

The prompt should be in a separate file so 
I can update easily.

Create a .env file and tell me what 
keys to add in it.

Ask me questions to make sure you 
understood what I want.

Step 9 โ€” Answer Claude Code’s questions

Claude Code will ask you some questions about your app โ†’ just answer them honestly!


Step 10 โ€” Give API key when Claude Code asks

When Claude Code creates the .env file it will tell you what to add. Paste your OpenAI key:

OPENAI_API_KEY=paste-your-key-here

Step 11 โ€” Debate temperature with Claude Code

Ask it:

What is the best temperature and top_p 
for my case? explain why

Then push back:

but I am using templates to generate titles

It will adjust to correct values! โœ…

temperature = 0.6
top_p = 0.9

Step 12 โ€” Run the server

bash

python manage.py runserver

Step 13 โ€” Open browser

127.0.0.1:8000

Why Solo Builders Need GitHub

As working with AI for vibe coding, GitHub serves two essential purposes:

PurposeWhat It Does
BackupYour code is stored safely in the cloud. If your computer crashes or you switch devices, your work is protected.
RevertWhen AI breaks your code (and it will), you can instantly roll back to a working version.

You can watch below video to learn about GitHub not compulsory, but i suggest you to watch it for vibe coding along side with this article on Github.

Key Concept: Push & Pull

YOUR COMPUTER โ†โ†’ GITHUB (Cloud)
     โ†‘                โ†‘
   Local           Repository
   Code              (Repo)
  • Push = Send your code from your computer to GitHub
  • Pull = Download your code from GitHub to your computer (or a new computer)

Getting Started

Step 1: Download GitHub Desktop

Go to: https://desktop.github.com

Download and install the application for your operating system.

Step 2: Create a GitHub Account

If you don’t have one, sign up at https://github.com (free account works fine).

Step 3: Sign In

Open GitHub Desktop and sign in with your GitHub account.

Creating Your First Repository

  1. Open GitHub Desktop
  2. Click File โ†’ New Repository
  3. Give it a name (e.g., “my-first-project”)
  4. Click Create Repository

The repository is now created locally on your computer.

Publishing to GitHub

  1. Click Publish Repository
  2. Keep it set to Private (your code stays hidden from others)
  3. Click Publish

Your code is now backed up to GitHub.

To view it online: Click Repository โ†’ View on GitHub

Quick Reference

ActionHow to Do It
Create new repoFile โ†’ New Repository
Push changesClick “Push origin” button
View onlineRepository โ†’ View on GitHub
Find local filesRepository โ†’ Show in Explorer/Finder

Two Ways to Use CSS Frameworks

3 Ways to style a button for vibe coding:

MethodLines of codeFiles needed
Raw CSS~152 files
Tailwind~51 file
DaisyUI~11 file

Key rule from the lesson:

Less code = Fewer AI tokens = Less hallucination = Better results! ๐Ÿ†

MethodHow It Works
Local InstallDownload and build the framework into your project files
CDNLoad the framework directly from a remote server via a link

CDN = Content Delivery Network โ€” a server on the cloud that hosts libraries and frameworks you can import directly into your code.

Why Use CDN for Vibe Coding Builders?

  • Faster setup โ€” No build steps or configuration
  • Simpler prompts โ€” Just tell AI: “Use Tailwind CSS through the CDN”
  • Less files โ€” No framework files cluttering your project

Prompt Phrase to Remember

When prompting AI, you can say:

“Use Tailwind CSS through the CDN”

This tells AI to include the CDN link instead of setting up a local build process.

When to Use Local vs CDN

Use CDNUse Local Install
Prototyping & testingProduction apps with performance needs
Learning & experimentationLarge-scale projects
Quick projectsWhen you need full customization

For our projects in this course, CDN is the way to goโ€”fast and simple.

Build a Web Page Analyzer: Always Start with GitHub

From now on, every project starts the same way in vibe coding:

  1. Open GitHub Desktop
  2. Create a New Repository with your project name
  3. Open in VS Code (or your preferred IDE)
  4. Create virtual environment
  5. Start building

IDE Options

You can use any IDE you prefer. They all work the same way:

IDENotes
VS Code + Claude CodeUsed in this course
CursorVS Code fork with built-in AI
WindsurfVS Code fork with AI agent
Google AntigravityNew IDE From Google

All these IDEs are built on VS Codeโ€”the concepts transfer directly.

The Django Project Starter Prompt

Use this as your template for any new Django web app:

Create a new Python Django web application.

## Tech Stack & Architecture
- Use Django templates and Tailwind CSS through the CDN for the UI
- Build the app in a modular structure for easy updates and maintainability
- Use the built-in Django admin for admin and management tasks
- Use SQLite with Django ORM for the database
- Use my existing virtual environment

## Development Workflow
- Build the application step by step
- First create the project structure and a project plan
- Create a plan.md file with the full project plan
- Add .env file to store important keys & apis (if requires)
- Ask questions before you start

## App Description
[Your app description here]

Time-Saving Tip: Create Django Structure Yourself

Instead of having AI create the basic Django project structure, run this command yourself:

django-admin startproject myproject .

The . at the end creates the project in the current directory.

This saves tokens and time, let AI focus on the actual application logic.

The Most Important Step: Understand Your App Logic First

Before you write anything, before you tell the AI anything, you have to understand exactly what you want.

You need to know:

  • How the logic flows
  • What building blocks you’re using
  • What APIs and services are involved
  • What libraries you’ll need

Our Example: Webpage Analyzer App

The User Sees

Enter URL โ†’ [Magic Happens] โ†’ Full Report

What Actually Happens

Step 1: User enters URL
         โ†“
Step 2: Scrape the webpage (get HTML code)
         โ†“
Step 3: Send HTML to AI for analysis
         โ†“
Step 4: Return structured JSON
         โ†“
Step 5: Display report in UI

Breaking Down Each Step: What Tools Do We Need?

StepWhat HappensTools/Libraries
1. InputUser enters URLDjango UI
2. ScrapeGet HTML from webpagerequestsBeautifulSoup, or scraping API
3. AI AnalysisSend HTML to AI modelSimplerLLM, OpenAI API, etc.
4. Structured OutputGet JSON responsePydantic, SimplerLLM
5. DisplayShow report to userDjango templates + Tailwind

Why Structured JSON Output Matters

When AI returns structured JSON instead of plain text:

  • Easier to build the UI
  • Data is predictable and consistent
  • Each field maps directly to your report sections

Key Takeaway

The difference between struggling for hours and building in minutes:

Understanding your app’s logic and choosing your tools BEFORE you start prompting.

Think through:

  1. What’s the user flow?
  2. What happens at each step?
  3. What library/API handles each step?

Then tell the AI exactly what you need.

Web Scraping – Methods & Limitations

Scraping means extracting the HTML code from any webpage so your application can read and process it. Lets start vibe coding with real project!

Webpage (what users see) โ†’ HTML Code (what your app reads)

Two Approaches to Web Scraping

ApproachWhat It IsBest For
Python LibrariesBuilt-in packages you install and run locallySimple pages, learning, no protection
APIsThird-party services that handle scraping for youProtected pages, production apps, scale

Approach 1: Python Libraries

Available Libraries

LibraryTypeHow It Works
Requests + BeautifulSoupHTTP requestFetches HTML directly, parses content
SeleniumBrowser automationOpens real browser, loads page, extracts HTML
PlaywrightBrowser automationModern alternative to Selenium
MechanicalSoupHTTP + parsingCombines requests with form handling

Limitations of Python Libraries

When using built-in libraries, you’ll face three main problems:

LimitationWhat HappensError You’ll See
CAPTCHAsPage requires human verificationBlocked or incomplete response
Anti-bot SystemsCloudflare or firewall protection403 Forbidden
IP BlockingToo many requests from your IP429 Too Many Requests โ†’ 403 Forbidden

There are advanced techniques to bypass these (proxies, rotating user agents), but they require significant setup and maintenance.

Approach 2: Scraping APIs

APIs handle all the hard parts for youโ€”bypassing CAPTCHAs, rotating IPs, and avoiding blocks.

Popular Scraping APIs

ServiceWebsiteKey Feature
Scraping Dogscrapingdog.comMarkdown output option
Scraper APIscraperapi.comPremium proxy network

Why Markdown Output Matters

When scraping for AI analysis, request Markdown format instead of HTML:

FormatSizeAI Processing
HTMLLarge (includes all tags)More tokens, harder to parse
MarkdownSmaller (clean text)Fewer tokens, better for LLMs

Both Scraping Dog and Scraper API support markdown output.

Which Approach Should You Use?

SituationRecommended Approach
Learning/testingPython libraries (Requests + BeautifulSoup)
Simple unprotected pagesPython libraries
Protected pages (Cloudflare, etc.)Scraping APIs
Production applicationScraping APIs
Need markdown outputScraping APIs

Key Takeaway

Now when you prompt AI to build a scraping feature, you know exactly what to ask for:

“Use Requests and BeautifulSoup to scrape the webpage”

or

“Use Scraping Dog API to scrape the webpage and return markdown format”

Understanding these building blocks = better prompts = better results.

FallBack – Unified Function Interface

FallBack or unified function interface is a single function that can use multiple providers underneath while always returning the same output format.

                    โ”Œโ”€โ”€โ”€ Provider 1 (Playwright)
scrape_webpage() โ”€โ”€โ”€โ”ผโ”€โ”€โ”€ Provider 2 (Scraping Dog)
                    โ””โ”€โ”€โ”€ Provider 3 (Scraper API)
                              โ”‚
                              โ–ผ
                      Same Output Format

Why This Matters

BenefitWhat It Means
Easy switchingChange providers without changing your app code
No redeploymentSwitch providers while your app is running
Failover mechanismIf one provider fails, automatically try the next
Consistent outputYour app logic never breaks because output format stays the same

Failover in Action

Request starts
     โ”‚
     โ–ผ
Provider 1 (Playwright) โ”€โ”€โ”€โ”€ FAILED
     โ”‚
     โ–ผ
Provider 2 (Scraper API) โ”€โ”€โ”€ FAILED
     โ”‚
     โ–ผ
Provider 3 (Scraping Dog) โ”€โ”€ SUCCESS โ”€โ”€โ†’ Returns result

Your app keeps working even when individual providers fail.

The Prompt to Build This

I want to build a scraping function with a unified interface.

It should support two providers: Playwright and Scraping Dog.

Requirements:
- Return the same format regardless of the provider
- If failover is true, try the second provider if the first fails

Create this functionality in a dedicated folder with full modular structure.

## Scraping Dog API Docs:
[paste the API code example here]

Key elements:

  • Specify the providers you want
  • Request consistent output format
  • Ask for failover support
  • Request modular structure (dedicated folder)
  • Include API documentation

Handling Errors

When you encounter errors like ModuleNotFoundError:

  1. Don’t panic โ€” this is normal
  2. Read the error message (it tells you what’s missing)
  3. Install the missing package, or
  4. Paste the error back to AI and let it fix it

Before Pushing to GitHub: Create .gitignore

Tell AI:

I want to create a .gitignore file for my project.

This file tells GitHub to ignore:

  • Cache files (__pycache__/)
  • Environment files (.env) โ€” never push API keys!
  • Local development files

Push Workflow

After every working feature:

  1. Open GitHub Desktop
  2. Review changed files (should be cleaner with .gitignore)
  3. Write a commit message describing what you added (e.g., “Added scraping logic”)
  4. Click Push

Key Takeaway

The unified function interface pattern:

  • Makes your code flexible and resilient
  • Lets you swap providers without breaking anything
  • Adds automatic failover for production reliability

Use this pattern whenever you integrate external services (scraping, AI models, payment providers, etc.).

Fallback Mechanism in Vibe Coding

What is a Fallback?

Think of it like ordering food ๐Ÿ•

  • First try Swiggy โ†’ down? Try Zomato โ†’ both down? Show error

Your app never fully breaks!


Why You Need It

Without FallbackWith Fallback
One service fails = app crashesOne service fails = tries next automatically
Users see errorsUsers don’t even notice
You lose moneyApp runs 24/7

For AI Service โ€” Copy Paste This Prompt

Add a fallback mechanism to the AI service.

If OpenAI fails, automatically switch to Anthropic Claude.
If Anthropic fails, switch to Google Gemini.

Keep the same output format regardless of which 
provider responds.

Add all API keys in your .env file:

OPENAI_API_KEY=your-key-here
ANTHROPIC_API_KEY=your-key-here
GOOGLE_API_KEY=your-key-here

For Scraping Service โ€” Copy Paste This Prompt

Add a fallback mechanism to the scraping service.

If Scraping Dog fails, automatically switch to Playwright.

Keep the same output format regardless of provider.

Add Scraping Dog key in your .env file:

SCRAPINGDOG_API_KEY=your-key-here

How It Works

Request starts
      โ†“
Provider 1 โ†’ FAILED
      โ†“
Provider 2 โ†’ FAILED
      โ†“
Provider 3 โ†’ SUCCESS โœ…

Golden Rule

You only need to understand WHAT you want โ€” Claude Code figures out HOW to build it!

UI Styles for Vibe Coding

What is a UI Style?

Instead of describing how you want your app to look in detail โ€” just tell AI a style name and it does everything! ๐Ÿ˜„


Available Styles

StyleWhat it looks likeBest for
MemphisColorful, playful, geometric shapesFun tools, creative apps
BrutalismRaw, bold, unconventionalPortfolio, statement sites
CyberpunkDark, neon accents, futuristicTech tools, gaming apps
Retro/Win95Old-school Windows aestheticNostalgic, fun projects
MinimalistClean, lots of whitespaceBusiness, professional tools
GlassmorphismFrosted glass effect, translucentModern, premium feel

Final Prompt Template For Vibe Coding

For vibe coding this below is the perfect template I created which you can copy paste and use it.

Create a new Python Django web application.

## Tech Stack & Architecture
- Use Django templates and Tailwind CSS through the CDN for the UI
- Build the app in a modular structure for easy updates and maintainability
- Use the built-in Django admin for admin and management tasks
- Use SQLite with Django ORM for the database
- Use my existing virtual environment

## Development Workflow
- Build the application step by step
- First create the project structure and a project plan
- Create a plan.md file with the full project plan
- Add .env file to store important keys & apis (if requires)
- Ask questions before you start

## App Description [Your app description here]

## Add Fall back [Your fallback description here]

## Add Style for UI [Your style description here]

Example Template Prompt I used:

Create a new Python Django web application.

## Tech Stack & Architecture
- Use Django templates and Tailwind CSS through the CDN for the UI
- Build the app in a modular structure for easy updates and maintainability
- Use the built-in Django admin for admin and management tasks
- Use SQLite with Django ORM for the database
- Use my existing virtual environment

## Development Workflow
- Build the application step by step
- First create the project structure and a project plan
- Create a plan.md file with the full project plan
- Add .env file to store important keys & apis (if required)
- Ask questions before you start

## App Description
Build a Webpage Analyzer Tool with 2 pages:

Home Page:
- A landing page with headline, header, footer and description
- A button "Start Analyzing" that takes user
to the analyzer page

Analyzer Page:
- A URL input form where user enters a website URL
- On submit, scrape the webpage using Scraping Dog API
- Send the content to OpenAI for analysis
- Show results on the same page with:
title, summary, SEO score, issues
and recommendations

## Add Fallback
AI Fallback:
- If OpenAI fails, automatically switch to DeepSeek
- Keep the same output format regardless of
which provider responds

Scraping Fallback:
- If Scraping Dog fails, automatically switch
to Playwright
- Keep the same output format regardless of provider

## Add Style for UI
- Use Memphis style

If you are using API so make sure to add endpoint + dummy response to prompt while doing vibe coding:

## Scraping Dog API Documentation

Endpoint: https://api.scrapingdog.com/scrape

Always request markdown format for cleaner content.

Example Response:
[paste example response here]

Make sure after project will finish it will ask to add all API keys to .env file so add it and then you can tell Claude to follow below prompt:-

I added the API keys to .env file. 
Now please:
1. Make sure .env is added to .gitignore
2. Create a .gitignore file if not exists
3. Test the project to make sure everything works correctly

Error Pages for Your APP in Vibe Coding

The Problem with Default Error Pages

When users visit a page that doesn’t exist, Django shows its default 404 page.

In debug mode, this reveals technical information:

  • URL patterns
  • Django version
  • Internal paths

This looks unprofessional and can expose security-sensitive information.

Two Error Pages You Need

Error CodeWhen It AppearsWhat It Means
404User visits a URL that doesn’t existPage Not Found
500Something breaks in your codeInternal Server Error

Both should have custom, branded pages that match your site’s design.

The Prompt for Error

I want now to create custom 404 and 500 error pages.

That’s it. Since you’re continuing in the same session, AI already knows your project structure and styling.

Testing Error Pages Locally

Custom error pages only display when debug is off.

To test locally, temporarily update settings.py:

# Change these settings
DEBUG = False
ALLOWED_HOSTS = ['*']

Then refresh your browser and visit a non-existent URL (e.g., /anything-random).

Important: Revert for Development

After testing, change settings back for local development:

DEBUG = True
ALLOWED_HOSTS = []

Keeping DEBUG = False locally will hide helpful error messages while you’re building.

What Good Error Pages Include

404 Page:

  • Clear “Page Not Found” message
  • Link back to homepage
  • Matches your site’s design/style

500 Page:

  • Friendly “Something went wrong” message
  • Reassurance (e.g., “We’re working on it”)
  • Link back to homepage
  • No technical details exposed

Key Takeaway

Custom error pages are a small detail that makes your application feel polished and professional. They:

  • Maintain your brand experience even when errors occur
  • Keep users from seeing confusing technical information
  • Give users a clear path back to working pages

Always create them before launching to production.

Authentication your App

The Problem with your App now:

Your app is publicโ€”anyone can use it. You need:

  • Users to log in before accessing certain features
  • A way to identify who’s using your app
  • Control over who can access what

What is Magic Link Authentication?

Instead of traditional username/password login:

  1. User enters only their email
  2. System sends a magic link to that email
  3. User clicks the link and is logged in automatically

Benefits:

  • No passwords to remember or reset
  • No password fields to secure
  • Simple for users
  • Popular with modern apps (Slack, Notion, etc.)

How It Works

User enters email
       โ”‚
       โ–ผ
System generates secure token (expires in 15 min)
       โ”‚
       โ–ผ
Email sent with magic link containing token
       โ”‚
       โ–ผ
User clicks link
       โ”‚
       โ–ผ
System validates token โ†’ User logged in

If it’s a new email, the account is created automaticallyโ€”no separate signup process.

The Prompt for Authentication Vibe Coding

Add magic link authentication to this project.

## Authentication Flow
- Login page with email input only (no password)
- Generate a secure token that expires after 15 minutes
- New emails automatically create user account

## Email Setup
- Use Resend as email service
- For local development, print emails in terminal

## Requirements
- No user password fields
- Token should be single use
- Keep it simple - no password reset, just magic links

Email Service: Resend

Resend (resend.com) is a developer-friendly email service. I use it for most of cases for vibe coding.

PlanEmails/MonthCost
Free3,000$0
Pro50,000+Paid

The free tier is more than enough when starting out.

Local Development Setup

During development, you don’t want to send real emails. The prompt specifies:

“For local development, print emails in terminal”

When you test locally, the magic link appears in your terminal instead of being sent via email. This makes testing fast and free.

Protecting Pages

When AI asks “Which pages should require authentication?”, specify:

PageAccess
Landing pagePublic
Analyzer pageLogin required
Results pageLogin required

Only protect the pages that need itโ€”keep your homepage accessible.

Testing the Flow

  1. Go to a protected page (e.g., /analyze)
  2. Get redirected to login
  3. Enter your email
  4. Check terminal for the magic link
  5. Copy and paste the link into your browser
  6. You’re now logged in

Hard Refresh Tip

If styles or changes aren’t showing after updates:

  • Windows/LinuxCtrl + Shift + R
  • MacCmd + Shift + R

Or: Right-click the refresh button โ†’ “Empty Cache and Hard Reload”

Key Takeaway

Magic link authentication is:

  • Simpler than traditional auth (no password handling)
  • More secure (no passwords to leak)
  • Better UX (users don’t forget passwords)

One prompt adds a complete authentication system to your app.

Token System for App

The Problem

Your app works, but anyone can use it for free. To monetize:

  • Users need to buy tokens to use your tool
  • Each operation consumes tokens
  • When tokens run out, users buy more

Token System Overview

User buys tokens โ†’ Tokens added to balance
                         โ”‚
                         โ–ผ
User uses tool โ†’ Tokens consumed from balance
                         โ”‚
                         โ–ผ
Balance reaches zero โ†’ User must buy more tokens

Core Functions You Need

FunctionPurpose
add_tokens()Add tokens when user purchases
consume_tokens()Deduct tokens when user uses the tool
get_balance()Check current token balance
get_transactions()View transaction history

The Prompt

I want to create a token system for my application.

## Structure
- Create a dedicated tokens folder inside the project
- Export clean functions that can be imported and used anywhere
- Make it fully modular

## Core Functions
- add_tokens
- consume_tokens
- get_balance
- get_transactions

## Critical Requirements
- Handle race conditions: two simultaneous requests must never overdraw the balance

## Note
- I want to be able to assign tokens to users in the Django admin for testing

Critical Concept: Race Conditions

What is a Race Condition?

When two requests happen at the same time, they can both read the same balance before either updates it.

Without Protection (DANGEROUS)

User has 100 tokens, operation costs 80 tokens

Request 1: Reads balance (100) โ†’ Subtracts 80 โ†’ Saves (20)
Request 2: Reads balance (100) โ†’ Subtracts 80 โ†’ Saves (20)
                    โ†“
         Both requests succeed!
         User spent 160 tokens but only had 100
         Final balance: 20 (should be -60)
         YOU LOST MONEY

With Protection (SAFE)

Request 1: Reads balance (100) โ†’ LOCKS โ†’ Subtracts 80 โ†’ Saves (20) โ†’ UNLOCKS
Request 2: WAITS... โ†’ Reads balance (20) โ†’ Not enough! โ†’ REJECTED
                    โ†“
         Only one request succeeds
         User can't overdraw
         YOU'RE PROTECTED

Always tell AI to handle race conditions when building token/credit systems.

Building Step by Step

Step 1: Create the Token System

First prompt creates the core token logic with all four functions.

Step 2: Create the User Token Page

Now I want to create a user token page so user can see the balance and transaction history.

This creates a dashboard where users see:

  • Current balance
  • Transaction history table

Step 3: Integrate with Your Tool

Finally, let's implement the token system in our web analyzer tool and consume 30 tokens for each operation.

This connects the token system to your actual feature.

Testing with Django Admin

The prompt includes:

“I want to be able to assign tokens to users in the Django admin for testing”

This lets you:

  1. Go to /admin
  2. Find “Token Management”
  3. Add tokens to test accounts manually
  4. Test without needing real payments

Result

After integration:

  • Token balance shows in navigation
  • Users see their balance on the tokens page
  • Each tool use deducts tokens (e.g., 30 tokens per analysis)
  • Transaction history shows all debits and credits

Key Takeaway

Building modular means adding features is easy:

  1. Token system โ†’ Built as standalone module
  2. Token page โ†’ Uses the module’s functions
  3. Tool integration โ†’ Just calls consume_tokens()

Each piece works independently but combines seamlessly.

Billing System

The Problem

Users run out of tokens and see “Insufficient tokens” error. They need a way to buy more tokens.

Solution: Integrate Stripe to sell token packages.

Why Stripe Checkout (Hosted Page)?

Instead of building payment forms yourself, redirect users to Stripe’s hosted checkout page.

Benefits:

  • Stripe handles all payment security
  • PCI compliance built-in
  • Supports multiple payment methods
  • You don’t touch sensitive card data

The Prompt

I want to create a modular billing system for my application using Stripe checkout.

## Structure
- Create a dedicated billing folder
- Admin configurable token packages
- Use Stripe checkout hosted page
- Store Stripe keys in environmental variables

## Integration
- Integrate with our existing token system
- Handle race conditions in the Stripe webhook

I will use PayPal for my vibe coding but you can use above stripe because in my country Stripe is not functional:-

I want to create a modular billing system for my application using PayPal checkout.

## Structure
- Create a dedicated billing folder
- Admin configurable token packages
- Use PayPal checkout hosted page
- Store PayPal keys in environmental variables

## Integration
- Integrate with our existing token system
- Handle race conditions in the PayPal webhook

## Note
- Do not set up sandbox testing for now
- Just build the structure and integration
- We will test using the coupon system for now
- Sandbox/live testing will be done later

I will use above command and for test i can create coupon system so i will prompt AI like this below:

I want to add a coupon system to my application.

## Structure
- Create a dedicated coupons folder
- Admin can create coupons in Django admin
- Each coupon has a code, token amount, and expiry date
- One time use per user
- Admin can set max uses per coupon

## Integration
- Integrate with existing token system
- User enters coupon code and gets tokens added to balance
- Show coupon redemption history in user token page

## Note
- This will be used for testing the billing system and also for future marketing campaigns
- Admin can activate or deactivate any coupon anytime
- Make it fully modular

Context Window Note

When you see context usage getting high (e.g., 50%+), start a new session.

This prevents:

  • Slower responses
  • Mixed up context
  • AI confusion

Clear the session before starting a new major feature.

Environment Variables Needed

Add to your .env file:

STRIPE_API_KEY=sk_test_...
STRIPE_PUBLISHABLE_KEY=pk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...

Get these from your Stripe Dashboard โ†’ Developers โ†’ API Keys.

Testing Stripe Locally with Stripe CLI

Since Stripe needs to send webhooks to your app (to confirm payments), you need the Stripe CLI for local testing.

Installation

Windows (PowerShell):

powershell

winget install Stripe.StripeCLI

Mac (Terminal):

brew install stripe/stripe-cli/stripe

Setup Steps

  1. Check installation:
   stripe --version
  1. Login to Stripe:
   stripe login

Follow the URL to authenticate.

  1. Start the webhook listener:
   stripe listen --forward-to localhost:8000/billing/webhook/
  1. Copy the webhook secret it displays and add to your .env file.

Creating Token Packages

Step 1: Create Product in Stripe Dashboard

  1. Go to Stripe Dashboard (in Test Mode)
  2. Products โ†’ Add Product
  3. Set name (e.g., “Starter Package”)
  4. Set price (e.g., $5.00)
  5. Select “One time” payment
  6. Save and copy the Price ID (starts with price_)

Step 2: Create Package in Django Admin

  1. Go to /admin
  2. Find “Token Packages” under Billing
  3. Add new package:
    • Name: “Starter”
    • Token amount: 100
    • Price: $5.00
    • Stripe Price ID: price_... (paste from Stripe)
    • Active: โœ“

Testing the Payment Flow

  1. Go to “Buy Tokens” page
  2. Click “Buy” on a package
  3. Redirected to Stripe Checkout
  4. Use Stripe’s test card: 4242 4242 4242 4242
    • Any future expiry date
    • Any 3-digit CVC
    • Any name and zip code
  5. Click “Pay”
  6. Redirected back to your app
  7. Check tokens pageโ€”balance should be updated!

Stripe Test Card Numbers

Card NumberResult
4242 4242 4242 4242Successful payment
4000 0000 0000 0002Card declined
4000 0000 0000 9995Insufficient funds

Use these for testing different scenarios.

How the Flow Works

User clicks "Buy" 
       โ”‚
       โ–ผ
Redirect to Stripe Checkout
       โ”‚
       โ–ผ
User enters payment info
       โ”‚
       โ–ผ
Stripe processes payment
       โ”‚
       โ–ผ
Stripe sends webhook to your app
       โ”‚
       โ–ผ
Your app adds tokens to user's balance
       โ”‚
       โ–ผ
User redirected back with updated balance

Key Takeaway

Stripe Checkout makes payments simple:

  • You don’t handle card data
  • Stripe manages security and compliance
  • Webhooks automatically update your system
  • Test mode lets you verify everything before going live

Combined with your modular token system, users can now buy and use tokens seamlessly.

Security Audit for App

In building any app with vibe coding its important to add security layers to the App.

Important Reality Check

There is no such thing as 100% security. Even big companies get hacked.

Our goal: Protect against common, known vulnerabilitiesโ€”not become security experts.

Good News: Django Has Built-in Security

Django protects you from common attacks out of the box:

ProtectionWhat It Prevents
SQL InjectionAttackers manipulating database queries
CSRF ProtectionCross-site request forgery attacks
XSS ProtectionCross-site scripting attacks
ClickjackingUI redressing attacks
Secure Password HashingPassword theft from database

Using a framework like Django means the basics are already handled.

Security Fix #1: Change the Admin URL

The default /admin URL is known by everyoneโ€”attackers will try it first.

The Prompt

I want to change my Django admin URL from /admin to a custom URL stored in .env for security.

Setup

Add to your .env file:

ADMIN_URL=your-secret-admin-path-here

Result/admin returns 404, but /your-secret-admin-path-here opens admin panel.

Security Fix #2: AI Security Audit

Because your project is modular (separate folders for billing, tokens, scraper, etc.), you can scan each module individually.

Scan Frontend for Exposed Secrets

Scan the frontend code for any exposed API keys, secrets, or sensitive data that should not be public.

Why this matters: AI-generated code sometimes accidentally puts API keys in HTML/JavaScript where anyone can see them (View Page Source).

Scan Each Module

Scan the scraper folder for critical security issues and fix them. Make sure you don't break application functionality.

Repeat for each folder:

  • scraper/
  • tokens/
  • billing/
  • ai_service/

Common Vulnerability: SSRF (Server-Side Request Forgery)

When scanning, you might see this flagged.

What it is: Attackers send malicious URLs to your server, which your server then requestsโ€”potentially accessing internal systems or stealing data.

Fix: Add URL validation to ensure only legitimate URLs are processed.

Pro tip: When you encounter unfamiliar security terms, ask AI to explain them. This is how you learn while building.

Security Fix #3: Django’s Built-in Security Check

Django has a deployment checklist command:

python manage.py check --deploy

This shows warnings about security settings not configured for production.

Common Warnings and Fixes

WarningWhat It MeansFix
DEBUG should not be TrueDebug mode exposes sensitive infoSet DEBUG=False in production
SECURE_HSTS_SECONDS not setNot forcing HTTPSEnable HSTS settings
SECURE_SSL_REDIRECT not setHTTP allowedForce HTTPS redirect
SESSION_COOKIE_SECURE not setCookies sent over HTTPSecure cookie settings

Fix All Warnings

Copy the warnings and paste to AI:

Fix these Django deployment security warnings:
[paste warnings here]

AI will update your settings with production-safe values.

Important: Test After Every Security Update

Security fixes can sometimes break functionality.

After each update:

  1. Test the application manually
  2. Verify key features still work
  3. If something breaks โ†’ Use GitHub to revert changes

Security Settings: Development vs Production

Many security settings only apply in production:

if not DEBUG:
    SECURE_HSTS_SECONDS = 31536000
    SECURE_SSL_REDIRECT = True
    SESSION_COOKIE_SECURE = True
    CSRF_COOKIE_SECURE = True

This way, local development still works normally while production is secured.

Final Check

Run the command again:

python manage.py check --deploy

Goal: Zero warnings before deploying.

Key Takeaways

  1. Django handles basics: SQL injection, CSRF, XSS are covered
  2. Change default admin URL: Don’t useย /admin
  3. Scan each module: AI can audit your code for vulnerabilities
  4. Use Django’s check command:ย python manage.py check --deploy
  5. Test after every fix: Security updates can break things
  6. Learn while fixing: Research unfamiliar security terms
  7. Production vs development: Some settings only apply whenย DEBUG=False

Moving To Production DB

Now we created our application with Vibe Coding, now lets switch it to SQLite to PostgreSQL.

Why Switch Databases?

During development, we used SQLiteโ€”a simple file-based database stored locally.

For production, we need PostgreSQL:

  • Handles multiple users simultaneously
  • Better performance at scale
  • Required by most hosting platforms
  • Industry standard for production apps

Database Hosting Options

OptionCostBest For
RailwayFree trial, then pay-per-useStarting out, single projects
Digital Ocean~$13/monthManaged service, reliability
Self-hosted (Coolify)Server cost onlyMultiple projects, cost savings

For this course, we’ll use Railwayโ€”free to start and simple to set up.

Setting Up PostgreSQL on Railway

Step 1: Create Database

  1. Go toย railway.app
  2. Click “Deploy” โ†’ “Database” โ†’ “PostgreSQL”
  3. Wait a few seconds for provisioning

Step 2: Get Connection String

  1. Click on your database
  2. Go to “Connect” โ†’ “Public Network”
  3. Copy the connection URL

It looks like:

postgresql://username:password@host:port/database

Migrating Your Django App

The Prompt

I want to migrate my database to PostgreSQL with this connection string:

I have nothing to backup – I’m still in development.

The second line tells AI this is a fresh migration, not a data transfer.

Why Django ORM Makes This Easy

Remember the Django ORM (Object-Relational Mapping)?

It’s a layer between your code and the database. When you switch databases:

  • Your code stays exactly the same
  • Only the connection settings change
  • Django handles the differences between SQLite and PostgreSQL

After Migration: Run Commands

AI will tell you to:

  1. Install the PostgreSQL adapter:
   pip install psycopg2-binary
  1. Run migrations:
   python manage.py migrate

This creates all your tables in the new PostgreSQL database.

Important: Fresh Database = Fresh Data

When you migrate the structure (not data):

  • All your test accounts are gone
  • Token balances reset
  • You start with a clean slate

This is fine for going to productionโ€”you want fresh data anyway.

Common Issue: HTTPS Redirect Locally

After security setup, you might see your local site not loading.

Cause: You set DEBUG=False which enables HTTPS requirements.

Fix: Set DEBUG=True in .env for local development, then run again.

Security Best Practice: Move Database Credentials to .env

AI might hardcode the database connection in settings.py. This is a security risk.

The Prompt

Please move the database connection parameters from settings to .env

Result in .env:

DB_NAME=railway
DB_USER=postgres
DB_PASSWORD=your_password
DB_HOST=your_host.railway.app
DB_PORT=5432

Result in settings.py:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': os.getenv('DB_NAME'),
        'USER': os.getenv('DB_USER'),
        'PASSWORD': os.getenv('DB_PASSWORD'),
        'HOST': os.getenv('DB_HOST'),
        'PORT': os.getenv('DB_PORT'),
    }
}

Benefits:

  • Credentials not in your code
  • Easy to change without editing code
  • Different values for development vs production

Verifying the Migration

  1. Check Railway dashboard โ†’ Your database โ†’ “Data” tab
  2. You should see all your Django tables created
  3. Run your app locally and test key features
  4. Note: It may be slightly slower (connecting to remote database)

Key Takeaways

  1. SQLite โ†’ PostgreSQL: Required for production
  2. Railway: Free and easy way to get a PostgreSQL database
  3. Django ORM: Makes database switching painless
  4. Fresh migration: Structure transfers, data doesn’t
  5. Credentials in .env: Never hardcode database passwords
  6. Test after migration: Verify everything still works

Publishing The App

Hosting Options

You have many choices for deploying your Django application:

ServiceTypeBest For
RailwayManaged platformQuick deployment, beginners
DigitalOcean App PlatformManaged platformScalable apps
RenderManaged platformFree tier available
PythonAnywherePython-specificSimple Django apps
CoolifySelf-hostedFull control, multiple projects

The Docker Approach

Instead of learning each platform’s specific setup, we’ll use Docker.

What is Docker? Docker packages your entire application (code, dependencies, settings) into a “container” that runs the same way anywhere.

Your App + Dependencies + Settings = Docker Container
                                           โ”‚
                                           โ–ผ
                              Runs on ANY platform

The Prompt

Create a production-ready Dockerfile and docker-compose.yml for my Django project.

## Project Details
- Use PostgreSQL for database
- Use WhiteNoise for static files
- Use Gunicorn for application serving

## Requirements
- Use multi-stage build to keep the image small
- Use environmental variables for configuration
- Expose on port 8000
- Create a .dockerignore file
- Run collectstatic during build
- Keep it simple and well-commented for beginners learning Docker

Key Docker Terms Explained

TermWhat It Does
DockerfileInstructions to build your container
docker-compose.ymlDefines how multiple services work together
Multi-stage buildKeeps final image small by discarding build tools
WhiteNoiseServes static files (CSS, JS) efficiently
GunicornProduction-grade web server for Python
.dockerignoreFiles to exclude from the container

After Docker Files Are Created

  1. Commit to GitHub
   "Updated with Docker"
  1. Push to repository

Now your project can be deployed anywhere that supports Docker.

Deploying to Railway

Step 1: Create New Project

  • Go to Railway dashboard
  • Click “Deploy a new project”
  • Select “GitHub Repo”
  • Find and select your repository

Step 2: Add Environment Variables

  • Go to Variables โ†’ Raw Editor
  • Paste yourย .envย contents
  • Important changes for production:
  DEBUG=False
  ALLOWED_HOSTS=your-app-name.railway.app

Step 3: Generate Domain

  • Go to Settings โ†’ Public Networking
  • Click “Generate Domain”
  • Copy the URL and add toย ALLOWED_HOSTS

Step 4: Deploy

  • Railway automatically builds and deploys
  • Click the URL to see your live app!

If Deployment Fails

Don’t panicโ€”this is normal. Here’s how to debug:

  1. Check logs: Deployments โ†’ View Logs
  2. Common issue: Missing packages inย requirements.txt
  3. Copy errorย and ask AI: “What’s wrong with this deployment error?”

Same Process Works Everywhere

Once you have Docker files, deploying to other platforms is nearly identical:

DigitalOcean App Platform:

  • Create โ†’ App Platform โ†’ GitHub โ†’ Select repo โ†’ Add env variables โ†’ Deploy

Coolify (Self-hosted):

  • New Project โ†’ GitHub Repo โ†’ Select repo โ†’ Add env variables โ†’ Deploy

Any Docker-compatible host:

  • Connect GitHub โ†’ Add env variables โ†’ Deploy

Production Checklist

Before going live, verify:

  • DEBUG=Falseย in production
  • ALLOWED_HOSTSย includes your domain
  • All API keys are in environment variables
  • requirements.txtย has all packages
  • Security audit passed (python manage.py check --deploy)
  • Custom admin URL configured
  • Stripe in live mode (not test mode) if accepting payments

๐ŸŽ‰ Congratulations!

You’ve built and deployed a complete AI-powered web application:

  • โœ… Django web framework
  • โœ… Web scraping with failover
  • โœ… AI integration with SimplerLLM
  • โœ… Structured JSON responses
  • โœ… User authentication (magic links)
  • โœ… Token system for monetization
  • โœ… Stripe payment integration
  • โœ… Security hardening
  • โœ… Production deployment

Final Advice

“The whole idea behind building with AI is learning while building.”

Do This:

  • Read the plansย before accepting
  • Understand what AI is doingโ€”don’t just click accept
  • Research unfamiliar termsโ€”this is how you grow
  • Build more projectsโ€”each one teaches you something new

Don’t Do This:

  • Don’t blindly accept everything (this is “dummy vibe coding”)
  • Don’t skip understanding for speed
  • Don’t give up when errors happenโ€”they’re learning opportunities

What’s Next?

You now have the skills to build any web application you can imagine:

  1. Pick an ideaย you’re excited about
  2. Plan the logicย before prompting
  3. Build modularlyย step by step
  4. Test thoroughlyย at each stage
  5. Deploy and iterate

The patterns you learned in this course apply to any project. Now go build something amazing!

I hope you loved this Vibe Coding guide with all notes and commands and videos included.

Kunal Lonhare

I am the founder of Kuku Courses