Skip to content

PocketBase Integration

Traliran edited this page Aug 12, 2026 · 1 revision

🗄️ PocketBase Integration Guide

While Traliran AI Hub works out-of-the-box using local browser storage (LocalStorage), you can connect a self-hosted PocketBase instance to sync your chat history, system prompts, and custom settings across all your devices securely.


🔍 Why PocketBase?

  • Single-file binary: Extremely lightweight, requires minimal RAM, and runs easily on cheap VPS instances, home servers, or single-board computers.
  • Privacy & Control: You own 100% of your data. No third-party tracking or cloud locking.
  • REST API out of the box: Perfect match for Traliran AI Hub's zero-build, serverless architecture.

🛠️ 1. Setting Up PocketBase

Step A: Install and Run PocketBase

  1. Download the executable binary for your OS from the Official PocketBase Releases (https://pocketbase.io/docs/).
  2. Extract the archive and run the executable:

./pocketbase serve --http="0.0.0.0:8090"

  1. Open your browser and navigate to http://your-server-ip:8090/_/ to create your initial Admin Account.

📋 2. Creating Collections & Schema

Traliran AI Hub requires specific collections to store your data. In your PocketBase Admin Dashboard (/_/), create the following collections:

Collection 1: chats

  • Type: Base collection
  • API Rules: Set list/view/create/update/delete rules according to your auth preference (e.g., restricted to authenticated users or open for personal/local setups).

Fields:

  • title (Plain Text, Required)
  • messages (JSON, Stores structured array of chat history)
  • provider (Plain Text, Active model provider for the session)
  • model (Plain Text, Model identifier string)

Collection 2: prompts

  • Type: Base collection

Fields:

  • title (Plain Text, Required)
  • content (Plain Text, System prompt body)
  • tags (Plain Text, Optional categorization tags)

Collection 3: settings

  • Type: Base collection

Fields:

  • key (Plain Text, Unique preference key)
  • value (JSON / Text, Serialized setting data)

🌐 3. Configuring CORS in PocketBase

If Traliran AI Hub is hosted on a different domain or port (e.g., GitHub Pages or local HTTP server), you must allow cross-origin requests in PocketBase:

  1. Open PocketBase Admin Dashboard.
  2. Go to Settings -> CORS settings.
  3. Add your hub’s origin URL to the allowed origins list:
    • For GitHub Pages: https://traliran.github.io
    • For local testing: http://localhost:8080 or http://127.0.0.1:8080
  4. Click Save changes.

⚙️ 4. Connecting Hub to PocketBase

  1. Open Traliran AI Hub.
  2. Go to Settings (Gear icon) -> Database / Storage.
  3. Toggle storage engine to PocketBase.
  4. Fill in your instance details:
    • PocketBase URL: http://your-server-ip:8090 (or your domain with HTTPS).
    • User Auth Credentials: (If authentication rules are enabled on your collections).
  5. Click Test Connection & Sync.

Once connected, your chats and prompts will automatically stream to and sync from your private PocketBase instance.

Clone this wiki locally