Feed and Detail

View saved

Goal

This snapshot advances Wavelength Daily by teaching you to load published stories and individual detail pages.

Each numbered folder is a complete app. Run it independently and compare adjacent snapshots to isolate the new responsibility.

Prerequisites

Use Node.js 20 or newer, npm, and a terminal. Basic TypeScript, HTML, and CSS familiarity will help.

The development server uses port 5173. Database snapshots also need Docker and the Supabase CLI.

  • Node.js and npm
  • A code editor
  • Docker from part 4 onward

Concepts

Server load functions query Supabase without exposing private drafts to anonymous readers.

SvelteKit keeps route UI, server loading, and form actions close together while preserving a clear browser/server boundary.

Walkthrough

Query a bounded home feed, list published stories, load one slug, and return 404 when RLS hides it.

Trace the example from request to rendered page, then inspect the complete matching snapshot for types, validation, and failure handling.

await supabase.from('posts').select('*').eq('published', true);

Run and verify

Enter 05-Feed-And-Detail, install dependencies, and start the app. Supabase stages must start the local stack and copy the printed anon key into .env.

Open http://localhost:5173 and keep the terminal visible so browser actions can be matched to server errors.

git clone https://github.com/michaeldunga1/fcc-sveltekit-blog.git
cd fcc-sveltekit-blog/05-Feed-And-Detail
npm install
npx supabase start
cp .env.example .env
npm run dev

Troubleshooting

Log the Supabase error separately from empty data so a failed query is not mistaken for an empty feed.

A missing package usually means npm install ran in another snapshot. After changing environment variables, restart the SvelteKit process.

  • Read the first error first
  • Check the current snapshot path
  • Never commit .env or node_modules

Try this

Confirm an anonymous visitor cannot open the seeded draft.

Test one happy path and one invalid or unauthorized path before moving on.

  • Make one focused change
  • Verify it in the browser
  • Compare with the next snapshot after it works

Next: Registration

Comments

One comment per signed-in account. Comments are saved with this page’s URL.