Skip to main content

intent_styles

Overview

The intent_styles table stores per-user visual customizations for each of the 6 intent types. Users can personalize how their posts look when tagged with a specific intent, including colors, fonts, borders, and background styles.

Relevant Invariants

  • Invariant #10: "Expressive Freedom Is Spatially Contained" -- Style customization is per-user, applied to their own content

Schema

-- Pre-existing table (inferred from frontend code)
CREATE TABLE intent_styles (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
user_id UUID REFERENCES auth.users(id) NOT NULL,
intent TEXT NOT NULL,
bg_color TEXT,
text_color TEXT,
border_color TEXT,
font_family TEXT,
font_size TEXT,
border_style TEXT,
border_width TEXT,
border_radius TEXT,
bg_gradient TEXT,
bg_pattern TEXT,
shadow TEXT,
created_at TIMESTAMPTZ DEFAULT NOW(),
updated_at TIMESTAMPTZ DEFAULT NOW(),
UNIQUE(user_id, intent)
);

Columns

ColumnTypeNullableDefaultDescription
iduuidNouuid_generate_v4()Primary key
user_iduuidNo--Style owner
intenttextNo--Intent key (e.g., thinking_out_loud)
bg_colortextYes--Background color CSS value
text_colortextYes--Text color CSS value
border_colortextYes--Border color CSS value
font_familytextYes--Font family CSS value
font_sizetextYes--Font size CSS value
border_styletextYes--Border style (solid, dashed, etc.)
border_widthtextYes--Border width CSS value
border_radiustextYes--Border radius CSS value
bg_gradienttextYes--CSS gradient for background
bg_patterntextYes--Background pattern identifier
shadowtextYes--Box shadow CSS value
created_attimestamptzNoNOW()Creation timestamp
updated_attimestamptzNoNOW()Last update timestamp

RLS Policies

-- SELECT: Anyone can read intent styles (needed to render other users' posts)
CREATE POLICY "Intent styles are publicly readable"
ON intent_styles FOR SELECT
USING (true);

-- INSERT/UPDATE: Users can only manage their own styles
CREATE POLICY "Users can upsert own intent styles"
ON intent_styles FOR ALL
USING (auth.uid() = user_id);
  • profiles -- Style owner
  • posts -- Posts rendered with these styles based on intent

Last updated: 2026-02-07