Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/bicyblex/bicyblexStore/llms.txt

Use this file to discover all available pages before exploring further.

Bicyblex Store uses three PostgreSQL tables hosted on Supabase: products, categories, and news. This page documents every column, its type, constraints, and how the tables relate to each other — giving you everything you need to recreate the schema in a new Supabase project or understand the data model when extending the application.

categories table

Categories classify products and control which dynamic spec fields appear in the product form. Each category must have a unique slug value that matches a key in the CONFIG object inside src/components/dashboard/product/ProductForm.jsx.
ColumnTypeConstraintsDescription
idSERIALPrimary KeyAuto-incrementing integer ID
nameTEXTNOT NULLDisplay name shown in dropdowns and the storefront
slugTEXTNOT NULL, UNIQUEURL-safe identifier, auto-generated from name
CREATE TABLE categories (
  id   SERIAL PRIMARY KEY,
  name TEXT NOT NULL,
  slug TEXT NOT NULL UNIQUE
);

Default categories

The four built-in categories whose slugs map to spec field schemas:
INSERT INTO categories (name, slug) VALUES
  ('Bicicletas',           'bicicletas'),
  ('Bicimotos Eléctricas', 'bicimotos-electricas'),
  ('Kits Eléctricos',      'kits-electricos'),
  ('Accesorios',           'accesorios');
The slug value must exactly match a key in ProductForm.jsx’s CONFIG object for spec fields to appear in the product form. See Category Management for details on how slugs are generated and how to add new ones.

products table

The products table stores every item in the Bicyblex catalog. The specs column is a flexible JSONB field whose structure depends on the product’s category.
ColumnTypeConstraintsDescription
idSERIALPrimary KeyAuto-incrementing integer ID
nameTEXTNOT NULLProduct display name
priceNUMERICNOT NULL, DEFAULT 0Price in local currency
stockINTEGERNOT NULL, DEFAULT 0Number of units in inventory
category_idINTEGERFK → categories.idReferences the product’s category
specsJSONBDEFAULT '{}'Dynamic technical specs; structure varies by category
imageTEXTPublic URL of the product image in Supabase Storage
tagTEXTDEFAULT 'general'Optional display label for storefront filtering
CREATE TABLE products (
  id          SERIAL PRIMARY KEY,
  name        TEXT NOT NULL,
  price       NUMERIC NOT NULL DEFAULT 0,
  stock       INTEGER NOT NULL DEFAULT 0,
  category_id INTEGER REFERENCES categories(id),
  specs       JSONB DEFAULT '{}',
  image       TEXT,
  tag         TEXT DEFAULT 'general'
);

specs JSONB structure by category

The shape of the specs object depends on which category a product belongs to. The keys below match exactly the key values defined in ProductForm.jsx’s CONFIG object:
{
  "aro": "29",
  "material": "Aluminio",
  "freno": "Disco"
}

Product query used by the application

The dashboard and storefront fetch products with a join to get the category name:
const { data } = await supabase
  .from('products')
  .select('*, categories(name)');
This returns each product row with a nested categories object: { name: "Bicicletas" }.

news table

The news table stores articles published to the storefront’s newsletter section. Slugs and excerpts are auto-generated by the admin dashboard when an article is saved.
ColumnTypeConstraintsDescription
idSERIALPrimary KeyAuto-incrementing integer ID
titleTEXTNOT NULLArticle headline
contentTEXTNOT NULLFull article body text
imageTEXTPublic URL of the cover image in Supabase Storage
slugTEXTNOT NULL, UNIQUEAuto-generated from the title
excerptTEXTAuto-truncated to 150 characters from content
created_atTIMESTAMPTZDEFAULT NOW()Timestamp set automatically on insert
CREATE TABLE news (
  id         SERIAL PRIMARY KEY,
  title      TEXT NOT NULL,
  content    TEXT NOT NULL,
  image      TEXT,
  slug       TEXT NOT NULL UNIQUE,
  excerpt    TEXT,
  created_at TIMESTAMPTZ DEFAULT NOW()
);
The slug and excerpt columns are always populated by the dashboard’s save logic — never enter them manually. See News Management for the generation algorithm.

Entity relationships

The only explicit foreign key relationship is between products and categories:
categories
  id (PK)
  name
  slug

    │ FK (category_id)
products
  id (PK)
  name, price, stock, specs, image, tag
  category_id → categories.id
The news table is standalone — it has no foreign key relationships to the other tables.

Setting up the schema

To recreate the full schema in a new Supabase project, run the three CREATE TABLE statements above in order (categories first, then products, then news), seed the default categories, and configure the storage buckets. See Supabase Setup for the complete walkthrough.

Build docs developers (and LLMs) love