How codehagen/sitemint works
Project type and purpose
• Sitemint is a full-stack, server-rendered web management toolkit built on Next.js App Router.
• It provides a dashboard UI for site creation, workspace management, deployment, data scraping, and analytics, with a Prisma-backed database and integrations (OpenAI, external hosting).
High-level system components
a. Client (Browser)
• React components (app/page.tsx, components/**)
• Context providers (BreadcrumbContext)
• Tailwind CSS for styling, Framer Motion for animation
b. Next.js Server
• App Router (app/(…)/page.tsx, app/layout.tsx)
• Server Components vs. Client Components
• Server Actions (app/actions/**) for business logic
• API Routes (app/api/auth/[...all]/route.ts)
• Middleware (middleware.ts) for auth, routing
c. Business Logic / Services
• Database Actions (siteActions.ts, workspaceActions.ts)
• Deployment Actions (deploymentActions.ts)
• Scraper Actions (scraperActions.ts)
• Workspace Creation (createWorkspace.ts)
d. Database
• Prisma Client (lib/prisma.ts) connecting to PostgreSQL (connection string via .env)
• Prisma schema (prisma/schema.prisma)
e. External Services
• OpenAI API (AI-powered features)
• Hosting/deployment provider (e.g., Vercel)
• Potential third-party scraping targets
f. Dev/Build Tooling
• pnpm, bun (bun.lock), TypeScript, ESLint, PostCSS, Tailwind, config files
• Next.js build & dev server
Relationships and data flows
• The user’s browser renders React pages served by Next.js.
• Client components dispatch calls to Server Actions or fetch from API Routes.
• Server Actions handle business logic and talk to Prisma.
• API Routes manage authentication flows (NextAuth) and can also expose REST endpoints.
• Prisma Client executes SQL queries against the PostgreSQL database.
• Actions like deploymentActions invoke external deployment APIs or services.
• scraperActions may call external sites, parse data, and store results in the database.
• Real-time updates or toasts (Sonner) provide UX feedback.
Architectural patterns and principles
• Separation of concerns: UI (components/), business logic (app/actions/), API (app/api/), data layer (Prisma).
• Next.js App Router leverages React Server Components for fast page loads and streaming.
• File-system routing for dynamic subdomains (app/sites/[subdomain]).
• Contexts & hooks for shared client-side state.
• Type-safe schemas & validation (TypeScript + Zod).