LoomCode AI

Docs · Quickstart

Build your first app

Go from a prompt to a running preview in LoomCode: pick a framework and model, write a specific prompt, iterate, then download or share the result.

Updated Nov 22, 20267 min readtested

You describe an app in the builder at /build, a language model writes the project files, and LoomCode starts them in a temporary cloud sandbox so you can click around. This page walks through one complete run using a prompt we tested on 2026-11-22, then covers follow-ups, preview expiry, downloads and share links.

Open the tested Streamlit prompt in the builder

Before you start

Sign in with a LoomCode account. Free includes 7 generations per day with the default OpenAI model. Sandbox starts have a separate limit. See pricing and limits.

Open Projects from the builder navigation to save your generated source. Saving keeps the code and project settings. Copy any prompts you want to keep before closing the tab.

1. Pick a framework and a model

The composer has two pickers under the prompt box.

Framework. Leave it on auto and the model chooses a template from your prompt, or pick one explicitly. Picking one gives the model framework-specific instructions and usually produces more reliable results. The available sandbox templates are:

Sandbox runtime versions
FrameworkRuntimeKey packagesOutputObserved in E2B
ReactNode.js 22.23.5react 19.2.4, react-dom 19.2.4, vite 8.3.8, typescript 5.9.3web previewNov 23, 2026
Next.jsNode.js 21.7.3next 14.2.20, react ^18, tailwindcss ^3.4.1, shadcn/ui componentsweb previewNov 22, 2026
Vue / NuxtNode.js 21.7.3nuxt ^4.0.3, vue ^3.5.20, nuxi 3.28.0web previewNov 22, 2026
Python (code interpreter)Python 3.13pandas 2.2.3, matplotlib 3.11.2, plotly 6.0.1, seaborn 0.13.2notebook outputNov 22, 2026
StreamlitPython 3.9.23streamlit 1.49.1, pandas 2.3.2, numpy 2.0.2, plotly 6.3.0web previewNov 22, 2026
GradioPython 3.9.23gradio 4.44.1web previewNov 22, 2026
PHPPHP 8.2.29Composer 2.8.11, PDO (sqlite, mysql drivers)web previewNov 22, 2026
LaravelPHP 8.2.29Laravel Framework 12.27.0, SQLiteweb previewNov 22, 2026

Choose by what you want to show:

  • A data app with filters and charts: Streamlit.
  • A one-off analysis that prints numbers and draws a chart: Python (code interpreter, no web URL).
  • A model demo with inputs and outputs: Gradio.
  • A web UI: React, Next.js or Vue/Nuxt.
  • Server-rendered forms with a database: PHP or Laravel (SQLite).

Model. The default is GPT-6.2 Sol (gpt-6.2-sol). It is the only model we have call-tested end to end; every recorded example on this site used it. The Pro picker shows configured premium models. If you want to attach screenshots, choose a model that accepts images. See all supported models.

2. Write a specific prompt

The model can only build what you describe. Good prompts name:

  1. The data. What records exist, their fields, and where they come from (built-in sample data, a public URL, or a user upload).
  2. The screens and controls. Filters, forms, tables, charts, buttons.
  3. The behavior. What changes when someone clicks, filters or submits.
  4. Constraints. "Use plain CSS", "no external chart library", "validate on the server".

Here is the prompt we used for the worked example. It is short, but every sentence maps to something you can check in the result:

A sales dashboard with a built-in sample dataset of 200 orders (date, region, product, units, revenue). Sidebar filters for region and date range, KPI cards, a monthly revenue line chart, revenue by product bar chart and a CSV download of the filtered rows. Also allow uploading a CSV with the same columns.

A few things to know about inputs:

  • The prompt box accepts images only (PNG, JPEG, WebP or GIF, up to 4 images, 5 MB each), and only when the selected model is vision-capable. You cannot attach a CSV. For data, either describe sample data the code should generate, give a public URL in the prompt, or ask for an upload control in the generated app, as this prompt does.
  • Prompts are limited to 24,000 characters per message.

For more prompt patterns, see the use cases.

3. What happens when you press Generate

  1. Your browser sends the conversation (and any images) to the LoomCode server.
  2. The server sends it to the model provider you selected, with instructions for the chosen template.
  3. The model streams back a JSON project: a short plan, a title, the files, any extra dependencies and the port. You can watch files appear in the Code tab.
  4. The server starts an E2B cloud sandbox from the matching template, installs extra dependencies (the install command is built on the server from validated package names), writes the files, and returns a preview URL. For Laravel it also runs migrations and seeders. For the Python template it runs the code once and returns the output instead of a URL.

For the example prompt, the recorded run took 20.7 seconds to generate and 3.6 seconds to start the sandbox. Across our twelve recorded examples, generation took 9 to 50 seconds and sandboxes started in 1 to 9 seconds. These are single runs, not benchmarks; your times depend on the model, the size of the app and provider load.

Streamlit sales dashboard with sidebar region and date filters, four KPI cards, a monthly revenue line chart and a revenue by product bar chart
The generated dashboard in the sandbox preview, before any filters were changed.
The same dashboard after uploading a three-row CSV, showing 3 orders and revenue of 125.50
After uploading a small CSV with the same columns, the dashboard switched to the uploaded data.

You can read the full generated file:

app.py122 lines
from io import BytesIO

import numpy as np
import pandas as pd
import plotly.express as px
import streamlit as st


COLUMNS = ['date', 'region', 'product', 'units', 'revenue']
PRODUCTS = {'Notebook': 8.5, 'Desk Lamp': 32.0, 'Backpack': 48.0, 'Water Bottle': 16.0}


@st.cache_data
def sample_orders():
    rng = np.random.default_rng(42)
    products = rng.choice(list(PRODUCTS), size=200)
    units = rng.integers(1, 13, size=200)
    return pd.DataFrame({
        'date': pd.Timestamp('2025-01-01') + pd.to_timedelta(rng.integers(0, 365, size=200), unit='D'),
        'region': rng.choice(['North', 'South', 'East', 'West'], size=200),
        'product': products,
        'units': units,
        'revenue': [round(quantity * PRODUCTS[product], 2) for quantity, product in zip(units, products)],
    }).sort_values('date', ignore_index=True)


@st.cache_data
def read_orders(content):
    orders = pd.read_csv(BytesIO(content), encoding='utf-8-sig', dtype='string', keep_default_na=False)
    orders.columns = orders.columns.str.strip().str.lower()
    if len(orders.columns) != len(COLUMNS) or set(orders.columns) != set(COLUMNS):
        raise ValueError('Use exactly these columns: date, region, product, units, revenue.')
    if orders.empty:
        raise ValueError('The CSV must contain at least one order.')

    orders = orders[COLUMNS].copy()
    dates = pd.to_datetime(orders['date'].str.strip(), format='%Y-%m-%d', errors='coerce')
    if dates.isna().any():
        raise ValueError('Every date must be a valid calendar date in YYYY-MM-DD format.')
    orders['date'] = dates

    for column in ('region', 'product'):
        orders[column] = orders[column].str.strip()
        if orders[column].eq('').any():
            raise ValueError(f'Every order must have a {column}.')

    for column in ('units', 'revenue'):
        values = pd.to_numeric(orders[column], errors='coerce')
        if values.isna().any() or not np.isfinite(values).all():
            raise ValueError(f'Every {column} value must be a finite number.')
        orders[column] = values
    if (orders['units'] < 0).any() or (orders['units'] % 1 != 0).any():
        raise ValueError('Units must be non-negative whole numbers.')
    return orders.sort_values('date', ignore_index=True)


def show_dashboard(orders, source):
    regions = sorted(orders['region'].unique())
    selected_regions = st.sidebar.multiselect('Region', regions, default=regions)
    first = orders['date'].min().date()
    last = orders['date'].max().date()
    selected_dates = st.sidebar.date_input('Date range', (first, last), min_value=first, max_value=last)
    if len(selected_dates) != 2:
        st.info('Select both a start and an end date.')
        return

    start, end = map(pd.Timestamp, selected_dates)
    filtered = orders.loc[orders['region'].isin(selected_regions) & orders['date'].between(start, end)]
    revenue = filtered['revenue'].sum()
    count = len(filtered)
    st.caption(f'{source} · Showing {count:,} of {len(orders):,} orders. Revenue uses the source data’s currency.')

    cards = st.columns(4)
    cards[0].metric('Revenue', f'{revenue:,.2f}')
    cards[1].metric('Orders', f'{count:,}')
    cards[2].metric('Units sold', f'{filtered["units"].sum():,.0f}')
    cards[3].metric('Average order value', f'{revenue / count:,.2f}' if count else '—')

    if filtered.empty:
        st.info('No orders match the filters. Select a region or widen the date range.')
    else:
        months = pd.period_range(start, end, freq='M')
        monthly = filtered.groupby(filtered['date'].dt.to_period('M'))['revenue'].sum()
        monthly = monthly.reindex(months, fill_value=0).rename_axis('month').reset_index()
        monthly['month'] = monthly['month'].dt.to_timestamp()
        by_product = filtered.groupby('product', as_index=False)['revenue'].sum().sort_values('revenue', ascending=False)
        left, right = st.columns(2)
        with left:
            st.header('Monthly revenue')
            st.plotly_chart(px.line(monthly, x='month', y='revenue', markers=True,
                                   labels={'month': 'Month', 'revenue': 'Revenue'}))
        with right:
            st.header('Revenue by product')
            st.plotly_chart(px.bar(by_product, x='product', y='revenue',
                                  labels={'product': 'Product', 'revenue': 'Revenue'}))

    st.download_button('Download filtered CSV', filtered.to_csv(index=False, date_format='%Y-%m-%d'),
                       file_name='filtered_orders.csv', mime='text/csv')


def main():
    st.set_page_config(page_title='Sales Dashboard', layout='wide')
    st.title('Sales Dashboard')
    st.write('Use the sample orders or upload your own CSV to explore sales by month, region, and product.')
    st.sidebar.header('Data source')
    upload = st.sidebar.file_uploader('Upload orders', type=['csv'],
                                      help='Columns: date (YYYY-MM-DD), region, product, units, revenue.')
    if upload is None:
        orders, source = sample_orders(), 'Sample data'
    else:
        try:
            orders, source = read_orders(upload.getvalue()), 'Uploaded data'
        except ValueError as exc:
            st.error(f'Could not load the CSV: {exc}')
            return
    st.sidebar.header('Filters')
    show_dashboard(orders, source)


if __name__ == '__main__':
    main()

The step-by-step walkthrough of this app is in Create a Streamlit data app with AI.

4. Check the result

Treat the preview as a first draft. Click every control you asked for. In the example we checked the KPI totals, changed a filter, uploaded a file and looked for the download button. If something is missing or wrong, ask for a change rather than starting over.

If the preview shows an error page instead of the app, open the Code tab, then see Troubleshooting. Common causes are a dependency the template does not have, or a configuration file the model rewrote.

5. Iterate with follow-ups

After the first result, the prompt box says "Ask for a change". Each follow-up is a new generation:

  • The model receives the conversation and previously generated files in the current builder session. Name the changes you want and the behavior you want to keep.
  • Each follow-up counts as one generation and starts a new sandbox, so it uses both daily limits.
  • Undo removes the last request and answer. Try again (shown after an error) resends the last request. New clears the conversation.

Focused follow-ups work best: one or two concrete changes at a time, such as "Add a product filter to the sidebar" or "Show revenue with two decimals and a currency symbol."

6. Mind the preview timer

The preview runs in a temporary sandbox that is deleted after about 10 minutes (about 30 minutes for Nuxt/Vue, which compiles slowly). The preview header shows the time left and then "Sandbox stopped". After that the URL no longer works, but the generated files are still in your browser tab, so you can still download them.

7. Download your code

Open the Code tab. You can:

  • Copy or download any single file.
  • Download Generated files (.zip): the files the model wrote, plus a README.md with run steps and a loomcode.json manifest. This works at any time, even after the sandbox has stopped.
  • Download Full project from sandbox: while the sandbox is still running, a ZIP of the whole project directory, without dependencies, build output, local databases or .env files.

Exactly what each download contains, and how to run it locally, is described in Export.

8. Share a temporary preview

For web templates (not the Python interpreter), Share preview keeps the sandbox running for 30 minutes, 1, 3, 6 or 24 hours (the maximum) and gives you a link. Anyone with the link can open the running app until it expires. It is a review link, not hosting. For a permanent URL, export the project and deploy it; see Preview, share, export and deploy.

Next steps

Read the deployment guide