Running Locally

How to start the development server and what to expect on first boot.

Last updated:

Start the development server

bash
npm run dev

The app starts at http://localhost:3000. Next.js will compile the app on first load. Subsequent page loads are instant thanks to hot module replacement.

Tip

Make sure your .env.local is filled in before starting. Missing environment variables will cause runtime errors — check the terminal output for details.

Available npm scripts

ScriptWhat it does
npm run devStarts the Next.js development server at http://localhost:3000
npm run buildRuns prisma generate then builds the production bundle
npm run startStarts the production server (after building)
npm run lintRuns ESLint across the codebase
npm run db:generateRegenerates the Prisma client types (prisma generate)
npm run db:migrateRuns Prisma migrations in dev mode (prisma migrate dev)
npm run db:pushPushes schema changes directly without migrations (prisma db push)
npm run db:seedSeeds the database with initial data (npx tsx prisma/seed.ts)
npm run db:studioOpens Prisma Studio at http://localhost:5555

Accessing Sanity Studio locally

Sanity Studio is embedded directly in the Next.js app as a catch-all route at /studio. No separate server is needed:

bash
# Studio is available at http://localhost:3000/studio
# when the Next.js dev server is running

Navigate to http://localhost:3000/studio and log in with your Sanity account. You'll see the CMS editor with Post, Category, and Author content types configured.

Note

The Sanity Studio configuration lives in sanity.config.ts in the project root, and the schema types are in src/sanity/schemaTypes/. The Studio uses project ID pup1pp2q by default — you'll need to update this to your own Sanity project ID in sanity.config.ts (or it's pulled from NEXT_PUBLIC_SANITY_PROJECT_ID).

Running Prisma Studio

Prisma Studio provides a visual database browser — useful for inspecting data during development:

bash
npm run db:studio
# Opens at http://localhost:5555

Studio lets you create, read, update, and delete records directly — useful for seeding test data or debugging database issues.

Hot reloading and fast refresh

Next.js Fast Refresh is enabled by default. Changes to React components reflect in the browser instantly without losing state. Changes to server-side code (API routes, server components) trigger a soft re-render.

BloggFast also has the React Compiler enabled (reactCompiler: true in next.config.ts), which automatically applies memoization optimizations across the codebase.

Note

If you change .env.local, you must restart the dev server (Ctrl+C then npm run dev) for the new values to take effect.