Back to selected work

02 / TECHNICAL CASE STUDY

A case study by Charbel Jreij

Technical Lead · Web Platform · 2026

Fifth Form

One system, from first impression to publish.

A production-oriented CMS backend for client websites, designed around secure content editing, explicit publishing boundaries, and efficient public delivery without exposing the private administration surface.

  • Backend architecture
  • Security + access control
  • Content delivery
Fifth Form Studio website homepage featuring the launch moment concept
FifthForm CMS editor with structured page content fields and publishing controls
FifthForm CMS list editor for website packages
DESIGN OUT FRONT.
STRUCTURE UNDERNEATH.

TECHNICAL DEEP DIVE

A CMS backend built around explicit trust boundaries.

I developed Fifth Form as a multi-site content platform rather than a collection of editable pages. The architecture separates authenticated editing, database writes, publishing, and anonymous website delivery so each path can be secured, validated, cached, and scaled independently.

Personally ownedPostgreSQL schema design, content contracts, RLS and role-based access control, RPC write workflows, middleware and server actions, public API hardening, publishing state, caching, client adapters, and production deployment.

Stack

Next.js · PostgreSQL · SupabaseTyped App Router server actions over Auth, Postgres, Storage, and contract-aware database functions.

Security model

RLS · RBAC · guarded RPCsSite-scoped roles, middleware checks, validated inputs, and auditable writes instead of direct table mutation.

Delivery model

Layered cache · deduped fetchesCDN stale-while-revalidate, framework revalidation, client TTL caching, and in-flight request reuse.
System mapHow the pieces become one product
  1. 01Auth + middleware guard
  2. 02Contract-validated action
  3. 03RLS + RPC write boundary
  4. 04Draft · preview · publish
  5. 05Sanitized public DTO
  6. 06CDN + deduped adapter
01

Database + access control

The schema encodes ownership, roles, and publishing state.

PostgreSQL models clients, sites, memberships, content blocks, collection items, media, versions, and audit events. Row Level Security scopes every authenticated read to an assigned active site, while role checks distinguish platform admins, owners, editors, and viewers. Content mutations go through guarded RPCs that re-check authorization and keep related writes atomic.

Proof in the build

27 migrations define the data model and policies; direct CMS mutations are locked down behind site-scoped database functions.

02

Validation + publishing

Draft, preview, and live content are separate system states.

A typed CMS contract defines the exact editable surface for each website. Server actions validate fields and media before they reach PostgreSQL; preview reads an authenticated draft payload; publish validates the whole site again, snapshots the current release, and atomically promotes draft data. Public traffic never reads from that private editor path.

Proof in the build

Contract validation runs in the application and database, with rollback-ready publish history and automated checks for write-path security.

03

Public delivery + cost control

The fastest backend request is the one the website never makes.

Anonymous websites use one narrow endpoint that returns sanitized published content only. Responses are CDN-cached with stale-while-revalidate; the Next.js adapter adds framework revalidation; the Vite client adds TTL caching and reuses in-flight promises. Typed normalization and checked-in fallback content keep sites available when the CMS is slow or unreachable.

Proof in the build

The public DTO is sanitized in SQL and application code, while caching and request deduplication reduce repeated Supabase reads.

ENGINEERING RANGE

What this build demonstrates.

01

PostgreSQL system design

Modelled multi-site content, membership, roles, media, version history, audit events, and publishing state as one coherent schema.

02

Secure API boundaries

Separated authenticated editor operations from anonymous delivery using middleware guards, server-side validation, RLS, RBAC, RPCs, and sanitized DTOs.

03

Transactional publishing

Built draft, preview, publish, discard, and rollback behavior with contract checks and atomic database transitions.

04

Scalable content delivery

Combined CDN caching, framework revalidation, TTL caches, request deduplication, normalized fetch layers, and resilient fallback content.

BUILT AND SHIPPED

See the product, not a repository.