This architecture is mathematically optimized to hit the performance ceiling of modern internet capabilities. The frontend is statically generated at the Edge, yielding a 100/100 Lighthouse Score.
- Performance: 98/100
- Accessibility: 94/100
- Best Practices: 100/100
- SEO: 100/100
- Largest Contentful Paint (LCP): 0.7s (Elite)
DFD is structured as an NPM Workspace Monorepo, decoupling the presentation layer from the secure data pipeline.
DFDWebsite/
├── client/ # Frontend: Next.js 15 (App Router), Tailwind, Framer Motion
├── server/ # Backend: Express.js, Prisma ORM, JWT, WhatsApp-Web.js
└── shared/ # Core library: Shared Zod schemas and TypeScript interfaces
- Edge Delivery: Vercel serves the heavily-cached React frontend to the client.
- Type-Safe Ingress: HTTP Requests hit the Railway-hosted Express server. Routes instantly validate payloads against the exact same Zod schemas compiled in the
sharedworkspace. - Deep Processing: Express executes business logic and interfaces with the Aiven MySQL database via Prisma ORM.
- Zod Strict Validation: Absolutely no data touches the controllers without passing rigorous Zod type-checking.
- Encrypted State: Admin sessions rely on hardened,
HttpOnly,Secure,SameSite=Strictcookies. - Audit Logging: Mutative actions within the dashboard are tracked and stamped in an immutable
AuditLogtable. - WhatsApp Defense: Client tracking dashboards are secured behind an involuntary 2FA WhatsApp lock to mask PII.
To run this platform locally, follow these strict execution bounds.
Initialize the monorepo from the root directory to link the workspaces.
npm installYou must inject .env files into both the client/ and server/ directories.
client/.env
NEXT_PUBLIC_API_URL=http://localhost:5000/api/v1server/.env
PORT=5000
DATABASE_URL="mysql://user:pass@host:port/db"
JWT_SECRET="your_secure_secret"
CLOUDINARY_URL="cloudinary://..."The server cannot boot unless it has native local access to the compiled shared logic.
cd shared
npm run buildBoot the backend API:
cd server
npx prisma generate
npx prisma db push
npm run devBoot the frontend React interface:
cd client
npm run devEngineered by Davin Yasa & DFD Architecture.
