The official website for Public Vinyl Radio, a Seattle-based music collective showcasing DJ sets, radio shows, and live performances.
- Framework: Gatsby 5 (React-based static site generator)
- Language: TypeScript
- Styling: Tailwind CSS v4 (utility classes, configured in
src/styles/global.css) - Content: MDX (Markdown + React components)
- Hosting: Netlify
- Audio Storage: Cloudflare R2
- Audio Streaming: Custom-built audio players for streaming MP3s from Cloudflare R2
- Show Pages: Dynamic pages for each radio show/episode with metadata and tracklists
- Merch Store: Product catalog and pages (
/shop,/shop/<id>) with a cart and Stripe checkout; order management via CLI scripts - Public Events: Event listing (
/events) with post-event recaps — recap audio, photo collages, and tracklists - Private Events & RSVP: Access-code event pages (
/e/<code>) with RSVP, an organizer admin view (/e/<code>/admin), and RSVP cancellation - Collaborators: Host/collaborator profile pages (
/collaborators/<slug>) - Newsletter Signup: Email capture via a serverless API route
- SEO Optimized: Automatic meta tags, Open Graph images, and structured data
- Image Optimization: Automatic image processing via Gatsby Image
- Embedded Media: Support for YouTube, Spotify, and Apple Music embeds
- Responsive Design: Mobile-first, dark-themed UI (light mode scaffolded but not yet enabled)
- Node.js 18-20
- npm or yarn
# Clone the repository
git clone <repository-url>
cd pvr-site
# Install dependencies
npm install# Start development server
npm run develop
# Site will be available at http://localhost:8000
# GraphQL playground at http://localhost:8000/___graphql# Build for production
npm run build
# Serve production build locally
npm run serve
# Type checking
npm run typecheck
# Clean cache (useful when things break)
gatsby cleanpvr-site/
├── src/
│ ├── components/ # React components
│ │ ├── r2-audio-player.tsx
│ │ ├── r2-playlist-player.tsx
│ │ ├── spotify.tsx
│ │ ├── youtube.tsx
│ │ └── ...
│ ├── content/
│ │ └── shows/ # MDX files for shows
│ ├── templates/ # Page templates
│ ├── pages/ # Static pages
│ └── types/ # TypeScript types
├── gatsby-config.ts # Site configuration
├── gatsby-node.ts # Build-time Node API
└── package.json
Shows are created as MDX files in src/content/shows/:
---
title: 'Show Title'
description: 'Show description'
episode: 1
date: '2025-12-14'
tags: ['Genre1', 'Genre2']
slug: 'show-slug'
host: ['DJ Name']
template: show
isActive: true
coverImage: './cover.jpg'
---
import R2AudioPlayer from '../../components/r2-audio-player';
<R2AudioPlayer
url="https://pub-xxx.r2.dev/audio.mp3"
title="Show Title"
/>
## About This Show
Your content here...title- Show title (required)description- Show description (required)episode- Episode numberdate- Show date in YYYY-MM-DD formattags- Array of genre tagsslug- URL slug (required)host- Array of DJ/host namestemplate- Must beshowisActive- Set tofalseto hide from listingscoverImage- Path to cover image (shown if no YouTube video)youtubeId- YouTube video ID for embedding
Events are data-driven (no MDX), backed by two JSON files that the CLI scripts read and write:
src/data/public-events.data.json— public events, listed on/eventsand rendered at/events/<slug>.src/data/events.data.json— private listening sessions, reachable only via an access code at/e/<code>(organizer view at/e/<code>/admin).
Lifecycle: create an event (event:new), then after it happens enrich
the public event's recap (event:recap / event:photos / event:audio /
event:tracklist).
Use the interactive event builder for public events and private listening
sessions. It validates the shared event slug, writes the appropriate data file,
and creates static/images/events/<slug>/ for event assets.
npm run event:new
npm run event:new -- --dry-run # review the generated event without writing filesPrivate sessions are unlisted. The builder generates a five-character link at
/e/<code>; share that link directly with guests rather than linking it from
the public site.
After a public event happens, enrich its /events/<slug> page with a recap.
Each script is interactive, lets you pick from past events, and supports
--dry-run. They write into src/data/public-events.data.json; the audio/photo
scripts also upload to Cloudflare R2 (see the Stripe/1Password and R2 notes for
credential setup).
npm run audio:prep # prep a raw set recording: join splits, trim silence -> WAV/MP3
npm run event:recap # upload the set audio + pull a tracklist; writes audioUrl + tracklist
npm run event:photos # resize a folder of photos to .webp, upload, add a photo collage
npm run event:audio # swap only the recap audio for an event
npm run event:tracklist # re-sync only the tracklist (after fixing it upstream)Add :dry for a no-write preview, e.g. npm run event:recap:dry. See
CLAUDE.md for the full event lifecycle, data files, and the groovenet/R2
details.
src/data/products.ts is the single source of truth for the shop. The
storefront renders from it, checkout resolves its price lookup keys, and the
sync script pushes it to Stripe — you should rarely touch the Stripe dashboard
directly.
-
Scaffold the entry — an interactive prompt that appends a formatted product to
src/data/products.tsand creates its image folder:npm run shop:new
It asks for the name, id, description, price, tags, image filenames, and variants (generating
<id>--<variant>lookup keys). To edit an existing product instead, just change its entry insrc/data/products.tsby hand. -
Add source images to
static/images/shop/<product-id>/as.png(or.jpg) — the folder is created for you byshop:new. High-res originals are fine; they get downscaled. -
Generate optimized images — creates the
.webp(product cards) and-thumb.webp(cart drawer) derivatives from each source file:npm run shop:images # missing/stale only npm run shop:images -- --force # regenerate everything
-
Preview locally with
npm run develop. -
Push to Stripe sandbox, then promote to live once you're happy:
npm run shop:sync:sandbox # write to the sandbox account npm run shop:sync:sandbox -- --dry-run # preview changes, writes nothing npm run shop:sync:live # promote the same catalog to live
The sync is idempotent — it creates products/prices that are missing, updates names/descriptions/images that drifted, and (because Stripe prices are immutable) when a price changes it creates a new Price, moves the lookup key onto it, and archives the old one. Re-running is always safe.
npm run shop:remove -- <product-id> # remove entry + image folder only
npm run shop:remove:sandbox -- <product-id> # also archive its Stripe products (sandbox)
npm run shop:remove:live -- <product-id> # also archive in live
npm run shop:remove:all -- <product-id> # archive in both, then removeDeletes the entry from products.ts and its static/images/shop/<id>/ folder,
and (with :sandbox/:live/:all) archives the per-variant Stripe products so
they drop off Checkout. Prompts for confirmation; add --yes to skip,
--keep-images to keep the folder, or --dry-run to preview. (Stripe products
with prices can't be hard-deleted, so they're archived — same as "Archive" in the
dashboard.) Stripe products are found by their pvr_id stamp, so archiving still
works even if you already deleted the products.ts entry by hand.
Create a PVR-branded receipt and packing slip from a Stripe Checkout Session or Payment Intent. This is read-only: it retrieves the order details but makes no Stripe changes.
# Sandbox Checkout Session (cs_test_...)
npm run order:pdf:sandbox -- cs_test_123
# Live Checkout Session, written to a chosen location
npm run order:pdf:live -- cs_live_123 --output=./orders/pvr-order.pdf
# Payment Intent IDs work too
npm run order:pdf:sandbox -- pi_123The default output is .generated/orders/order-<id>.pdf, a gitignored local
directory. The command will not replace an existing file unless --force is supplied. The
template includes the PVR display and mono fonts, customer shipping details,
line items, shipping, discount, tax, and total. The order header uses a short
PVR reference rather than Stripe's long internal Payment Intent ID. Like the shop sync commands,
the scripts obtain their corresponding Stripe key from 1Password.
Stripe is the source of truth for fulfillment state. When a paid Checkout
Session is received, the webhook records it as paid; marking an order shipped
adds its carrier, tracking number, and shipping timestamp to both the Checkout
Session and its Payment Intent. This makes the status visible in Stripe's normal
Payment details view.
# Show the 25 newest completed orders (use --limit=100 for more)
npm run order:list:sandbox
# Mark an order shipped using its PVR reference, Checkout Session, or Payment Intent ID
npm run order:ship:sandbox -- PVR-20260726-ABC123 --carrier=USPS --tracking=9400111899223856928499
# A shipment email is sent by default. Deliberately send another only when needed.
npm run order:ship:sandbox -- PVR-20260726-ABC123 --carrier=USPS --tracking=9400111899223856928499 --resend-email
# Backfill shipment metadata without emailing the customer again.
npm run order:ship:sandbox -- PVR-20260726-ABC123 --carrier=USPS --tracking=9400111899223856928499 --no-emailBefore using this in production, create a Stripe webhook endpoint at
https://publicvinylradio.com/api/stripe-webhook, listen for
checkout.session.completed and checkout.session.async_payment_succeeded,
and add its signing secret to Netlify as STRIPE_WEBHOOK_SECRET. The endpoint
verifies Stripe's signature before writing any fulfillment metadata.
order:ship also emails the customer after recording the shipment. Configure
RESEND_API_KEY, ORDER_EMAIL_FROM, and ORDER_EMAIL_REPLY_TO in both
Netlify and the local environment used by the CLI (for example, as 1Password
references in .env.op). The command records the Resend email ID and timestamp
in Stripe and will refuse to send another shipment email unless
--resend-email is provided.
The sync scripts pull secrets from 1Password at runtime using
op run --env-file=.env.op. .env.op contains only op:// references (no
secrets), so it's safe to commit.
Create the two 1Password items the references point at (run these yourself so the keys never leave your machine — paste your real Stripe keys in place of the placeholders):
# Sandbox key (starts with sk_test_...)
op item create \
--category="API Credential" \
--vault="PVR" \
--title="Stripe PVR Sandbox" \
"secret key[password]=sk_test_REPLACE_ME"
# Live key (starts with sk_live_...)
op item create \
--category="API Credential" \
--vault="PVR" \
--title="Stripe PVR Live" \
"secret key[password]=sk_live_REPLACE_ME"Then verify the references resolve:
op run --env-file=.env.op -- printenv STRIPE_SECRET_KEY_SANDBOXIf you keep the keys in a different vault or under different item names, update
--vault=/--title= above and edit the matching op:// lines in .env.op.
(op vault list shows your vault names.)
-
Requires the 1Password CLI (
op) installed and signed in. The scripts run on Node's native TypeScript support (Node 22+), so there's no build step. -
Local checkout — the
/api/create-checkoutroute needsSTRIPE_SECRET_KEYat runtime. Start the dev server with the sandbox key injected from 1Password:npm run dev # = op run --env-file=.env.op -- npx netlify devPlain
npm run developworks for everything except placing an order. (In production, Netlify providesSTRIPE_SECRET_KEYas the live key.) -
Variants become separate Stripe products. A product with variants syncs as one Stripe Product per variant, named
<product> — <variant>(e.g.PVR Tee — Large), so the size shows on the Checkout page. The cart and lookup keys are unchanged. -
Product images must be publicly reachable URLs (Stripe can't host arbitrary product images for you). The sync points Stripe at the deployed site's
.webpfiles, so runnpm run shop:imagesfirst. A brand-new product's images aren't on the live site until you deploy — until then the product syncs without images (you'll see a warning) and picks them up on the next sync after deploy. To preview images before merging, sync against a public Netlify deploy-preview URL:npm run shop:sync:sandbox -- --image-base=https://deploy-preview-NN--yoursite.netlify.app. Images are only re-sent when their bytes or the base URL change (tracked via animage_hashon the Stripe product). -
Products are matched to Stripe by
metadata.pvr_id(= the productid), so the same catalog maps cleanly onto both the sandbox and live accounts. -
The sync never archives Stripe products removed from
products.ts— clean those up in the dashboard if needed.
Audio files are hosted on Cloudflare R2. To use the audio player:
- Upload MP3 to your R2 bucket
- Make sure CORS is configured for your domain
- Use the R2AudioPlayer component in your MDX
<R2AudioPlayer
url="https://pub-{bucket-id}.r2.dev/path/to/file.mp3"
title="Episode Title"
showDownload={true}
/>The site is automatically deployed to Netlify when changes are pushed to the main branch.
Configure these in Netlify:
- Any API keys or secrets needed for builds
- Create a new branch for your changes
- Make your changes
- Test locally with
npm run develop - Create a pull request
All rights reserved - Public Vinyl Radio
For questions or support, contact the Public Vinyl Radio team.