A comprehensive map of Docdril's technical layers. Explore database relationship structures, API routing designs, serverless rendering pipelines, and the styling theme rules that power the multi-brand client portal.
Every client workspace operates on strict constraints. Define clients, project slots, and billing items relationally.
CREATE TABLE clients (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name VARCHAR(255) NOT NULL,
email VARCHAR(255) UNIQUE NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
CREATE TABLE projects (
id UUID PRIMARY KEY,
client_id UUID REFERENCES clients(id) ON DELETE CASCADE,
title VARCHAR(255) NOT NULL,
status VARCHAR(50) DEFAULT 'active'
);Protect client-sensitive deliverables by validating session cookies at the Cloudflare or Next.js edge level.
import { NextResponse } from 'next/server';
import type { NextRequest } from 'next/server';
export function middleware(request: NextRequest) {
const token = request.cookies.get('session-token');
if (!token) {
return NextResponse.redirect(new URL('/login', request.url));
}
return NextResponse.next();
}Deploying the complete CRM code inside a self-hosted Docker node connected to a private local PostgreSQL instance for absolute data ownership.