Arxec Systems
Back to Archive
Case Study · 2024FeaturedLIVE

Celebricks

Celebricks

Event booking platform, e-commerce shop, and custom CMS for a LEGO-themed party and workshop business.

Celebricks

Full-stack web platform for Celebricks built with Next.js, Supabase, PostgreSQL, and AWS S3. Includes package booking flows for birthday parties and workshops, a brick merchandise shop, customer accounts, and a JWT-protected admin dashboard for managing bookings, products, and blog content.

Problem Visual
The Problem

Manual party bookings & scattered inventory

Party package inquiries, workshop schedules, and merchandise orders were being coordinated manually over phone calls and DMs without centralized calendar availability or inventory tracking.

Solution Visual
The Solution

Online booking flow + Supabase & S3 admin CMS

Developed a Next.js + Supabase platform with online package booking, a product catalog backed by AWS S3 media storage, Zod-validated API routes, and a role-based admin suite for managing schedules, orders, and site content.

Feature Visual
Implementation

Package Booking Engine & Admin CMS

Auth
API Routes
Supabase
CMS

System Core · Role-Based Admin API Authorization Middleware

import { NextResponse } from 'next/server';
import supabaseAdmin from '@/lib/supabase-admin';
// Assumes resolveUserFromRequest handles JWT verification and user fetching.

export async function resolveAdminFromRequest(request) {
  const { user, error: authError } = await resolveUserFromRequest(request);
  if (authError) return { error: authError }; // Authentication failure

  const { data: profile, error: profileError } = await supabaseAdmin
    .from('profiles')
    .select('id, role') // Only fetch necessary role info
    .eq('id', user.id)
    .maybeSingle();

  if (profileError) throw profileError;

  if (!profile || !['admin', 'super_admin'].includes(profile.role)) {
    // User authenticated but not authorized as admin
    return { error: NextResponse.json({ error: 'Forbidden' }, { status: 403 }) };
  }

  return { user, profile }; // Authorized admin user and profile
}
javascript
Next Project

Next Case Study

GRID