← Back to Blog

realworld.io with Next.js (no htmx)

July 15, 2024
Next.jsReactRealWorldServer ComponentsServer Actions

Another RealWorld project. Previously I have built a Laravel + HTMX and Go Fiber + HTMX. This time I'm doing it without HTMX, purely with Next.js 14 React Server Components and Server Actions.

The project: Next.js 14 + React Server Components and realworld.io

This was created to demonstrate a fully fledged fullstack application built with:

  1. Next.js 14 - App Router, Server Components, Server Actions
  2. Prisma - ORM (SQLite local / PostgreSQL production)
  3. iron-session - encrypted session cookies
  4. Zod - schema validation
  5. Tailwind CSS - styling
  6. that adheres to the RealWorld specification

Advantages:

  1. Server Actions, form logic co-located with the component
  2. RSC renders HTML on the server, zero client JS for page content
  3. loading.tsx gives instant skeleton states without extra libraries
  4. TypeScript end-to-end, no context switching between template and controller languages

The repository and live example can be accessed below:

Repository
Live Example