# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: Counter HQ
spec:
    description: |
        Self-hosted front-desk system for small physical stores — transactions, daily cash close, checklists, SOPs, message templates and reports. Your data lives in your own database.
    icon: https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/nextjs.svg
    variables:
        - key: PUBLIC_DOMAIN
          type: DOMAIN
          name: Domain
          description: Domain for your Counter HQ site
    tags:
        - Business
        - Tool
        - CRM
    readme: |
        # Counter HQ

        A self-hosted front-desk operations system for small physical stores
        (gyms, salons, studios, pet grooming, and more).

        ## What you get

        - Transactions & daily cash close
        - Checklists (open / routine / close / weekly / monthly)
        - SOP knowledge base & message templates
        - Reports with CSV export
        - Staff, product and multi-store management with role-based permissions

        ## Deploy

        1. Click **Deploy**, pick a region and a domain.
        2. Wait ~3–5 minutes. The database is provisioned and seeded automatically.
        3. Open your domain and log in with the demo account:
           - **admin@demo.com** / **demo2026**
        4. Change the password, rename your store under Settings, and you're live.

        Your data lives in your own PostgreSQL with a persistent volume — it
        survives restarts and redeploys.
    services:
        - name: postgresql
          icon: https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/postgresql.svg
          template: PREBUILT_V2
          spec:
            id: postgresql
            source:
                image: postgres:16-alpine
            ports:
                - id: database
                  port: 5432
                  type: TCP
            volumes:
                - id: data
                  dir: /var/lib/postgresql/data
            env:
                POSTGRES_CONNECTION_STRING:
                    default: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}
                    expose: true
                POSTGRES_DB:
                    default: counterhq
                    expose: true
                POSTGRES_HOST:
                    default: ${CONTAINER_HOSTNAME}
                    expose: true
                POSTGRES_PASSWORD:
                    default: ${PASSWORD}
                    expose: true
                POSTGRES_PORT:
                    default: ${DATABASE_PORT}
                    expose: true
                POSTGRES_USER:
                    default: counterhq
                    expose: true
            healthCheck:
                type: TCP
                port: database
        - name: counter-hq
          icon: https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/nextjs.svg
          template: PREBUILT_V2
          spec:
            id: counter-hq
            source:
                image: ghcr.io/catherine-chou/fps-counter:latest
            ports:
                - id: web
                  port: 3000
                  type: HTTP
            volumes:
                - id: uploads
                  dir: /data
            env:
                DATABASE_URL:
                    default: ${POSTGRES_CONNECTION_STRING}
                LEMON_SQUEEZY_STORE_ID:
                    default: "397052"
                LICENSE_ENFORCEMENT:
                    default: "on"
                NODE_ENV:
                    default: production
                SESSION_PASSWORD:
                    default: ${PASSWORD}
                UPLOAD_ROOT:
                    default: /data/uploads
            healthCheck:
                type: TCP
                port: web
          domainKey: PUBLIC_DOMAIN
localization:
    zh-TW:
        description: |
            實體店家專用的自架櫃檯系統 — 交易、打烊對帳、Checklist、SOP、訊息範本與報表。適合健身房、美甲、工作室、寵物美容等。
        variables:
            - key: PUBLIC_DOMAIN
              type: STRING
              name: 網域
              description: 你的 Counter HQ 網址
        readme: |
            # Counter HQ

            實體店家專用的自架櫃檯系統（健身房、美甲、工作室、寵物美容皆適用）。

            ## 內含模組

            - 交易記錄 + 打烊對帳
            - Checklist（開店／例行巡查／打烊／每週／每月）
            - SOP 知識庫 + 訊息範本
            - 報表（含 CSV 匯出）
            - 員工、商品、分店管理 + 角色權限

            ## 部署步驟

            1. 點 **Deploy**，選區域與網域。
            2. 等 3–5 分鐘，資料庫會自動建好並灌入示範資料。
            3. 打開你的網域，用示範帳號登入：
               - **admin@demo.com** / **demo2026**
            4. 改掉密碼、到「系統設定」改店名，就上線了。

            你的資料存在自己的 PostgreSQL（含持久化 Volume），重啟與重新部署都不會掉。
