How lucasadrianof/personal-blog-nextjs works
Project Type & Purpose
• The project is a personal website built with Next.js and Tailwind CSS.
• It serves static content (homepage, about me, contact) and dynamic blog pages. Blog content is sourced from Sanity CMS with caching (SSG/ISR) and revalidation via webhooks.
• It also includes integration with analytics (PostHog), commenting (Commento++), and performance/animation libraries (AOS).
File Structure to Identify Main Components
• Top-Level Configuration & Deployment:
• .env.sample, next.config.mjs, tailwind.config.ts, postcss.config.mjs: Configuration and build settings.
• .github/workflows: GitHub Actions workflows for CI/CD (linting and production deployment to Vercel).
• Application Layer (src/app):
• Route groups (i.e., (blog) route group) split into static pages and dynamic blog pages.
• Dynamic routes under /blog and API routes for cache revalidation and sitemap generation.
• The /studio folder under /app suggests an administrative or editing interface, likely for Sanity Studio.
• Components:
• Organized in “src/components” with sub-folders for UI elements like Blog components, Header, Footer, Hero, etc.
• There are specialized components for integrating third-party services (Commento, PostHog) and content rendering (PortableText).
• Libraries and Hooks:
• “src/lib/sanity” and “src/hooks” indicate custom libraries for interfacing with Sanity CMS and managing front-end behavior.
• Sanity Configuration:
Identifying Key Relationships & Interactions
• Frontend – Next.js App:
• Responsible for both static (SSG) and dynamic rendering.
• Implements routing via the Next.js app directory structure with dynamic blog pages integrated with Sanity.
• Backend / API Routes:
• API endpoints for cache revalidation (triggered by Sanity webhooks) and sitemap generation.
• External Services:
• Sanity CMS as the content backend.
• Vercel for hosting and deployment.
• GitHub Actions for CI/CD pipelines (build, lint, deploy).
• Third-party integrations such as Commento++ for comments and PostHog for analytics.
• UI Components:
• Modularized UI components across various aspects of the site (blog, header, footer, social, etc.) that render dynamic content and static sections.
Architectural Patterns & Design Principles
• Separation of Concerns:
• Clear division between static pages and dynamic blog routes.
• A modular component structure that keeps UI, hooks, libraries, and API routes separate.
• Dynamic Data Fetching & Caching:
• The use of Next.js SSG/ISR for serving content cached on the server, with revalidation triggered by CMS actions.
• CI/CD and Deployment Pipeline:
• GitHub Actions workflows ensure automated testing, linting, and production deployment on Vercel.