Skip to content

Latest commit

 

History

History
318 lines (205 loc) · 10.2 KB

File metadata and controls

318 lines (205 loc) · 10.2 KB

Module 7: Code Mode - Viewing and Editing Code Directly

Goal: Understand how to work with code when you need to (Optional for beginners)

Estimated Time: 20-30 minutes

Note: This module is optional for complete beginners. You can build amazing apps without ever touching code! This module is for those who want to understand or customize code directly.


🎯 What You'll Learn in This Module

By the end of this module, you will:

  • Understand what Code Mode is
  • Know when you might need to view code
  • Understand when to use Code Mode vs. prompts
  • Know how to view your project's code
  • Understand how to make direct code edits (paid plans)
  • Know when Code Mode is helpful vs. when prompts are better

📖 Lesson 1: What is Code Mode?

Understanding Code Mode

Code Mode lets you view and edit your project's raw code directly in Lovable. It's like opening the hood of a car - you can see and modify how everything works under the surface.

Important Note for Beginners

You don't need Code Mode to build amazing apps! Lovable is designed so you can build everything using prompts. Code Mode is optional and mainly for:

  • Advanced customization
  • Learning how code works
  • Making precise technical changes
  • Understanding what Lovable built

💡 Plan Information: Code editing requires a paid plan, but viewing code is free. You can build everything using prompts on the free plan! See the Pricing and Plans Guide for details.

What You'll See in Code Mode

When you open Code Mode, you'll see:

  • File structure - All the files in your project
  • Code files - The actual code (HTML, CSS, JavaScript, etc.)
  • Configuration files - Settings and configurations
  • Organized folders - Everything organized logically

💡 Beginner Tip: Don't be intimidated by code! Even if you don't understand it, you can still use Lovable effectively with prompts.


📖 Lesson 2: When to Use Code Mode vs. Prompts

Use Prompts When:

You want to build features - "Add a contact form"
You want to make changes - "Change the colors to blue"
You're learning - Prompts help you understand
You want quick results - Prompts are faster
You're not comfortable with code - Prompts are easier

Prompts are usually the better choice!

Use Code Mode When:

You need precise control - Exact positioning, specific values
You want to learn code - See how things are built
You're debugging - Find and fix specific issues
You need advanced customization - Things prompts can't do
You understand code - You know what you're looking for

Code Mode is for advanced users or learners.

The Best Approach

For beginners: Use prompts for everything. Only use Code Mode if you're curious about how things work or if a prompt isn't giving you the exact result you need.

For advanced users: Use prompts for most things, Code Mode for fine-tuning.

💡 Beginner Tip: Start with prompts! You can build entire apps without ever opening Code Mode.


📖 Lesson 3: Viewing Your Code

How to Open Code Mode

Step 1: Find Code Mode

  1. In your Lovable project, look for a "Code" button or tab
  2. It might be in the top menu, sidebar, or as a toggle
  3. Click it to enter Code Mode

What you'll see: Your project's file structure and code files.

Step 2: Explore the File Structure

You'll see folders and files organized like:

your-project/
├── src/
│   ├── components/
│   │   ├── Header.jsx
│   │   ├── Footer.jsx
│   │   └── Button.jsx
│   ├── pages/
│   │   ├── Home.jsx
│   │   └── About.jsx
│   └── App.jsx
├── public/
│   └── images/
└── package.json

Don't worry if this looks confusing! You don't need to understand it to use Lovable.

Step 3: Open a File

  1. Click on a file - It opens in the editor
  2. See the code - You'll see the actual code
  3. Read it - Even if you don't understand, you can see what Lovable built

Understanding What You See

Common file types:

  • .jsx or .js - JavaScript/React code (the logic)
  • .css - Styling code (how things look)
  • .html - Structure code (the layout)
  • .json - Configuration files (settings)

💡 Beginner Tip: You don't need to understand the code! Just knowing it exists and that Lovable created it is enough.


📖 Lesson 4: Making Code Edits (Paid Plans)

Important: Code Editing Requires Paid Plan

Note: Viewing code is available on all plans, but editing code directly requires a paid plan. You can still make all changes using prompts on the free plan!

📊 For complete pricing details: See the Pricing and Plans Guide for a full breakdown of what's included in free vs. paid plans.

How to Edit Code (If You Have Paid Plan)

Step 1: Open the File

  1. Navigate to the file you want to edit
  2. Click on it to open it

Step 2: Make Your Changes

  1. Click where you want to edit - The cursor appears
  2. Type your changes - Just like editing a document
  3. Save the file - Usually auto-saves or click Save

Step 3: See Your Changes

  • Changes appear in the preview
  • Your app updates automatically
  • You can test immediately

When Direct Code Edits Help

  • Precise values - "Change this exact number to 42"
  • Complex logic - Advanced functionality
  • Quick tweaks - Small changes faster than prompts
  • Learning - Understanding how code works

💡 Beginner Tip: Even with a paid plan, prompts are usually easier and faster. Use code edits only when you need precise control.


📖 Lesson 5: Learning from Code

Code as a Learning Tool

Even if you don't edit code, viewing it can teach you a lot!

What You Can Learn

  1. How Lovable structures projects - See the organization
  2. How features are built - Understand the implementation
  3. Code patterns - See common approaches
  4. Best practices - Learn from Lovable's code quality

Example: Learning from a Button

You ask Lovable:

Add a blue button that says "Click Me"

Then in Code Mode, you can see:

  • How the button is created
  • How the color is applied
  • How the text is added
  • The structure and style

This teaches you how buttons work in code!

Using Code to Improve Prompts

After viewing code, you might understand:

  • What's possible
  • How to describe things better
  • What to ask for in prompts

💡 Beginner Tip: Don't feel pressured to understand code! View it out of curiosity, but stick with prompts for building.


🛠️ Hands-On Practice

Practice 1: View Your Code

Task: Explore your project's code structure

  1. Open Code Mode - Click the Code button/tab
  2. Browse the files - Click through different files
  3. Open a component - Click on a file like "Header.jsx" or "Button.jsx"
  4. Look at the code - See what Lovable created
  5. Don't worry about understanding - Just observe!

What you learned: Your project has organized code files, even though you built it with prompts!

Practice 2: Find a Specific Feature

Task: Locate code for a feature you built

  1. Think of a feature - Like "the contact form" or "the navigation menu"
  2. Look for it in Code Mode - Browse files to find it
  3. Open the file - See how it's coded
  4. Notice the structure - See how it's organized

What you learned: Every feature you build with prompts has corresponding code!

Practice 3: Compare Prompt vs. Code (Optional)

Task: See how prompts translate to code

  1. Make a change with a prompt:
    Change the button color to red
    
  2. Open Code Mode - Find the button file
  3. See the change - Notice how the code changed
  4. Understand the connection - Prompts modify code!

What you learned: Prompts and code are connected - prompts modify the code for you!


✅ Module 7 Checklist

Before moving to Module 8, make sure you can:

  • Explain what Code Mode is
  • Know when to use Code Mode vs. prompts
  • View your project's code structure
  • Open and view code files
  • Understand that code editing requires a paid plan
  • Know that prompts work for everything on free plans
  • Use Code Mode as a learning tool (optional)

🤔 Common Questions (FAQ)

Q: Do I need to learn code to use Lovable?

A: No! You can build entire apps using only prompts. Code Mode is optional.

Q: Can I build everything with prompts?

A: Yes! Prompts can handle almost everything. Code Mode is mainly for advanced customization.

Q: What if I want to learn code?

A: Code Mode is great for learning! View the code Lovable creates to see how things work.

Q: Do I need a paid plan?

A: Only if you want to edit code directly. You can view code on all plans, and prompts work on all plans.

Q: Is code editing hard?

A: It can be, but you don't need it! Prompts are much easier for beginners.

Q: Should I use Code Mode or prompts?

A: Start with prompts! Only use Code Mode if you're curious, learning, or need precise control.


🎯 What's Next?

Great job! You now understand Code Mode and when (or if) you might want to use it. Remember:

  • Prompts are usually better - Easier and faster
  • Code Mode is optional - You can build everything without it
  • It's a learning tool - Great for understanding how things work

Ready for Module 8? In the next module, we'll learn how to deploy and publish your applications - making them live on the internet for the world to see!


💡 Pro Tips for Beginners

  1. Stick with prompts - They're easier and work for almost everything

  2. Don't be intimidated - Code looks complex, but you don't need to understand it

  3. Use Code Mode to learn - View code out of curiosity, not necessity

  4. Focus on building - Prompts let you build without code knowledge

  5. Learn gradually - If you're interested in code, learn slowly by viewing what Lovable creates

  6. Remember: You're not required to use Code Mode - Many successful Lovable users never touch code!


Module 7 Complete! 🎉