WhoBuilt

Code Walkthrough for Next.js 13 / Tailwind CSS / MySQL App!

Feb 6, 2023· 1 h 0 min· 36K views·Watch on YouTube

Speaker

Lee Robinson, a developer at Vercel, walks through his personal website’s Next.js 13 app and codebase on his leerob channel.

Site tour and content setup

Robinson introduces a minimal redesign with a static homepage, an About page, an MDX blog, and a server-rendered guestbook. He uses Contentlayer to generate typed content from Markdown files in the repository, with Remark and Rehype plugins for features such as heading links and highlighting.

App Router, rendering, and data

He explains that App Router files are React Server Components by default, with client components added for interactivity such as the animated sidebar. Async components fetch data directly, while the homepage uses incremental static regeneration to refresh its GitHub, Twitter, and blog view data at most every 60 seconds. Blog views and guestbook entries use PlanetScale MySQL with Kysely, and the guestbook checks the user session on the server.

Blog pages and metadata

The blog index imports typed posts from Contentlayer, sorts them by publication date, and links to dynamic post pages. Robinson describes generating static post routes with `generateStaticParams`, fetching tweet data for embedded posts, and building per-post metadata and Open Graph images. A client-side view counter calls an API route to read or increment counts stored in the database.

Interactive details and reusable setup

The guestbook form submits to an API route and refreshes the route so new entries appear without a full page reload. Robinson also shows MDX components for links, images, callouts, and tweets, plus a Framer Motion sidebar whose active indicator animates vertically on desktop and horizontally on mobile. A setup script replaces his personal content and images with placeholders so others can start from the repository.

Takeaways

  • Use server components for data fetching and client components where the UI needs interaction.
  • Keep blog content in version-controlled MDX and generate typed access to it with Contentlayer.
  • Use ISR when mostly static pages need periodic data updates, such as every 60 seconds.
  • Type database queries with a schema-aware query builder to catch invalid table and column references.
  • A setup script that replaces personal content with placeholders can make a starter repository easier to adopt.

Mentioned in this talk

Search inside this talk

What was claimed 15

Related talks