- TypeScript 82%
- CSS 12%
- JavaScript 6%
portfolio-2024 #
Personal portfolio + blog built with Next.js 15 (App Router) and Payload CMS 3. Payload runs inside the same Next.js process, serving both the headless CMS/admin UI and the public site.
- Database: MongoDB (Mongoose adapter)
- Storage: local disk in development, S3 (Hetzner Object Storage) in production
Prerequisites #
- Node.js ≥ 20.9
- Docker — for a local MongoDB (see below)
- ffmpeg / ffprobe / pdftoppm — used to generate poster frames for video and PDF uploads. On macOS:
brew install ffmpeg poppler. Optional: without them uploads still work, but posters won't be generated.
Setup #
npm install
cp .env.example .env # then fill in PAYLOAD_SECRET; the defaults work for local dev
For local development .env must contain:
DATABASE_URI=mongodb://localhost:27017
LOCAL_DEV=true # stores uploads on disk instead of S3
NEXT_PUBLIC_PAYLOAD_SERVER_URL=http://localhost:3000
Testing the project from scratch #
The database and the local upload files (media/, media-stream/, video-posters/) must stay in sync. Deleting one side without the other leaves dangling references. Instead of hand-managing them, use the seed script, which wipes both together and recreates a full set of example content.
1. Start a fresh MongoDB container #
docker run -d --name portfolio-mongo -p 27017:27017 mongo:7
This matches the default DATABASE_URI (mongodb://localhost:27017). To start over with a completely empty database later:
docker rm -f portfolio-mongo
docker run -d --name portfolio-mongo -p 27017:27017 mongo:7
(Stopping/starting the same container preserves data; removing and recreating it gives a blank database. Note that npm run seed already wipes all data on its own, so you rarely need to recreate the container.)
2. Seed + run #
npm run dev:fresh # wipe + seed, then start the dev server
or as two steps:
npm run seed # wipe the DB + upload folders, recreate example content
npm run dev # start the dev server (keeps existing data)
Then open:
- Site: http://localhost:3000
- Admin: http://localhost:3000/admin — log in with
dev@local.test/dev(override viaSEED_EMAIL/SEED_PASSWORDenv vars when seeding)
What the seed creates #
- Users — one admin account
- Posts — two published (an essay containing every rich text block, and a shorter note) plus one draft (to test the default headline layout and draft previews)
- Media stream — text, image, video, and PDF entries (
/media-stream/1) - Globals — homepage intro and site navigation/footer links
Sample assets live in seed/fixtures/ — three placeholder images (jpg/png/webp), two placeholder videos, and a placeholder PDF. These are the only media committed to the repo; everything the seed generates lands in the git-ignored runtime folders (media/, media-stream/, video-posters/) so test content never syncs to GitHub.
Scripts #
| Script | Description |
|---|---|
npm run dev |
Start the dev server (Next.js + Payload admin) |
npm run dev:fresh |
Wipe + seed the database, then start the dev server |
npm run seed |
Reset the database and upload folders and recreate example content |
npm run devsafe |
Clear the .next cache, then start the dev server |
npm run build |
Production build |
npm run lint |
ESLint |
npm run generate:types |
Regenerate src/payload-types.ts after a schema change |
npm run generate:importmap |
Regenerate the Payload admin import map |
Notes #
- ⚠️
npm run seedis destructive — it deletes every document in the configured database and empties the local upload folders. Only run it against a local/dev database. - Run
npm run generate:typeswhenever a Payload collection or global schema changes; the generatedsrc/payload-types.tsis the source of truth for types across the app.