Skip to content

vndevteam/realworld-nextjs-supabase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

RealWorld Next.js Supabase

A full-stack implementation of the RealWorld spec (Conduit clone) built with Next.js and Supabase. This project serves as both a production-ready application and a comprehensive training reference for the Supabase + Next.js stack.

πŸ“‹ Table of Contents

🎯 Overview

This project implements the RealWorld application specification, providing a complete social blogging platform with user authentication, article management, comments, favorites, and tags. Built with modern web technologies, it demonstrates best practices for full-stack development using Next.js App Router and Supabase.

Key Goals:

  • Deliver the canonical RealWorld feature set (authentication, profiles, articles, tags, favorites, comments)
  • Serve as a Supabase + Next.js starter template and training reference
  • Demonstrate server-first architecture with React Server Components
  • Showcase Row-Level Security (RLS) for authorization
  • Provide comprehensive documentation for onboarding new developers

✨ Features

Core RealWorld Features

  • βœ… User authentication (register, login, JWT/session)
  • βœ… User profiles and settings
  • βœ… Articles (CRUD operations)
  • βœ… Comments on articles
  • βœ… Favorites/bookmarks
  • βœ… Tags and tag filtering
  • βœ… Global and personal feeds
  • βœ… Pagination

Supabase-Oriented Capabilities

  • πŸ” Authentication flows via Supabase Auth with SSR session injection
  • πŸ›‘οΈ Authorization via Row-Level Security (RLS) policies
  • πŸ”„ Realtime updates for selected domains
  • πŸ“¦ Storage with signed URLs
  • ⏰ Batch jobs via Cron and Edge Functions
  • πŸ“¬ Queue support (pgmq) for async processing
  • πŸš€ CI/CD with Supabase CLI and GitHub Actions

πŸ› οΈ Tech Stack

Core Technologies

  • Next.js 16 - React framework with App Router
  • React 19 - UI library
  • TypeScript 5 - Type-safe JavaScript (strict mode)
  • Tailwind CSS v4 - Utility-first CSS framework
  • Supabase - Backend-as-a-Service (Auth, Postgres, Storage, Realtime)
  • pnpm - Fast, disk space efficient package manager

Development Tools

  • ESLint 9 - Code linting with eslint-config-next
  • Husky - Git hooks
  • Commitlint - Conventional commits
  • VitePress - Documentation site
  • Supabase CLI - Local development and deployment

Optional/Advanced

  • Supabase Cron (pg_cron) and Scheduled Edge Functions
  • Supabase Queues (pgmq)

πŸ“¦ Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js β‰₯ 18
  • pnpm (recommended) or npm
  • Supabase CLI - Installation Guide
  • Docker Desktop or Podman (for local Supabase)
  • Git

Recommended VSCode Extensions

  • Supabase (by Supabase)
  • SQLTools
  • ESLint
  • Prettier

πŸš€ Getting Started

1. Clone the Repository

git clone https://github.com/vndevteam/realworld-nextjs-supabase.git
cd realworld-nextjs-supabase

2. Install Dependencies

pnpm install

3. Set Up Supabase

Option A: Local Development (Recommended)

# Start Supabase locally
cd supabase
supabase start

# Copy environment variables
cp .env.example .env.local

Option B: Cloud Project

  1. Create a project at supabase.com/dashboard
  2. Copy your project URL and anon key
  3. Create .env.local in the nextjs directory:
NEXT_PUBLIC_SUPABASE_URL=your-project-url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key

4. Run the Development Server

# From project root
cd nextjs
pnpm dev

Open http://localhost:3000 in your browser.

5. Run Documentation Locally

# From project root
pnpm docs:dev

Open http://localhost:5173 to view the documentation.

πŸ“ Project Structure

realworld-nextjs-supabase/
β”œβ”€β”€ nextjs/                 # Next.js application
β”‚   β”œβ”€β”€ app/                # App Router pages and layouts
β”‚   β”œβ”€β”€ public/             # Static assets
β”‚   └── package.json
β”œβ”€β”€ supabase/               # Supabase configuration
β”‚   β”œβ”€β”€ migrations/         # Database migrations
β”‚   β”œβ”€β”€ functions/          # Edge Functions
β”‚   └── config.toml         # Supabase config
β”œβ”€β”€ docs/                   # Documentation site
β”‚   β”œβ”€β”€ onboarding-guide/   # Training documentation
β”‚   └── .vitepress/         # VitePress config
β”œβ”€β”€ openspec/               # OpenSpec change management
β”‚   β”œβ”€β”€ specs/              # Project specifications
β”‚   └── changes/            # Change proposals
└── package.json            # Root workspace config

πŸ’» Development

Available Scripts

Root Level

pnpm docs:dev      # Start documentation dev server
pnpm docs:build    # Build documentation
pnpm docs:preview  # Preview built documentation

Next.js App

cd nextjs
pnpm dev          # Start development server
pnpm build        # Build for production
pnpm start        # Start production server
pnpm lint         # Run ESLint

Code Style

  • TypeScript: Strict mode enabled, explicit types on exports
  • React: Server Components by default, Client Components only when needed
  • Styling: Tailwind CSS utility-first, co-locate theme tokens in globals.css
  • Naming:
    • Functions: verb/verb-phrase (e.g., getUserProfile, createArticle)
    • Components: PascalCase (e.g., ArticleList, ProfileCard)
    • Files: kebab-case for modules, PascalCase for React components
  • Imports: Use path alias @/* as configured in tsconfig.json

Architecture Patterns

  • Server-First: Prefer Server Components and Server Actions
  • RLS as Primary Authorization: Encode access control in PostgreSQL policies
  • Clear Client Separation: Server-side Supabase client for SSR, client-side only for interactive auth/realtime
  • Route Protection: At server layer (RSC/middleware) using Supabase session
  • Modular by Domain: Keep features separated (auth, articles, profiles)

Git Workflow

  • Branching: Feature branches feat/<topic>, fix branches fix/<topic>
  • Commits: Conventional Commits (e.g., feat: add article editor, fix: correct tag filter)
  • Pull Requests: Required for merges, must pass CI checks

πŸ“š Documentation

Comprehensive documentation is available in the docs/ directory, covering:

  • Introduction - Overview of Supabase and the stack
  • Setup - Environment preparation and project creation
  • Authentication - User auth flows and SSR session handling
  • Authorization - Row-Level Security (RLS) policies
  • Integration - Supabase + Next.js integration patterns
  • Advanced - Edge Functions, Cron, Queues
  • Performance - Optimization strategies
  • Security - Best practices and guidelines
  • CI/CD - Deployment and DevOps
  • Observability - Debugging and monitoring

View the documentation locally:

pnpm docs:dev

Or access the online version (when deployed).

🀝 Contributing

Contributions are welcome! Please follow these guidelines:

  1. OpenSpec Workflow: For planning or proposals, check openspec/AGENTS.md
  2. Conventional Commits: Use the commit message format
  3. Code Quality: Ensure linting passes and types are correct
  4. Documentation: Update docs when adding features
  5. Pull Requests: Provide clear descriptions and ensure CI passes

Development Checklist

  • Code follows project conventions
  • TypeScript types are explicit and correct
  • ESLint passes without errors
  • Server-first patterns are followed
  • RLS policies are tested
  • Documentation is updated (if needed)

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘₯ Team

VNDevTeam - Internal training and development team


Built with ❀️ using Next.js and Supabase

About

RealWorld project built with NextJS & Supabase. Bonus: Supabase + Next.js Onboarding Guide

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors