# Sprigbase

Sprigbase hosts HTML/CSS/client JavaScript apps with persistent, schema-validated collections.

This is an early-access release. It does not execute arbitrary server JavaScript or SQL. Company SSO and shared team authorization are not available yet.

## Agent quickstart

Use the same HTTPS origin as this document for all requests. Download /cli.mjs and run it with Node 24 or later. The CLI is Apache-2.0 licensed; inspect it before running.

1. Ask the user to choose a seven-day playground or account sign-in if they have not already expressed a preference.
2. Playground: node cli.mjs publish bundle.json --playground --server https://THIS-INSTANCE
3. Account: node cli.mjs login --server https://THIS-INSTANCE. Present its browser verification URL and wait for authorization. Then publish without --playground.
4. Report the returned URL and expiration. Keep credentials out of chat, generated HTML, URLs, and logs. The CLI stores them in a protected local file.

## Bundle format

JSON object with name, html, visibility (public or private), and collections. Private apps require account sign-in and are owner-only in this release.

A collection has name, read (public or owner), write (public-create or owner), and fields mapping names to string, number, or boolean. Collection names and fields use lowercase letters, digits and underscores, starting with a letter.

The runtime injects window.sprig. Client code can call await sprig.collection('signups').insert({name:'Ada'}) and await sprig.collection('items').list(). Public-create is insert-only; it does not grant reads. list() returns up to 100 recent records. Records contain fields at the top level plus id, created_at and updated_at. Never put credentials in an app.

For private submission forms use read=owner and write=public-create. Owners inspect submissions in Studio or through authenticated management endpoints.

## Resources

- /docs: API, onboarding, policies, limits and self-hosting
- /studio: browser publisher and management dashboard
- /api/health: supported capabilities and database readiness
- /source.tar.gz: Apache-2.0 platform, CLI, examples, tests and Docker setup

The CLI provides login, publish, apps, export and delete. Existing-app updates use PUT /api/apps/:id with the expected version from GET /api/apps/:id. Use an Idempotency-Key on retried creates. Exports can be imported by publishing the exported bundle; record IDs/timestamps are regenerated. Deleting an app deletes its data.

## Browser sign-in
Use /signin?return_to=<encoded same-origin relative path> for browser sign-in. Preserve the original /connect?code=... path when an agent connection needs approval. Provider choices are shown by the sign-in page; unavailable providers are disabled. Do not send people directly to a specific provider or claim an unavailable provider works. Users should return with the same sign-in option to access existing apps; accounts from different providers are kept separate.
