How marconlp/snapify works
Project type and purpose
• Snapify is a full-stack, self-hostable web application built with Next.js. It provides recording, storage, and sharing of video snippets as a Loom alternative. It features server-side rendering (SSR), client-side React components, serverless API routes, database persistence, file storage, authentication, payments, and analytics.
File structure
• Top-level:
• Dockerfile, CI/workflow configs, environment definitions (.env.example, next.config.mjs).
• prisma/ (schema + seed script) → data model for MySQL.
• public/ → static assets.
• src/
– assets/, atoms/ (state management), components/ (React UI), styles/.
– pages/ (Next.js SSR/CSR routes & API endpoints).
– server/ (internal API logic, db, auth, AWS S3, Stripe, PostHog, rate limiting).
– utils/ (shared helpers).
• Tests/ uses Playwright for end-to-end.
README for technical stack
• Next.js, React, TypeScript, Prisma (MySQL), AWS S3 (Backblaze B2), Stripe, GitHub OAuth (NextAuth), PostHog, TRPC (type-safe RPC), Tailwind CSS.
Main components and interactions
a. Frontend
• Browser client (Next.js pages & React components)
• Static assets served via CDN/public
• React state atoms (Recoil or Jotai) manage UI modals and paywall
b. Backend
• Next.js server (SSR, API routes)
• Auth layer (NextAuth with GitHub)
• API endpoints:
– REST (check-expired-videos, stripe webhooks)
– TRPC routers (video CRUD, Stripe integration)
• Business logic: video processing, thumbnail generation
c. Data stores & services
• MySQL (Prisma ORM) for metadata
• AWS S3 / Backblaze B2 for video blobs
• Stripe for billing & subscriptions
• PostHog for analytics
• External OAuth (GitHub)
d. CI/CD & Deployment
• Docker, GitHub Actions, Vercel (or custom Docker)
Architectural patterns & principles
• Monolith of serverless functions (Next.js API routes)
• Type-safe end-to-end (TypeScript + TRPC)
• Layered separation: UI → API layer → service layer → persistence layer
• Event-driven (webhooks for Stripe)
• Scheduled/background tasks (expired-videos cleanup)
Final advice
• Be as detailed as possible—separate each logical unit
• Call out state management (atoms) and E2E tests as peripheral but important
• CI/CD pipeline (GitHub Actions → Docker/Vercel)