Overview
ZapDev generates complete, functional applications with multiple files. Each AI response creates a new code fragment containing all the files needed for your application. You can view, preview, and understand the structure of your generated code.Understanding Fragments
A fragment is a complete snapshot of your application at a specific point in the conversation:- Created after each successful AI response
- Contains all project files (components, pages, styles, config)
- Includes a live preview URL
- Stored with metadata about the framework and generation time
Fragment Structure
File Preview
Each message with generated code displays:Interactive Preview
The live preview shows your application running in a secure sandbox:- Real-time rendering - See changes instantly
- Isolated environment - Runs in E2B sandbox containers
- Full functionality - Interactive components work as expected
- Framework-specific - Respects your chosen framework conventions
File Explorer
Browse all generated files:View File Tree
Generated code appears in the message response with a file browser showing the project structure.
Navigate Files
Click on any file to view its contents:
- Components
- Pages/Routes
- Styles
- Configuration files
- Package definitions
File Types by Framework
Next.js Projects
Angular Projects
React Projects
Vue Projects
Svelte Projects
Working with Generated Code
Viewing Code
Each fragment displays code with:- Line numbers - Easy reference for discussion
- Syntax highlighting - Language-aware formatting
- Copy button - Quick copy to clipboard
- File path - Clear file location in project structure
Understanding Changes
When you request modifications, ZapDev:- Analyzes existing code - Reviews current fragment files
- Applies changes - Modifies only affected files
- Maintains structure - Preserves project organization
- Creates new fragment - Saves updated version
Fragment Drafts
ZapDev maintains a draft fragment for each project:- Stores work-in-progress code
- Updates as AI generates new versions
- Persists between sessions
- Framework-specific structure
Sandbox URLs
Each fragment includes a live preview URL:- Persistent - URL remains active for the session
- Isolated - Runs in secure container
- Pre-warmed - Fast initial load
- Framework-aware - Configured for your chosen framework
File Metadata
Generated files include metadata:| Field | Description | Example |
|---|---|---|
| Path | File location in project | components/Button.tsx |
| Size | File size in bytes | 2,458 bytes |
| Language | Detected language | TypeScript |
| Modified | Last generation time | 2 minutes ago |
Common File Patterns
Component Files
Reusable UI components:Page Files
Route-level pages:Configuration Files
Framework and build configs:Best Practices
Review Generated Code - Always review the files to understand what was created and ensure it matches your requirements.
Test in Preview - Use the live preview to verify functionality before requesting further changes.
Request Specific Files - When asking for changes, reference specific files by name:“Update the Header component in components/Header.tsx to include a search bar”
Understand Structure - Familiarize yourself with your framework’s file organization to make better requests.
Exporting Code
To use your generated code:- Copy individual files - Use the copy button on each file
- Set up locally - Create a new project with your framework’s CLI
- Paste files - Add the generated code to your local project
- Install dependencies - Run
bun installor equivalent - Start dev server - Run your framework’s dev command
Example: Exporting Next.js Project
Troubleshooting
Preview Not Loading
- Wait for generation - Large projects take 30-60 seconds
- Check sandbox status - Look for error messages
- Refresh page - Sometimes reconnection is needed
Files Not Showing
- Check message status - Ensure message is marked “Complete”
- Verify fragment - Confirm fragment was created successfully
- Review errors - Look for generation errors in message
Code Not Working
- Request fixes - Describe the issue in a new message
- Check console - Browser console may show errors
- Simplify feature - Try requesting in smaller steps