This repository demonstrates how to "vibe code" a full-stack invoice processing application using Cursor/Claude Code from a simple starting file. This showcases building a complete Streamlit application with LlamaCloud's document extraction capabilities.
This repository provides a complete end-to-end solution for building intelligent document processing applications:
- Vibe Coding Templates to Create Full Web Applications: Provides comprehensive prompts that can be used alongside coding assistants like cursor to one-shot transform simple scripts into production web applications
- LlamaCloud Integration: Automatically creates and configures LlamaExtract extraction agents using predefined Pydantic schemas for structured data extraction
- Sample scripts: Sample scripts that can be used as context for coding assistants while generating new streamlit apps!
This repository demonstrates vibe coding - rapidly building applications through iterative AI-assisted development. The goal is to transform a simple script into a full-featured application using Cursor/Claude Code.
- Python 3.11+
- LlamaCloud account and API key (Get one here)
git clone <your-repo-url>
cd invoice-extraction-vibe-coding
pip install -r requirements.txt- Go to LlamaCloud and log in
- Create a new project and note your
project_idandorganization_id - Get your API key from your account settings
Copy the template and add your credentials:
cp .env.template .envThen edit .env with your LlamaCloud credentials:
LLAMA_CLOUD_API_KEY=your_actual_api_key
LLAMA_CLOUD_PROJECT_ID=your_actual_project_id
LLAMA_CLOUD_ORGANIZATION_ID=your_actual_organization_id
LLAMA_CLOUD_AGENT_NAME=invoice_extraction_agentpython create_agent.pyThis automatically creates an extraction agent in LlamaCloud using the invoice schema from sample_data/sample_schema.py.
python sample.pyThis validates your configuration and runs extraction on the sample invoice. You should see structured JSON output.
Now comes the fun part - use the cursor_prompt.md template to transform sample.py into a full application:
- Open your project in Cursor or Claude Code
- Copy the prompt from
cursor_prompt.md - Start iterating: "Transform this simple script into a professional Streamlit app with..."
- Build features incrementally through natural language prompts
When you're done vibe coding, compare your creation with our app.py to see different approaches!
invoice-extraction-vibe-coding/
βββ app.py # Full-featured Streamlit application (generated)
βββ sample.py # Starting point - simple extraction script
βββ create_agent.py # Script to create LlamaCloud extraction agent
βββ .env.template # Environment variables template
βββ requirements.txt # Python dependencies
βββ cursor_prompt.md # Cursor prompt template for vibe coding
βββ sample_data/ # Sample invoice data
βββ batch1-0274.jpg # Sample invoice image
βββ sample_schema.py # Pydantic models for data structure
- Starting Point:
sample.py- A basic 20-line script that calls LlamaCloud extraction - End Result:
app.py- A fully-featured Streamlit application with:- Professional UI with custom CSS
- File upload functionality
- Real-time data extraction
- Structured data display
- Invoice history tracking
- Status indicators and metrics
- Document parsing and extraction using LlamaExtract
- Structured data output using predefined schemas
- Integration with kaggle_invoice_agent
This project demonstrates vibe coding - rapidly building applications through conversational AI development.
The cursor_prompt.md file contains a comprehensive prompt template that can potentially one-shot the entire application transformation:
- Copy the main prompt from
cursor_prompt.md - Paste it into Cursor/Claude Code with your
sample.pyfile open - Watch the magic happen - the AI may build the entire Streamlit app in one go!
- Start Simple:
sample.py- a working 20-line script - Use Natural Language: Describe what you want, not how to build it
- Iterate if Needed: Add features through follow-up prompts
- Build Incrementally: Test and refine each addition
- Comprehensive Scope: Covers UI, functionality, and user experience
- Clear Context: References your actual files and sample data
- Specific Examples: Shows exactly what features to build
- Production-Ready: Asks for professional-quality output
Try the full prompt first - you might be surprised how much gets built in a single interaction!
- π Multi-format Support: JPG, JPEG, PNG, BMP, TIFF
- π¨ Professional UI: Custom CSS styling and responsive design
- π Data Visualization: Structured invoice data display
- π Analytics: Processing metrics and status tracking
- π Real-time Processing: Live extraction with progress indicators
- πΎ Session Storage: Invoice history within session
The application extracts structured invoice data including:
- Invoice metadata (number, date)
- Seller and client information
- Line items with pricing details
- VAT calculations and summaries
- Total amounts
See sample_data/sample_schema.py for the complete Pydantic model definitions.
- Upload Invoice: Drag and drop or select an invoice image
- Extract Data: Click the extraction button to process with LlamaCloud
- View Results: See structured data in formatted tables and JSON
- Track History: View processed invoices in the history tab
Update these values in your application for your own LlamaCloud setup:
project_id = "your-project-id"
organization_id = "your-organization-id"
agent_name = "your-agent-name"- API Key: Ensure your LlamaCloud API key is valid and in
.env - Dependencies: Run
pip install -r requirements.txt - File Formats: Only image formats are supported
- File Size: Keep images under 10MB for best performance
This is an educational example demonstrating the vibe coding approach. Feel free to:
- Fork and modify for your use case
- Share improvements and variations
- Use as a starting point for your own projects
Open source - use freely for learning and development.
Built with β€οΈ using LlamaIndex, LlamaCloud, and the power of vibe coding with Cursor/Claude Code!