Skip to content

pizzalover125/hack-feed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

8135ef1 · · May 30, 2026

History

1 Commit
May 30, 2026
May 30, 2026
May 30, 2026
May 30, 2026
May 30, 2026
May 30, 2026
May 30, 2026
May 30, 2026
May 30, 2026
May 30, 2026
May 30, 2026
May 30, 2026

Repository files navigation

Hack Feed

Hacker News, but for Hack Club. A near-pixel clone of news.ycombinator.com built with SvelteKit + Supabase. Only the logo and "Hack Feed" header differ.

Features:

  • Front page (HN gravity ranking) + new, ask, show, jobs feeds
  • Username + password auth (no email), identical to HN's /login / /submit
  • Submit link or text posts
  • Up/down voting on posts (works without JavaScript)
  • Per-user karma, user profiles

Setup

1. Create a Supabase project

At supabase.com, create a project. Then SQL Editor → New query, paste the contents of supabase/schema.sql, and run it. This creates the tables, row-level-security policies, and the score/karma triggers..

No auth settings need changing — accounts are created and auto-confirmed server-side with the service-role key, so the default email provider is fine and users never deal with email..

2. Configure environment

cp .env.example .env

Fill in from Project Settings → API:

  • PUBLIC_SUPABASE_URL — Project URL
  • PUBLIC_SUPABASE_ANON_KEYanon public key
  • SUPABASE_SERVICE_ROLE_KEYservice_role secret key (server-only, used to register users)

3. Run

npm install
npm run devv

Open http://localhost:5173, click login, create an account, and submit a post.

How auth works

Supabase Auth requires an email, but HN uses bare username/password. Each username maps to a stable synthetic email (([email protected]) that users never see. Signup uses the service-role client ((src/lib/server/admin.js) to create + auto-confirm the account and insert a profiles row; login uses the normal anon client so the session lives in cookies ((@supabase/ssr).

Layout

src/
  hooks.server.js            per-request Supabase client + session helper
  app.css                    HN-faithful styles
  lib/
    util.js                  time-ago, ranking, comment-tree
    components/              Vote, PostList, Feed, Comment
    server/
      admin.js               service-role client (lazy)
      auth.js                username -> email, validation
      feed.js                paginated post-list loader
  routes/
    +layout.svelte           orange top bar + footer
    +page                    front page (ranked)
    newest|ask|show|jobs     filtered feeds
    item                     story permalink (link + text body)
    submit                   new post (redirects to /login when logged out)
    login                    login + create-account (HN style)
    logout                   sign out
    user                     profile
    vote/+server.js          POST upvote/downvote toggle
supabase/schema.sql          database schema, RLS, triggers
rs
hema, RLS, triggers