How vedanshiprajapati/verbly works
Main System Components
a. Frontend (React + Vite):
• Single‑Page Application (SPA) in TypeScript
• UI layer (components/ui), rich‑text editor (components/plate‑ui)
• API client modules (src/api/blog.ts, user.ts)
• Routing (routes.tsx, ProtectedRoute wrappers)
• Context providers (AuthContext, ThemeProvider)
b. Backend (Node + Cloudflare Worker + Express‑style routes):
• Entry: src/index.ts, wrapped by Wrangler for CF Workers
• Authentication middleware (auth.ts)
• REST routes: /user, /post
• Business logic using Prisma client (schema.prisma, migrations)
• Utility: passwordEncryption
c. Database (PostgreSQL/MySQL or equivalent):
• Prisma ORM layer, migrations folder
d. Shared Library (“common” package):
• Type definitions (common/src/types.ts) used by both frontend and backend to share DTOs and interfaces
e. External Services (if any):
• Cloudflare Workers (deployed via wrangler.toml)
• Package registry (npm)
Relationships & Data Flows
• Browser → Frontend SPA: Served either locally (Vite dev) or statically (production build).
• Frontend → Backend API: HTTP(S) calls to Cloudflare Worker endpoints (e.g., GET /post, POST /post).
• Backend → Database: Prisma client issues SQL queries to the relational database.
• Shared common/types: Both frontend and backend import the common package to enforce consistent data contracts.
Architectural Patterns & Design Principles
• Layered Architecture: UI Layer → API Layer → Data Layer
• Shared Type Contracts: Ensures type safety across client and server
• Serverless Functions: Backend hosted as Cloudflare Workers for horizontal scaling
• RESTful Routing + Middleware for Auth & Validation
Relevant Technologies & Libraries
• Frontend: React, TypeScript, Vite, Tailwind CSS, @udecode/plate (rich‑text editor), React Context
• Backend: Node.js, TypeScript, Express‑style routing, Cloudflare Workers (Wrangler), Prisma ORM
• Common: npm package, TypeScript types