How debojyotimishra/atlas works
Project type and purpose
• This is a full-stack, real-time collaboration application (“Atlas”) built on Next.js App Router (v15).
• It provides authenticated document management, image uploads, and real-time editing, using Clerk for auth, Convex for database and real-time subscriptions, and EdgeStore for file storage.
File structure
• Top-level “app” directory: Next.js App Router—separate “(marketing)” (static, public-facing pages) and “(main)” (authenticated workspace) routes, plus an “app/api/edgestore” serverless route.
• “convex” directory: Convex backend functions (documents.ts), schema definitions, and generated API bindings.
• “components” and “hooks” directories: UI building blocks, modals, provider wrappers (Clerk, Convex, theme, modal), custom React hooks.
• “lib” directory: helper modules (EdgeStore client, utility functions).
• Config files: next.config.js, tailwind.config.ts, ESLint, TypeScript, PostCSS.
Key insights from README
• Features: real-time collaboration (Convex), document management, image uploads (EdgeStore), authentication (Clerk).
• Tech stack confirms frameworks and external services.
• Environment variables show runtime integrations with Clerk, Convex, and EdgeStore.
Main components
a. Client (Browser) – the React/Next.js front-end.
b. Next.js Server – SSR/SSG routes (app folder) and serverless API routes (app/api/edgestore).
c. Convex Backend – hosted functions and real-time data store.
d. EdgeStore Service – object/file storage.
e. Clerk Auth Service – user authentication and session management.
f. Internal Libraries – “lib/edgestore.ts” helper, “components/providers” wrappers.
Relationships and interactions
• Client ↔ Next.js Server: page requests, SSR, hydration.
• Client ↔ Convex Client SDK: real-time subscriptions, RPC calls to convex functions (documents.ts).
• Next.js Server → Convex Backend: secure server-side function calls (e.g., initial data fetching).
• Client → Next.js Serverless API (/api/edgestore): upload proxies to EdgeStore.
• API Route → EdgeStore Service: authenticated uploads/downloads.
• Client ↔ Clerk: UI login/signup, token exchange; Next.js middleware (implicit) protects “(main)” routes.
Architectural patterns and design principles
• Separation of concerns: marketing vs. main workspace in App Router.
• Provider pattern: React context for auth (Clerk), state (Zustand optional), modals, theme, Convex client.
• Serverless edge functions: both Convex and Next.js API routes scale on demand.
• Real-time collaboration via Pub/Sub model in Convex.
• Internal components (Next.js, React components)
• External services (Clerk, EdgeStore, Convex)
• Edges directionally: data flow, control flow, subscription channels.
Detailed component breakdown (suggested layers)
Layer 1: User Browser
• React UI under “app/(marketing)” and “app/(main)”
• Hooks and state providers
Layer 2: Next.js Server
• App Router (layout.tsx, page.tsx)
• Serverless API (app/api/edgestore/route.ts)
Layer 3: Convex Backend
• Schema (convex/schema.ts)
• Server functions (convex/documents.ts)
• Generated bindings
Layer 4: Third-Party Services
• Clerk (auth)
• EdgeStore (file store)
• Convex Data Storage