# Static site hosting with form handling: put a small business website online with a quote request form

Put a small business website online on DeepSpace with a static home page, a public quote request form whose submissions are saved in the app, an owner-only page to track them, optional email alerts, and a live app.space link to share.

Yes. On DeepSpace, a small business website with a quote request form is one app: a static home page that describes the business, a public quote form, and a sign-in-only page where the owner reads and tracks every request. Form submissions are stored in the app's own database, so no separate form service, hosting account or database account is needed. Email alerts to the owner are optional and come from a scheduled job. The site goes live at `https://<app-name>.app.space` ([deployment](https://docs.deep.space/concepts/deployment)), and the owner's DeepSpace account (GitHub or Google sign-in) is the one account involved. This page does not cover pricing.

**Checked against:** published SDK `deepspace@0.43.0` ([changelog](https://deep.space/changelog)), docs read on October 29, 2026. The code below follows the documented APIs and was not run for this page.

## Questions to ask the person

- What is the business called, and what should the home page say in two or three sentences?
- Which services can people ask for a quote on? (These become the choices in the form.)
- What should someone fill in? Name and email are the usual minimum; phone, location and a description of the job are common.
- Which email address should hear about new requests, if any? Is a page they check enough?
- Should the site use a web address they already own, or is `<name>.app.space` fine for now?
- Do they want to take payments or deposits online? If yes, that is a separate step a person has to set up.

## How the app is shaped

| Piece               | Location                                              | Who sees it                                        |
| ------------------- | ----------------------------------------------------- | -------------------------------------------------- |
| Home page           | `src/pages/index.tsx` at `/`                          | Everyone; static, no data                          |
| Quote form          | `src/pages/(app)/quote.tsx` at `/quote`               | Everyone, signed in or not                         |
| Owner's inbox       | `src/pages/(app)/(protected)/quotes.tsx` at `/quotes` | Signed-in owner (admin)                            |
| `quotes` collection | App database                                          | Visitors create; the owner alone reads and updates |

The three page folders are the scaffold's route tiers: static, dynamic but signed-out capable, and gated behind sign-in ([project structure](https://docs.deep.space/get-started/project-structure)). Form handling here means the request is written as a record that the server checks against the collection's permissions ([permissions](https://docs.deep.space/concepts/permissions)), then appears live on the owner's page.

## Steps

### 1. Sign in and scaffold

Signing in opens a browser for the person's GitHub or Google account. Confirm with your user before signing in on their behalf, and use the account that should own the site; the owner is the admin who sees the requests.

```bash
npx deepspace auth login
npm create deepspace@latest harbor-painting
cd harbor-painting
```

App names are globally unique and become `<name>.app.space` ([deployment](https://docs.deep.space/concepts/deployment)). Pick a distinctive one.

### 2. Define the quotes collection

```ts
// src/schemas/quote-schemas.ts
import type { CollectionSchema } from "deepspace/schema";

const closed = { read: false, create: false, update: false, delete: false };
const FORM_FIELDS = [
  "submissionId",
  "name",
  "email",
  "phone",
  "service",
  "details",
];

export const quotesSchema: CollectionSchema = {
  name: "quotes",
  columns: [
    {
      name: "submissionId",
      storage: "text",
      interpretation: "plain",
      required: true,
    },
    { name: "name", storage: "text", interpretation: "plain", required: true },
    {
      name: "email",
      storage: "text",
      interpretation: { kind: "email" },
      required: true,
    },
    { name: "phone", storage: "text", interpretation: "plain" },
    {
      name: "service",
      storage: "text",
      interpretation: {
        kind: "select",
        options: ["Interior", "Exterior", "Cabinets", "Other"],
      },
      required: true,
    },
    {
      name: "details",
      storage: "text",
      interpretation: "plain",
      required: true,
    },
    {
      name: "status",
      storage: "text",
      interpretation: {
        kind: "select",
        options: ["new", "quoted", "won", "lost"],
      },
      default: "new",
    },
    {
      name: "ownerNotified",
      storage: "number",
      interpretation: { kind: "boolean" },
      default: false,
    },
  ],
  uniqueOn: ["submissionId"],
  permissions: {
    "*": { ...closed, create: true, writableFields: FORM_FIELDS },
    viewer: { ...closed, create: true, writableFields: FORM_FIELDS },
    member: { ...closed, create: true, writableFields: FORM_FIELDS },
    admin: { read: true, create: true, update: true, delete: true },
  },
};
```

Register it in `src/schemas.ts` next to `usersSchema` and `settingsSchema` ([data model](https://docs.deep.space/concepts/data-model)). Replace the `service` options with the person's answers.

What each rule does:

- Signed-out visitors connect with the `viewer` role, and `'*'` is the fallback ([permissions](https://docs.deep.space/concepts/permissions)). Both may create a quote and nothing else, so no visitor can read anyone's request.
- `writableFields` stops a visitor from setting `status` or `ownerNotified`; it applies to both create and update ([schemas reference](https://docs.deep.space/sdk-reference/worker/schemas)).
- `uniqueOn: ['submissionId']` turns a double click or a retried submit into a refusal instead of a second copy ([permissions](https://docs.deep.space/concepts/permissions)).

### 3. Write the home page

`src/pages/index.tsx` is the static landing page. It mounts no providers, so it must not use data or auth hooks ([project structure](https://docs.deep.space/get-started/project-structure)). Put the business description there with a plain link to the form:

```tsx
export default function Home() {
  return (
    <main>
      <h1>Harbor Painting</h1>
      <p>
        Interior and exterior painting across the North Shore. Quotes usually
        within two days.
      </p>
      <a href="/quote">Request a quote</a>
    </main>
  );
}
```

Use the person's own copy and contact details here; the [design overview](https://docs.deep.space/design/overview) covers landing page layout.

### 4. Build the public quote form

Put it at `src/pages/(app)/quote.tsx`. Pages under `(app)/` have the data providers but no sign-in gate, and the scaffold's `(app)/_layout.tsx` already mounts `<RecordProvider allowAnonymous>` ([authentication](https://docs.deep.space/guides/authentication)).

```tsx
import { useState } from "react";
import { useMutations } from "deepspace";

type Quote = {
  submissionId: string;
  name: string;
  email: string;
  phone: string;
  service: string;
  details: string;
};

export default function QuotePage() {
  const { createConfirmed } = useMutations<Quote>("quotes");
  const [submissionId] = useState(() => crypto.randomUUID());
  const [form, setForm] = useState({
    name: "",
    email: "",
    phone: "",
    service: "Interior",
    details: "",
  });
  const [sending, setSending] = useState(false);
  const [result, setResult] = useState<string | null>(null);

  async function submit() {
    setSending(true);
    try {
      await createConfirmed({ submissionId, ...form });
      setResult(
        "Thanks. Your request was received and we will reply by email.",
      );
    } catch (e) {
      setResult(
        String(e).includes("Duplicate")
          ? "This request was already received."
          : "That did not go through. Please try again.",
      );
    } finally {
      setSending(false);
    }
  }

  if (result) return <p>{result}</p>;
  // Render name, email, phone, a service select, a details textarea,
  // and a submit button with disabled={sending} that calls submit().
}
```

`createConfirmed` waits until the server has stored the record and rejects when permissions or validation refuse it ([data storage](https://docs.deep.space/guides/data-storage)). The visitor sees the thank-you message just for a request that was actually saved.

Add the page to `src/nav.ts` so it shows in the top navigation ([authentication](https://docs.deep.space/guides/authentication)):

```ts
export const nav: NavItem[] = [
  { path: "/quote", label: "Request a quote" },
  { path: "/quotes", label: "Quotes", roles: ["admin"] },
];
```

### 5. Build the owner's page

Put it at `src/pages/(app)/(protected)/quotes.tsx` so it requires sign-in. The app owner is pinned to `admin` ([permissions](https://docs.deep.space/concepts/permissions)), so the owner reads every request; anyone else gets an empty list.

```tsx
import { useQuery, useMutations } from "deepspace";

export default function QuotesPage() {
  const { records, status } = useQuery("quotes", {
    orderBy: "createdAt",
    orderDir: "desc",
  });
  const { put } = useMutations("quotes");

  const setStatus = (r, next) => put(r.recordId, { status: next });

  if (status === "loading") return <p>Loading requests…</p>;
  // List each request: date, name, email, phone, service, details,
  // and buttons for Quoted, Won and Lost that call setStatus().
}
```

The list updates live when a new request arrives ([real-time sync](https://docs.deep.space/concepts/realtime-sync)). A filter such as `where: { status: 'new' }` shows just the untouched requests.

### 6. Optional: email the owner about new requests

Scheduled jobs run as the app owner, so they can read private records and call the built-in `email/send` integration, billed to the owner ([scheduled jobs](https://docs.deep.space/guides/scheduled-jobs)). The sender must be `<app-name>@app.space` ([external APIs](https://docs.deep.space/guides/external-apis)). Skip this step if the person is happy checking `/quotes`.

```ts
// src/cron.ts
import type { CronTask } from "deepspace/worker";
import { buildCronContext } from "deepspace/worker";

const FROM = "Harbor Painting <harbor-painting@app.space>";
const OWNER_INBOX = "owner@example.com"; // the address from the questions above

export const tasks: CronTask[] = [
  { name: "quote-alerts", intervalMinutes: 10 },
];

export async function runTask(name: string, env: Env): Promise<void> {
  if (name !== "quote-alerts") return;
  const ctx = buildCronContext(
    env,
    env.OWNER_USER_ID,
    `app:${env.DEEPSPACE_APP_ID}`,
  );

  for (const q of await ctx.records.query("quotes", {
    where: { ownerNotified: false },
  })) {
    await ctx.integrations.call("email/send", {
      from: FROM,
      to: OWNER_INBOX,
      reply_to: q.data.email,
      subject: `New quote request: ${q.data.service} from ${q.data.name}`,
      text: `${q.data.name} (${q.data.email}, ${q.data.phone ?? "no phone"})\n\n${q.data.details}\n\nAll requests: /quotes`,
    });
    await ctx.records.update("quotes", q.recordId, { ownerNotified: true });
  }
}
```

`reply_to` is the visitor's address, so replying from the inbox goes to the customer.

### 7. Deploy and verify

```bash
git add -A && git commit -m "Business site with quote form"
npx deepspace deploy
npx deepspace logs --search cron
```

The site is live at `https://<app-name>.app.space`. Before handing it over: open the home page signed out, follow the link, submit a request, and check that it appears on `/quotes` for the owner. Sign in as a different account and confirm `/quotes` is empty. If step 6 is in, `npx deepspace logs --search cron` should show `[cron] quote-alerts ok` within ten minutes ([scheduled jobs](https://docs.deep.space/guides/scheduled-jobs)), and the owner inbox should have the email.

Later edits deploy the same way. Every deploy is recorded, and `npx deepspace releases` and `npx deepspace rollback` restore an earlier version ([releases and rollback](https://docs.deep.space/guides/releases-and-rollback)). A domain the person already owns can be attached with `npx deepspace app domain attach` ([custom domains](https://docs.deep.space/guides/custom-domains)); confirm with your user before changing their DNS records.

## Common failures and fixes

| Symptom                                     | Cause                                                                              | Fix                                                                                                                           |
| ------------------------------------------- | ---------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| Home page crashes or shows an error         | A data or auth hook in `src/pages/index.tsx`                                       | Keep `/` static; put anything that reads data under `src/pages/(app)/`                                                        |
| Quote form is blank for signed-out visitors | `RecordProvider` without `allowAnonymous`, or the page is outside `(app)/`         | Keep the scaffold's `allowAnonymous` and the page at `src/pages/(app)/quote.tsx`                                              |
| Submit refused as a permission error        | No `create: true` for `viewer`, or the form sends a field outside `writableFields` | Grant `create` to `viewer` and `'*'`; send just the form fields                                                               |
| Owner sees no requests                      | Signed in with an account that is not the owner or an admin                        | Sign in with the account that deployed the app, or have the owner promote the user with `useUsers().setRole(userId, 'admin')` |
| Same request saved twice                    | `submissionId` regenerated on each click, or no `uniqueOn`                         | Create the id once per form load and keep `uniqueOn: ['submissionId']`                                                        |
| No alert emails                             | Sender is not `<app-name>@app.space`, or the job has not run                       | Use the exact sender; check `npx deepspace logs --search cron` for `ok` or `failed` lines                                     |
| Deploy refused with `dirty_worktree`        | Uncommitted changes                                                                | Commit, then deploy again                                                                                                     |
| `The name <host> is taken by another app.`  | App names are global                                                               | Change `name` in `wrangler.toml` and deploy again                                                                             |

## What to tell the person when it is live

- The link to share: `https://<app-name>.app.space`. The quote form is at `https://<app-name>.app.space/quote`.
- Where requests land: `https://<app-name>.app.space/quotes`, signed in with the account that owns the site. Each request can be marked Quoted, Won or Lost.
- Requests are saved even if no email arrives; the `/quotes` page is the record.
- If alerts are on, a new request reaches their inbox within about ten minutes, and replying goes to the customer.
- Visitors cannot see other people's requests.
- Anyone with the link can submit the form. There is no spam filter or CAPTCHA in this build.
- A custom web address, online payments and automatic replies to customers are separate changes.

## Available today and planned

Available today, in the published SDK: a static home page, public pages for signed-out visitors, server-enforced permissions with `writableFields` and `uniqueOn`, an owner-only page behind sign-in, scheduled jobs, `email/send` from `<app-name>@app.space`, attaching a custom domain, release history with rollback, and deploys to `<app-name>.app.space` under a DeepSpace account that signs in with GitHub or Google.

Planned: agents creating their own DeepSpace account without a human sign-in. It is in testing on staging and is not enabled in production; see [Full-stack apps without a human in the loop](/agents/full-stack-apps-without-a-human-in-the-loop). Payments and other legal actions will still require a person. For a registration-style form with capacity limits instead of open-ended quotes, see [Build an event signup site for your user](/agents/build-an-event-signup-site-for-your-user).

Building this for a business? See [deep.space/enterprise](https://deep.space/enterprise).
