# Build a full-stack app

> Follow a 15-minute hands-on tutorial from opening prompt to Design Canvas, accounts, Cloud tables, 0%-fee Stripe test checkout, HTTPS publish, and Android QR check.

- Canonical: https://exaspark.ai/docs/first-full-stack-app/

## What you will build in 15 minutes

Shipping one complete application teaches ExaSpark's workflow faster than reading ten feature pages. In this tutorial, you will build **Kova Pilates**, a neighborhood studio app where clients browse classes, sign up, buy passes, and appear on an instructor roster.

You can finish every step on the **Free** plan (`$0/mo`), which starts with `4,000` welcome credits, `1,000` daily credits when you open ExaSpark (Free-only), and a separate `5,000/month` app-running pool for published apps. No credit card, terminal, or external host is needed.

```text
What your 15-minute build produces:
1. Locked visual tokens from Design Canvas (palette, type, spacing)
2. Public schedule page + member account portal
3. Managed Cloud tables: classes, bookings, passes, and users
4. Admin-only instructor roster with server-side role checks
5. Stripe Test checkout ($25 drop-in + $89/mo pass, 0% ExaSpark fee)
6. Live .exaspark.app HTTPS URL + installable Android QR app
```

Every build step runs in your isolated **Preview** environment first, so you can test fake cards and undo experiments freely before clicking **Publish**.

## Milestone 1: Lock the look on Design Canvas

Spend three minutes in **Design** mode first so typography, colors, and spacing carry consistently into every screen you build later.

1. **Start in Design mode** — Open [exaspark.ai](https://exaspark.ai/), switch the composer to **Design**, and attach a logo or two studio photos via **+** if available.
2. **Compare three concepts** — Run the prompt below to render three homepage directions side by side on the **Design Canvas**.
3. **Adopt the winner** — Check headline hierarchy, button contrast, and mobile balance, edit copy inline if needed, and adopt your pick to freeze its visual tokens.

> **Example prompt (Design):** Create three homepage directions for Kova Pilates, a neighborhood reformer studio: one warm linen editorial layout with serif headings, one calm studio grid with sage accents, and one high-contrast black-and-white schedule layout. Show a hero section, today's schedule preview, and two pass cards.

> **Note:** Freezing tokens on the [Design Canvas](https://exaspark.ai/docs/design-canvas/) saves credits later — every login form, checkout modal, and admin table inherits your locked palette automatically.

## Milestone 2: Generate screens, accounts, and Cloud tables

Switch the composer mode to **App** and describe your tables, user roles, and rules in plain English. ExaSpark builds your pages, API routes, relational tables, and server-side permission checks in one coordinated turn.

> **Example prompt (App):** Build the Kova Pilates booking app using our adopted design system. Include public class browsing by day, email and Google sign-in, a My Bookings dashboard where members cancel up to 12 hours ahead, and an Admin Roster page restricted strictly to admin accounts for checking members in. Create linked Cloud tables for classes, users, passes, and bookings, enforce class capacity on the server, and block double bookings.

### Answer choice cards and verify Cloud rows

If a product rule is open — like whether waitlists auto-promote canceled spots — the Agent posts a compact **choice card** in chat. Pick an option or reply with your exact business rule.

Once **Preview** loads, verify data and role isolation before adding payments:

1. **Register a test member** — Sign up inside **Preview** (for example `maya@example.com`) and book a morning reformer slot.
2. **Inspect Cloud tables** — Open the **Cloud** tab, confirm the top toggle reads **Preview**, and open `bookings` to verify Maya's `user_id`, `class_id`, and `confirmed` status saved accurately.
3. **Confirm admin blocking** — While signed in as Maya (`member`), open `/admin` in the route bar and verify the server blocks access cleanly.
4. **Test an admin account** — In **Cloud** `users`, set a second test account's `role` to `admin`, sign in as that user in **Preview**, and verify instructor check-in persists after refresh.

Checking both roles immediately prevents permission bugs from hiding until launch. See [Accounts & database](https://exaspark.ai/docs/accounts-and-data/) and [Authentication & roles](https://exaspark.ai/docs/authentication-and-roles/).

## Milestone 3: Wire 0%-fee Stripe Test checkout

Now turn bookings into paid drop-ins and recurring memberships. ExaSpark charges **0% platform fees** on Stripe revenue across all plans; only standard Stripe card processing fees apply.

> **Example prompt (App):** Add Stripe checkout to Kova Pilates with two plans: a $25 Single Reformer Drop-In (one-time payment granting 1 booking credit) and an $89/month 5-Class Membership (monthly subscription). Store prices in integer cents on the server, grant passes only after Stripe webhook verification confirms payment, and list receipts on the member's Account page.

### Verify checkout and webhook fulfillment

Never trust checkout just because a payment screen opens. Verify that Stripe notifies your backend and updates **Cloud** cleanly in **Preview** (which runs strictly in Stripe **Test mode**):

1. **Launch a test purchase** — Sign in as your test member in **Preview**, pick the `$25` Drop-In pass, and click through to Stripe Checkout.
2. **Enter Stripe's test card** — Submit `4242 4242 4242 4242` with any future expiry and 3-digit CVC (`$0` charged).
3. **Check persistence after refresh** — Confirm the member's pass balance increments by `1` and stays `1` after reloading the page.
4. **Verify Cloud records** — Open **Cloud** (`Preview`) and confirm the payment record shows `paid` with a Stripe session reference.

If checkout redirects back without crediting the pass, trace webhook logs using [Testing Stripe & webhooks](https://exaspark.ai/docs/testing-stripe-and-webhooks/).

## Milestone 4: Polish with click-to-edit and Device Lab

Polish wording and check phone layouts without spending full build turns on small copy tweaks.

| Polish check | Best studio tool | What to confirm |
| --- | --- | --- |
| **Copy, labels & spacing** | **Click-to-edit** in **Preview** | Click inline to tighten `"Submit"` into `"Reserve reformer"` |
| **Phone & foldable UX** | [Browser Device Lab](https://exaspark.ai/docs/device-lab/) | Check iPhone, Pixel, Galaxy, and foldable frames for overflow or cramped taps |
| **Error states & Undo** | Interactive **Preview** + **Undo** | Test a full class or bad email, and revert experiments in one click |

## Milestone 5: Publish live and test on your phone

Your app now runs end to end in **Preview**. Deploy an immutable production release and test the real mobile app in your hand.

1. **Click Publish** — ExaSpark builds a production release, creates an isolated **Live** database, and serves your app over HTTPS at `.exaspark.app`.
2. **Add production classes in Live** — Because **Preview** and **Live** databases stay strictly separated, switch **Cloud** to **Live** and add your real class schedule (or import via CSV).
3. **Scan the Android QR code** — Open mobile distribution, scan the QR code on an Android phone, and install Kova Pilates directly to verify touch ergonomics and sign-in.
4. **Test iPhone via Safari** — Open your `.exaspark.app` URL in Safari, tap **Share**, and select **Add to Home Screen** for a full-screen icon and app-like launch.
5. **Upgrade when going branded** — Switch Stripe to **Live mode** before taking real cards, and upgrade to **Starter** (`$4.99/mo` or `$3.99/mo` annually) when ready for a custom domain, badge removal, and Google Play `.aab` export.

> **Note:** **Safe post-launch iteration:** Every future prompt updates **Preview** first. Live visitors see zero changes until you click **Publish** again — and prior live releases stay one click away for rollback.

## Tutorial troubleshooting

| Symptom | Likely cause | Fastest fix |
| --- | --- | --- |
| **Member can open `/admin`** | Nav link was hidden without a server role check | Prompt ExaSpark to enforce server-side `role === "admin"` checks on admin pages and APIs |
| **Red Preview build banner** | A new route or import failed compile or startup | Click **Ask AI to fix** so the Agent reads the exact log and patches the cause |
| **Pass balance resets on reload** | Balance updated in browser state instead of webhook + **Cloud** | Ask the Agent to write pass grants inside the verified Stripe webhook handler |
| **Live schedule is empty** | Test classes live only in the **Preview** database | Switch **Cloud** to **Live** and seed production classes or import a CSV |
| **Personal Visa declined in Preview** | **Preview** runs Stripe **Test mode** by design | Use `4242 4242 4242 4242` in **Preview**; switch to **Live mode** for production |
| **Android blocks QR install** | Browser lacks permission for direct app installs | Allow `"Install unknown apps"` once for Chrome, or export `.aab` for Google Play on Starter/Pro |

## Next steps

- [Accounts & database](https://exaspark.ai/docs/accounts-and-data/) — Design clean relational schemas, foreign keys, and safe post-launch migrations.
- [Testing Stripe & webhooks](https://exaspark.ai/docs/testing-stripe-and-webhooks/) — Master test cards, webhook debugging, and safe Test-to-Live cutover.
- [Android QR install](https://exaspark.ai/docs/android/) — Share installable Android builds and prepare Google Play `.aab` releases.

## From the blog

- [How to build a booking app](https://exaspark.ai/blog/how-to-build-a-booking-app/) — Practical architecture for schedules, deposits, cancellations, and admin rosters.
- [From a spark to a running business](https://exaspark.ai/blog/from-spark-to-running-business/) — See how product, payments, and growth run inside one platform.
- [How online payments work](https://exaspark.ai/blog/how-online-payments-work/) — Plain-English breakdown of checkouts, webhooks, settlements, and Stripe fees.
