htmlhost.co
Back to Guides
Platform Features

How to Add a Database to Your Website

A waitlist, a guestbook, a product list, bookings: keep them with your site as collections. You choose who can read and add records, AI builds the pages, and there's no server or database to set up.

What a collection is

A collection is a list of records with the same fields, like a spreadsheet tab. A waitlist has email and name; a product list has title, price and image. Fields can be text, long text, number, yes / no, email, web address or date, each required or optional.

Free sites can try it with 1 collection of up to 100 records. Pro sites get up to 20 collections, with up to 10,000 records each.

Ask AI to create the collection and page

Start with what you want visitors to do. AI Edit and connected AI tools can create the collection and the page together; you don't need to design the fields first. Work as the site's owner or an Admin.

“Add a waitlist form to the hero with name and email. Reuse a suitable collection or create waitlist. Visitors can add their details, but only our team should read them in the dashboard. Show a thank-you message only after the record is saved.”

AI sees collection names, fields and rules, not the records. It asks before making personal details publicly readable. If your tool cannot create collections, ask it to list the fields and rules to enter in Data. Paste a definition is for secure calls in Keys; collection setup happens in Data.

  1. Ask AI for the feature and review any permission changes it proposes.
  2. Open your dashboard → open the site → Data. Select the collection to check its fields and rules.
  3. Publish when ready, submit a test entry on the live page, then return to Data to check the saved record. Collections do not run in the editor preview.

Choose who can read and add

  • Who can read records: anyone, so your pages can show them to every visitor, or only people on this site, so they're seen only in the dashboard.
  • Who can add records: anyone, from this site's pages, like a form, or only people on this site, in the dashboard.

Some common combinations:

  • Waitlist or bookings: visitors add, only you read. Their emails stay private.
  • Guestbook or reviews: visitors add, everyone reads.
  • Products, menu or events: only you add, everyone reads.

Keep emails, phone numbers and anything else personal in a collection authorized team members can read in the dashboard. htmlhost warns you if you make a collection with an email field readable by everyone.

Here, “only people on this site” means authorized team members in the htmlhost dashboard, not visitors who sign in to your website. Read access applies to the whole collection: every declared field in a publicly readable record can be retrieved, even if your page hides it. A collection with private reading and public additions accepts submissions without returning their contents to the visitor.

When your project needs more than Collections

Collections work well for shared content and visitor submissions. For the capabilities below, connect a service for that part of your project and keep your website hosted on htmlhost.

  • Individual accounts and private records per visitor. Collections do not identify visitors or enforce “only my records” permissions. A shared project password or an external login widget does not change that. For member profiles or private dashboards, use Supabase Auth with database access policies, or Firebase Auth with Firestore security rules, and store the private records there.
  • Visitors editing or deleting records. The collection page API supports reading and adding only; changes and deletions happen in the htmlhost dashboard. If people need to edit their own profile, comment or submission, use an authenticated database such as Supabase or Firestore with rules that allow each user to change only their own records.
  • File storage inside a collection. Collection fields store values, not uploaded files. Keep public images in your htmlhost Media library and save their URLs in a collection. For visitor uploads or private files, connect Supabase Storage or Firebase Storage with the appropriate access rules. Keep private file references in your protected backend too.
  • Custom database operations. Collections do not expose SQL, joins or multi-record transactions. If your application needs those operations, use a database such as Supabase for that data and query it from your htmlhost pages through its supported API and access policies.

For the distinction between shared project passwords and individual user sessions, see passwords and sign-in.

Build the pages with AI

AI Edit knows each collection's fields and rules by name (never its records), so describe what you want:

“Add a waitlist form to the hero that saves to the waitlist collection and says thanks.”
“Show the products collection as cards with the image, title and price, newest first.”
“Add a guestbook page: a form to leave a message, and the latest 20 messages under it.”

If a page needs something a collection's rules don't allow, AI tells you which rule to change instead of building something that won't work.

Set up a collection manually

You can also create the collection yourself, then ask AI to build a page that uses it:

  1. Open your dashboard → open the site → Data. The section is headed Collections.
  2. Start from Waitlist, Guestbook, Products or Bookings, or choose Your own and add your fields.
  3. Choose who can read and add records, then select Create collection.

Manage records

In the Data tab, select a collection to see its records, newest first. Add, edit or delete them, load more, and download them all as a CSV. Records visitors add from your published pages appear there as they arrive.

For developers

Your pages use a collection at an address on your own site. Reading returns up to 100 records at a time, with a cursor for more:

Read records
const res = await fetch("/__hh/data/guestbook?limit=20");
const { ok, records, next } = await res.json();
// records: [{ id, createdAt, updatedAt, name, message }, …]
// next: pass as ?cursor= for the following page, or null
Add a record
const res = await fetch("/__hh/data/guestbook", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ name, message }),
});
const { ok, record, error } = await res.json();

Check both the HTTP response and ok before showing success. When reading is private, a successful addition does not return the record. A private or missing collection returns 404 when read. Invalid data, full collections and rate limits can prevent a save. Test on the published site: editor previews and local copies do not supply these endpoints.

Add ?order=oldest to reverse the order, and ?field=value to match a field exactly. Only a collection's own fields are saved, each checked against its type; anything else is ignored. Each visitor can add 10 records a minute. The Data tab's Read code and Add code buttons copy these for a collection.

Coding tools see the same: htmlhost keys lists your collections, pull and clone write them into AGENTS.md, and the MCP server and Claude connector include them. See the agent guide.

Limits and data lifecycle

  • Up to 30 fields per collection; a record's values may occupy up to 16 KiB. Text fields allow 500 characters and long-text fields 10,000.
  • Reads return 50 records by default, up to 100, with cursor pagination. Filtering matches declared fields exactly; it is not full-text search.
  • Additions are limited to 10 per visitor connection and 120 per site per minute. Reads are limited to 120 per visitor connection and 3,000 per site per minute. These are in-memory abuse controls, not guaranteed transaction quotas.
  • The record limit is a plan allowance, not an inventory counter: simultaneous additions can exceed it slightly.
  • Changing a definition replaces its field list. Removing a field hides its stored values; adding that field back restores them. Delete records or the collection to remove the stored data.
  • Download records separately as CSV from the Data tab. The site's HTML files and agent metadata are not a backup of collection records, and hosting exported files elsewhere does not recreate the collection API.
  • If Pro ends, existing data stays readable under its rules. New additions follow the Free record limit, and new collections follow the Free collection limit.

The owner and Admins manage definitions and rules; Editors can manage records. AI tools receive collection structures, not record contents; set_collection also returns a record count. Public records can still be read through the published site's API. Storage, deletion and backup retention are described in the privacy policy.

Related

Frequently asked questions

Can AI create collections for me?

Yes. When a request needs one, AI Edit sets it up with the page that uses it, and tools you connect (Claude, Cursor and others) can do the same. It keeps personal details private to read unless you agree otherwise. The site's owner and Admins can do this; Editors' requests are passed to them.

Is this a real database?

It's a simple one built for websites: collections of records with typed fields, stored safely by htmlhost. There's no server for you to run, no SQL to write and nothing to connect.

Can visitors change or delete records?

No. Visitors can only read a collection you've made readable, and add to one you've opened for additions. Changing and deleting records is only for you and the people on your site, in the dashboard.

How is this different from a form?

A form sends you a message. A collection keeps records your pages can use: a guestbook can show its entries, a product list can fill a shop page, and you can edit records any time.

Can I export my data?

Yes. Download any collection as a spreadsheet (CSV) from the Data tab.

Does it work on my custom domain?

Yes, on your site's htmlhost.co address and every custom domain. A shared project password gates access to collections like pages; it does not identify individual visitors or give them private records.

Who can manage collections?

The owner and Admins choose each collection's fields and rules. Editors can see, add, change and delete records too.

What happens if my Pro plan ends?

Nothing is deleted and your pages keep reading their collections. New records follow the Free limit of 100 per collection, and you can't add collections beyond Free's 1.

Why don't records show in the editor preview?

Collections are read on your published site. Publish, then check the live page.

Create your first collection

Open your site in the dashboard, then Data.

Go to your sites