Dev Reference
Bloomify — Dev Reference
Architecture, DB schema, API routes, theme colours
Last updated: 2026-07-12

Architecture

Browser
  └── Cloudflare Pages (bloomify-portal)
        Static React SPA (React 18 + TypeScript + Vite)
        └── API calls → Cloudflare Worker (bloomify-api)
                         └── D1 Database (bloomify_db)

The frontend is a fully static SPA deployed to Cloudflare Pages. All data operations go through the Cloudflare Worker which owns the D1 database. CORS is locked to https://bloomifyofficial.sonandigital.com via the ALLOWED_ORIGIN env variable in wrangler.toml.

Theme Colours

TokenHexUse
Pale pink bg#FDF0F3Page background
Pink#E8A0B0Accents, borders
Pink dark#C4758BButtons, highlights
Pink darker#A05870Dark button states, headings
Hero gradientlinear-gradient(135deg, #A05870 0%, #C4758B 60%, #E8A0B0 100%)Hero section

Currency Pattern

All monetary values are stored as integer paisa (PKR × 100) in the database. Display format:

// Convert cents/paisa to display string
const display = `Rs. ${Math.round(value_cents / 100).toLocaleString()}`;
// Example: 150000 paisa → "Rs. 1,500"

DB Schema

TableKey Columns
admin_usersid, email, password_hash, full_name, created_at
clientsid, name, email, phone, instagram, address, notes, created_at
productsid, name, description, category, base_price_cents, base_cost_cents, is_active, sort_order, image_url, created_at
ordersid, client_id, product_id, occasion, custom_notes, colors, quantity, price_cents, cost_cents, status, order_date, delivery_date, shipping_address, shipping_cost_cents, shipping_provider, tracking_number, ship_date, expected_delivery, actual_delivery, created_at
notesid, order_id, content, created_at
invoicesid, order_id, client_id, amount_cents, status, issued_date, paid_date, notes, created_at
inquiriesid, name, email, phone, instagram, occasion, colors, message, status, created_at
settingskey (PK), value — stores all config including social links and hero copy

API Routes

MethodRouteAuthPurpose
POST/api/auth/loginPublicAdmin login — returns JWT
GET/api/configPublicBusiness config for public site
GET/POST/api/clientsAdminList / create clients
GET/PUT/DELETE/api/clients/:idAdminGet / update / delete client
GET/POST/api/productsAdminList / create products
GET/PUT/DELETE/api/products/:idAdminGet / update / delete product
PUT/api/products/bulkAdminReplace entire catalog — DELETE all + INSERT array of items
GET/api/products/publicPublicActive products for public site (includes image_url)
GET/POST/api/ordersAdminList / create orders (includes all shipping fields)
GET/PUT/DELETE/api/orders/:idAdminGet order (with notes) / update (incl. shipping) / delete
POST/api/notesAdminAdd note to an order
GET/POST/api/invoicesAdminList / create invoices
GET/PUT/DELETE/api/invoices/:idAdminGet / update / delete invoice
GET/POST/api/inquiriesMixedGET admin, POST public form submission
GET/PUT/DELETE/api/inquiries/:idAdminGet / update status / delete inquiry
GET/api/reports/summaryAdminRevenue/cost/profit summary; ?period=week|month|quarter|all
GET/PUT/api/settingsMixedGET public, PUT admin
POST/api/admin/passwordAdminChange admin password

Settings Keys (D1 settings table)

KeyDefaultUsed by
business_nameBloomify OfficialPublic site header, footer, invoices
business_taglineLuxury Handcrafted Forever FlowersPublic site sub-heading
business_emailhello@bloomifyofficial.comAdmin reference
business_phoneAdmin reference