# Quickstart

> Run OvertCMS locally in under 5 minutes, create your owner account, build your first content model, and fetch published content.

Get OvertCMS running locally in minutes—either with the **single Go binary (SQLite, zero setup)** or **Docker Compose (PostgreSQL + Valkey)**.

## Prerequisites

- **Go 1.23+** (to run from source) or **Docker** with Compose v2.
- **Node.js 20+** (optional, to run the visual **OvertCMS Admin** dashboard locally).

---

## 1. Start OvertCMS Core

<Tabs>
  <Tab title="Single Binary (SQLite — Fastest)">
    Build and start Core with a 32+ byte `OVERTCMS_SECRET_KEY`. Set `OVERTCMS_COOKIE_SECURE=false` for local plain-HTTP development:

    ```bash
    git clone https://github.com/Weelkit/overt-cms-core.git
    cd overt-cms-core

    go build -o overtcms ./cmd/overtcms

    export OVERTCMS_SECRET_KEY="$(openssl rand -hex 32)"
    export OVERTCMS_COOKIE_SECURE=false

    ./overtcms serve
    ```

    Out of the box, `overtcms serve`:
    - Creates SQLite at `./.data/overtcms.db` and runs all database migrations automatically.
    - Bootstraps the default organization and site (`default`, locale `en`, timezone `UTC`).
    - Starts all four planes (`delivery,agent,admin,worker`) on `http://localhost:8080`.
    - Stores uploaded media in `./.data/media`.
  </Tab>
  <Tab title="Docker Compose (PostgreSQL + Valkey)">
    Start the production-like stack (**OvertCMS Core** + **PostgreSQL 16** + **Valkey 8**):

    ```bash
    git clone https://github.com/Weelkit/overt-cms-core.git
    cd overt-cms-core

    docker compose up --build
    ```

    <Tip>
      In production, always set a persistent `OVERTCMS_SECRET_KEY` (32+ bytes) so sessions, API keys, and encrypted secrets survive restarts.
    </Tip>
  </Tab>
</Tabs>

Confirm Core is ready:

```bash
curl -s http://localhost:8080/readyz
```

---

## 2. Create Your Account & First Post

You can use either the **Admin UI** (recommended for day-to-day work) or pure **HTTP / `curl`**.

<Tabs>
  <Tab title="Using the Admin UI (Recommended)">
    <Steps>
      <Step title="Start OvertCMS Admin">
        ```bash
        git clone https://github.com/Weelkit/overt-cms-admin.git
        cd overt-cms-admin
        npm install
        OVERTCMS_API_URL=http://127.0.0.1:8080 npm run dev
        ```
        Open **`http://localhost:5173`** in your browser.
      </Step>
      <Step title="Complete First-Time Setup">
        Create your initial **Owner** account (email, display name, password). Once created, first-time setup automatically locks permanently.
      </Step>
      <Step title="Create a Content Model">
        Open **Models** in the sidebar and either click **Starter Templates** (e.g., Blog Posts + Authors) or click **New Model** to build a custom Collection or Singleton.
      </Step>
      <Step title="Write & Publish Your First Entry">
        Open **Content → Posts → New Post**, write your article in the visual editor, and click **Publish**.
      </Step>
      <Step title="Inspect Live Public API Output">
        Open **Webhooks & Logs → API Explorer**, pick **List Collection Entries → Posts**, and click **Run Request** to see the exact JSON and cache headers your client will receive!
      </Step>
    </Steps>
  </Tab>

  <Tab title="Using curl / HTTP Directly">
    <Steps>
      <Step title="Bootstrap the Initial Owner Account">
        ```bash
        ADMIN_TOKEN=$(curl -s -X POST http://localhost:8080/admin-api/v1/auth/setup \
          -H "Content-Type: application/json" \
          -d '{
            "email": "owner@example.com",
            "password": "correct-horse-battery-staple",
            "displayName": "Site Owner"
          }' | jq -r '.accessToken')
        ```
      </Step>

      <Step title="Create a Posts Content Model">
        ```bash
        curl -s -X POST http://localhost:8080/admin-api/v1/sites/default/post-types \
          -H "Authorization: Bearer $ADMIN_TOKEN" \
          -H "Content-Type: application/json" \
          -d '{
            "slug": "posts",
            "singularName": "Post",
            "pluralName": "Posts",
            "kind": "collection",
            "instruction": "Write clear technical blog articles in active voice.",
            "urlTemplate": "/blog/{slug}",
            "displayField": "title",
            "slugSourceField": "title",
            "fields": [
              { "key": "title", "label": "Title", "type": "string", "required": true, "requiredOn": "draft", "filterable": true, "sortable": true },
              { "key": "slug", "label": "Slug", "type": "slug", "required": true, "requiredOn": "publish", "unique": true },
              { "key": "body", "label": "Body", "type": "rich_html", "required": true, "requiredOn": "publish", "constraints": { "disallowH1": true } }
            ]
          }' | jq '{slug: .postType.slug, schemaVersion: .postType.schemaVersion}'
        ```
      </Step>

      <Step title="Mint an Agent API Key & Publish an Entry">
        ```bash
        AGENT_KEY=$(curl -s -X POST http://localhost:8080/admin-api/v1/sites/default/api-keys \
          -H "Authorization: Bearer $ADMIN_TOKEN" \
          -H "Content-Type: application/json" \
          -d '{
            "name": "Blog Automation Agent",
            "preset": "agent_publisher",
            "allowedPostTypes": { "posts": "write" }
          }' | jq -r '.plaintextKey')

        curl -s -X POST http://localhost:8080/agent/v1/collections/posts/entries \
          -H "Authorization: Bearer $AGENT_KEY" \
          -H "Content-Type: application/json" \
          -H "Idempotency-Key: create-hello-overtcms-001" \
          -d '{
            "status": "published",
            "slug": "hello-overtcms",
            "data": {
              "title": "Hello OvertCMS",
              "slug": "hello-overtcms",
              "body": "<h2>Welcome</h2><p>Published cleanly through the Agent Plane.</p>"
            }
          }' | jq '{id: .entry.id, status: .entry.status, publicUrl: .entry.publicUrl}'
        ```
      </Step>

      <Step title="Fetch the Published Entry on the Delivery API">
        ```bash
        curl -i -s "http://localhost:8080/delivery/v1/posts/hello-overtcms?include=wordCount,readingTime,headings"
        ```
      </Step>
    </Steps>
  </Tab>
</Tabs>

---

## Where to Go Next

<CardGroup cols={2}>
  <Card title="Fetching Published Content" icon="globe" href="/delivery/fetching-content">
    Learn how to query collections, expand references, and preview drafts from your client.
  </Card>
  <Card title="How AI Agents Work" icon="bot" href="/agents/overview">
    Connect Claude Desktop, Cursor, or your own AI workflow via `/mcp` or REST.
  </Card>
  <Card title="Cloudflare R2 & S3 Storage" icon="cloud" href="/self-hosting/storage-r2-s3">
    Switch media uploads from local disk to Cloudflare R2 or Amazon S3.
  </Card>
  <Card title="Email & SMTP Notifications" icon="mail" href="/self-hosting/email-and-smtp">
    Enable optional outbound email for team invites and security alerts.
  </Card>
</CardGroup>
