How yeolyi/blog works
Project type and purpose
• This is a full-stack, content-rich web portal built on Next.js (App Router + MDX support) that serves localized blog posts, computer-science tutorials, memes, and user-generated comments. It integrates Supabase for authentication, data storage (Postgres + Storage), and RLS policies, plus uses serverless functions (Vercel/Next.js API routes) for image proxying, crawling, and other background actions.
Key components from file structure
• Presentation layer:
• app/ – Next.js “app” routes (localized pages under [locale], dynamic MDX-based routes, API routes under app/api).
• public/ – static assets and service workers (pixelateWorker.js).
• components/ – React UI (layout, mdx renderers, CS‐flow visualizations, meme UI, auth providers).
• Data layer:
• db/ – Supabase client wrappers and CRUD methods for comments, memes, memeTag, storage.
• swr/ & store/ – client-side data fetching and state management hooks (SWR providers, React Context).
• types/ – TypeScript types for database schemas and helpers.
• Business logic / serverless functions:
• actions/ – Puppeteer‐based crawlers and image processors (crawl.ts, image.ts, resend.ts).
• app/api/ – Next.js API routes for image proxying and sitemap generation.
• Configuration & tooling:
• next.config.mjs, tsconfig.json, tailwind.config.js, biome.json – build, lint, and styling configurations.
• .husky, lint-staged – pre-commit hooks.
Architectural patterns and relationships
• JAMstack / Serverless: Next.js front end (SSR/SSG/ISR) fetches data either directly via Supabase JS client (with server components or client SWR hooks) or through internal API routes.
• Separation of concerns:
• Presentation (React components in app/ + components/)
• Application/Service layer (Supabase wrappers in db/, SWR/store, custom actions/)
• Data persistence (Supabase Postgres + Storage buckets)
• External integrations: Supabase Auth, Supabase Storage, third-party crawling via Puppeteer, Vercel edge network.
Elements
• Client → Next.js SSR/CSR
• Next.js → Supabase (read/write)
• Next.js → API Routes → Supabase Storage
• Background “actions/” → Supabase
• Blue for presentation layer
• Green for service/API layer
• Orange for data layer
• Gray for external/third-party
• Rounded rectangles for React components/modules
• Clouds for external services