How amitpallai/notion works
Project type and purpose
• This is a full-stack web application (“Notion Clone”) built with Next.js (App Router) for the frontend and routing, Convex as a real-time database/backend, and Edge Store for file uploads. Its purpose is collaborative, hierarchical document editing with real-time updates, search, file uploads, trash management, theming, and responsive UI.
File structure
• Top-level directories and files:
• app/ – Next.js App Router folders, subdivided into (marketing), (public), and (main) route groups.
• components/ – Shared React UI components (modals, toolbar, provider wrappers, UI primitives).
• convex/ – Convex backend functions, schema, auto-generated API types and server modules.
• app/api/edgestore – Next.js API route(s) for file storage interactions (Edge Store).
• hooks/, lib/ – Custom React hooks and utility modules.
• Configuration: next.config.js, tailwind.config.ts, tsconfig.json, .env.example.
• Architectural cues:
• app/(main) hosts the authenticated application routes and UI components.
• app/(marketing) and app/(public) host unauthenticated marketing pages and preview routes.
• API routes under app/api handle file storage.
• Convex folder contains database schema, queries, mutations, and generated types.
README for additional insights
• Tech stack highlights: Next.js App Router, Convex for real-time backend and database, Edge Store for file uploads, Tailwind CSS for styling.
• Features emphasize real-time collaboration, hierarchical docs, search, file uploads, authentication, theming, responsive design.
Main components and interactions
a. Components
• Client Browser (React UI)
• Next.js Server (App Router)
– Route Groups: marketing, public/preview, main (authenticated)
– API Routes: /api/edgestore (file upload/download)
• Convex Real-Time Backend (queries & mutations, auth)
• Edge Store Service (file storage)
• Database (managed by Convex)
• External Auth Provider (if any; e.g., OAuth via Convex)
b. Relationships & Data Flow
1. Browser ↔ Next.js Server for SSR/SSG and React hydration
2. Browser ↔ Convex Client Library → Convex Backend (real-time DB operations)
3. Browser → Next.js API Route (/api/edgestore) → Edge Store → Next.js API Route → Browser
4. Next.js Server may also read config/env and pass secrets to Convex & Edge Store clients
c. Architectural patterns & principles
• Separation of concerns via App Router route groups
• Real-time event propagation via Convex Pub/Sub
• Serverless, edge-deployed API for file storage
• Component-based UI with providers (theme, modal, Convex)
• API & database schema co-located in convex/ folder
d. Key technologies
• Next.js App Router (app/ directory)
• React & Tailwind CSS for UI
• Convex (convex/ folder, client/server libs)
• Edge Store (app/api/edgestore)
• TypeScript throughout