Home chevron_right Setup chevron_right Supabase Config
Configuration EST. 15 mins

Supabase Configuration:
The Iron Foundation

Establishing the immutable data layer for your legion's operations. This guide details the schema consecration required for the GhostCopy protocol.

To begin the initialization of the GhostCopy stack, we must first consecrate the database connection. The Supabase instance acts as the central vault for all operative intelligence. The following configuration establishes the primary link between the local client and the remote archives. Ensure your environment variables are set correctly in your .env.local file before proceeding.

warning
warning

Security Protocol Alpha

Do not commit your service keys to the public repository. Treat these credentials with the same secrecy as the Emperor's seal. Use environment variables exclusively.

I Initializing the Client

Before initializing the GhostCopy protocol, ensure your local environment meets the standard requirements. The core system runs on Flutter (Stable) and creates a secure uplink to Supabase.

Prerequisites
  • Flutter SDK: Version 3.x or higher (Stable Channel)
  • Supabase Account: Free tier is sufficient for personal archives
  • Git: For cloning the repository
typescript
import { createClient } from '@supabase/supabase-js'

// Retrieve environment variables
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL
const supabaseKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY

if (!supabaseUrl || !supabaseKey) {
  throw new Error('Missing Supabase environment variables.')
}

// Initialize the legion client
export const supabase = createClient(supabaseUrl, supabaseKey, {
  auth: {
    persistSession: true,
    autoRefreshToken: true,
  }
})

0 Architecture & Zero-CPU

GhostCopy runs on the "Invisible Window" architecture. Unlike traditional applications, the main interface is a borderless, transparent window that exists in a suspended state until summoned.

The "Zero-CPU" Sleep Protocol

To ensure zero impact on gaming performance (specifically targeting 1% lows in FPS), we implement aggressive resource throttling:

  • Hibernation: When the window is hidden (blur event), the flutter engine pauses all TickerProvider animations.
  • Wake Lock: The app releases all GPU handles, dropping VRAM usage to near-zero.
  • Instant Wake: Upon Ctrl+Shift+S, the hotkey_manager sends a wake signal that restores the UI in <50ms.

II Schema Consecration

The data structure must be rigid yet flexible. Execute the following SQL query in your Supabase SQL Editor to construct the ghost_agents table. This table tracks all active operatives.

SQL Query
create table public.clipboard (
  id bigint generated by default as identity primary key,
  user_id uuid references auth.users not null,
  content text not null,
  device_name text,
  device_type text not null,
  is_public boolean default false,
  created_at timestamptz default timezone('utc'::text, now())
);

-- Enable Row Level Security (RLS)
alter table public.clipboard enable row level security;

-- Policies
create policy "Users can view own items" on clipboard
  for select using (auth.uid() = user_id);

create policy "Users can insert own items" on clipboard
  for insert with check (auth.uid() = user_id);

III Client Consecration

With the schema established, you must now bind the Flutter client to the Supabase instance. Configure your local environment variables in .env (do not commit this file).

.env
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Smart Transformers

The client is equipped with intelligent detection algorithms. Data copied to the clipboard is analyzed for specific structures:

code JSON Prettifier

Detects valid JSON strings and offers immediate formatting/indentation.

token JWT Decoder

Identifies JWT tokens (Header.Payload.Signature) and decodes the payload for inspection.

Mobile Protocol

The GhostCopy mobile interface creates an encrypted tunnel to your desktop legion. To initiate the link, ensure both devices are on the same secure network or authenticated via the Supabase cloud relay.

sync_lock End-to-End Encryption

All clipboard data traversing the void between devices is encrypted using AES-256 before transmission. Your secrets remain yours.

Advanced Configuration

For the artificers who demand granular control, the .env.local file offers additional tuning parameters.

GC_POLL_INTERVAL=500 // Ms between clipboard checks
GC_MAX_HISTORY=100 // Items to keep in local cache
GC_AUTO_SYNC=true // Automatically push to cloud
Previous arrow_back Legion Setup