How adityaphasu/notion-clone works
Project type and purpose
• Full‑stack web application: a Notion‑style note‑taking and organization tool.
• Frontend: Next.js 13 App Router, React, TypeScript, Tailwind, shadcn‑ui, Blocknote editor.
• Backend: Convex real‑time database, Edgestore distributed key–value store (for files/images), Clerk authentication.
File structure for architectural cues
• app/ – Next.js “app” directory with three primary route groups:
– (landing): public marketing pages
– (main): authenticated workspace pages (documents, sidebar, editor)
– (public): published note previews
• app/api/edgestore/route.ts – custom API route to proxy file uploads/downloads to Edgestore
• convex/ – Convex server functions, schema, generated clients for real‑time data ops
• components/ – shared UI and modal components used by pages
• lib/edgestore.ts – helper to communicate with Edgestore
• hooks/ – React hooks (e.g., useSearch, useSettings) for state & API logic
• next.config.mjs, tailwind.config.ts, tsconfig.json – framework & build configurations
Extract additional insights from the README
• Real‑time collaboration via Convex
• File storage with Edgestore (upload, delete, replace)
• Authentication via Clerk
• Publishing flow: private workspace → public preview pages
Main components
1. User’s Web Browser / Client
– Renders React pages, uses editor, triggers API calls
2. Next.js Frontend (Vercel / Node.js server)
– App Router routes: landing, main (authenticated), public (preview)
– UI: shadcn/ui components, Blocknote editor, modals, theme provider
– API layer:
a. Convex client (via convex/_generated) → real‑time database
b. /api/edgestore route → Edgestore
c. Clerk SDK → authentication flow
3. Convex Real‑Time Database
– Data model (convex/schema.ts), server functions (convex/documents.ts)
– WebSocket/long‑poll for instant updates
4. Edgestore Service
– External file store for images/files, accessed via API route
5. Clerk Authentication Service
– User identity, session tokens, secure API middleware
6. Vercel Hosting
– Deployment platform for Next.js and API routes
Relationships and interactions
• Browser → Next.js frontend (HTTP/HTTPS): page loads, form submissions, real‑time socket
• Frontend → Clerk: sign‑in, token validation
• Frontend ↔ Convex: queries, real‑time subscriptions, mutations
• Frontend → /api/edgestore → Edgestore: file upload/download
• Next.js build/deploy → Vercel
Architectural patterns and design principles
• Monolithic full‑stack app with clear separation of concerns:
– Presentation (app/ & components/)
– Business logic (hooks/, convex/)
– Data layer (Convex schema + Edgestore)
• Next.js App Router for folder‑based routing and layouts
• Real‑time pub/sub pattern via Convex WS
• API façade for external service (Edgestore) to encapsulate credentials and logic