Quickstart

Get started using a GitHub fork.

Setting Up

Grab Guestbook Repository

Fork https://github.com/beck-chan/y2k-guestbook/ on GitHub, then clone your copy into your local environment:

git clone https://github.com/YOUR_USER/y2k-guestbook.git
cd y2k-guestbook
# Install dependencies
npm install

Set Up Environment Variables

  1. Copy the .env.example file to .env.local:

    cp .env.example .env.local
    
  1. Fill in values from your Supabase project and site origin:

    # Supabase project URL
    NEXT_PUBLIC_SUPABASE_URL=https://<your-database-url>.supabase.co
    
    # Supabase publishable key (browser-safe, RLS still applies)
    NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=sb_publishable_<your-publishable-key>
    
    # Secret key. Local ONLY — for `npx y2k-guestbook allow-admin`
    SUPABASE_SECRET_KEY=sb_secret_<your-secret-key>
    
    # App origin for OAuth return. Used to build redirectTo on the server.
    SITE_URL=http://localhost:3000
    
    # Supabase pooler URI — for rate limiting
    DATABASE_URL=postgresql://postgres.<your-database-url>:[YOUR-PASSWORD]@<your-database-region>.pooler.supabase.com:<port>/postgres
    
    # Optional admin URL prefix (default /admin). No trailing slash.
    # NEXT_PUBLIC_GUESTBOOK_ADMIN_PATH=/admin
    

Installing

Enable Authentication Hook

  1. Copy the contents of schema.sql to your clipboard.

  2. Within Supabase, select SQL Editor from the left sidebar, then paste in the contents of schema.sql.

  3. Click Run to execute the schema.

  4. If you receive a Potential issue detected popup, click Run query to execute the schema.

Allow Your Admin User

From your Next.js app root, allow-list a Google account as your admin user:

npx y2k-guestbook allow-admin you@gmail.com

You'll need to authorize Google to connect on your first sign in.

Run Development Server

To preview your application locally, run:

# Serves by default at `http://localhost:3000` 
npm run dev

Your interface should initially mimic the demo guestbook, but with no hit counter:

Serve Your Guestbook

To build the application locally to upload manually to your hosting provider:

# Linter check for errors
npm run lint
# Compile
npm run build
# Serve build 
npm run start

What's Next

Manage admin authentication and add analytics to display a hit counter: