Quick Start
Welcome to PodCast — a production-ready media streaming platform for audio, video and podcasts, built with Next.js 16 (App Router), React 19, TypeScript, PostgreSQL and Tailwind CSS. This page gets you from a fresh download to a running site in about 15 minutes.
Visitors browse the whole catalogue freely. Playback requires a free account — name, email and password — and that gate is enforced at the stream, not just in the UI. Members build playlists, keep a watch history and a watch-later list, react and comment; admins manage the catalogue, categories and the home page.
New here? Read Product Overview for the big picture, then come back to install.
What you need
- Node.js 20+ and npm
- A PostgreSQL database (we recommend Neon — PodCast uses the
@neondatabase/serverlessdriver) - About 15 minutes
Install in 4 steps
# 1. Install dependencies
npm install
# 2. Create your environment file
# Create .env.local with at least DATABASE_URL (JWT_SECRET / SECRET_KEY
# are auto-generated by the install wizard's database step if unset).
# 3. Initialise the database (schema + seed)
npm run db:init
# 4. Start the dev server
npm run dev
Open http://localhost:3000. The first run launches the install wizard at /install — it walks you through the database check, admin account, and site settings.
There are no migration files. Schema is provisioned in-app by idempotent ensure*Schema() functions (CREATE TABLE IF NOT EXISTS, ALTER TABLE … ADD COLUMN IF NOT EXISTS) that run on first use of each area.
Load the demo
# 1. Demo catalogue — categories plus audio, video and podcast items.
# Artwork comes from Pexels; set PEXELS_API_KEY in .env first.
npx tsx scripts/seed-demo-media.ts
# 2. Point demo media at sources that actually play.
# Run this after any re-seed — see "Demo media" below for why.
npx tsx scripts/fix-demo-media-urls.ts
# 3. Blog categories and articles
npx tsx scripts/seed-demo-blog.ts
# 4. Email templates for the account and notification lifecycle
npx tsx scripts/seed-email-templates.ts
# 5. Storefront pages (privacy, cookies, terms, refunds, about)
npx tsx scripts/seed-site-pages.ts
Every seed script is idempotent — re-running updates rather than duplicating.
Demo media
The catalogue seeder pulls artwork from Pexels, which is reliable. Media files are a different matter: third-party CDNs change their hotlinking rules without notice, and much free stock video has no audio track at all. fix-demo-media-urls.ts exists because both happened — it repoints demo items at sources verified to return HTTP 206 with a real audio track, and sets duration_seconds from the measured file so the badge on a card matches the player.
For anything beyond a demo, upload your own media (admin → Audio / Video / Podcast → New) so nothing depends on someone else's CDN.
How playback is gated
Three layers, in order of how much they matter:
- The stream route.
GET /api/v1/media/{kind}/{slug}/streamchecks the session and returns401for a gated item, so the storage URL never reaches the page source. This is the only layer that actually protects anything. - The player. A locked item renders its artwork and a sign-in prompt instead of a
<video>whosesrcwould 401 on play. - Cards and links. A signed-out click opens the sign-in dialog rather than navigating to a dead end.
Set per item with Requires login in the admin form. Browsing, search, artwork, titles and counts stay public — the card is the advertisement.
Content types
Audio, video and podcast are three independent types, each with its own table and its own multi-level category tree (content_categories, an adjacency list with a materialised path). Everything else is shared: engagement, playlists, history, search and the home page treat all three the same way.
| Audio | Video | Podcast | |
|---|---|---|---|
| Table | audio_items |
video_items |
podcast_items |
| Detail URL | /listen/{slug} |
/watch/{slug} |
/watch/{slug} |
| Browse URL | /audio |
/videos |
/podcasts |
| Extra fields | artist |
quality_label, width, height |
host_name, season_number, episode_number |
| Card shape | square | poster | wide |
Media files upload presigned direct-to-R2 — large files never buffer through the server. Images go through the upload route, which resizes and converts to WebP.
The home page
Admin → Configuration → Homepage. The hero and every rail are configured there, not in code:
- Hero — up to 16 slides drawn from any combination of the three types. An item appears when Show in hero slider is ticked; if too few are ticked the hero falls back to featured, then to newest, so it is never empty.
- Rails — each has a source (
latest,featured,top), a type filter, a card shape, a limit and a link target.
Engagement
| Feature | Stored in | Notes |
|---|---|---|
| Reactions | media_likes |
Four kinds; one per member per item, enforced by the primary key |
| Comments | media_comments |
One level of replies. Plain text in, escaped on render |
| Views | views column |
Counted on play, not on page load. Rate-limited per IP per item |
| Shares | shares column |
Counted when a share target is chosen |
| History | media_history |
Upserted, so it is a list of items rather than of events |
| Watch later | media_watch_later |
|
| Playlists | media_playlists |
Member-owned, can mix all three types |
| Reports | media_reports |
A moderation queue, not a counter |
Counters on the item rows are recomputed after every change rather than incremented, so a failed or duplicated request can never leave them drifting from the rows they describe.
Comments are "live" by polling every 10 seconds while the tab is visible, passing ?after=<id> so each tick returns only new rows. There is no realtime service to install.
Notifications
Template-driven from Settings → Notifications, silent until an email provider is connected under Settings → Channels. Seed them with npx tsx scripts/seed-email-templates.ts.
category on each template decides whether a member may opt out:
| Category | Examples | Member control |
|---|---|---|
Account |
Welcome, verify email, password reset, password changed, account deleted | Always sent. Security mail is not a preference |
Notifications |
Replies to your comments, new releases | On by default, opt-out |
Marketing |
Weekly digest, product news | Off by default, opt-in |
Preferences live in customer_notification_prefs and are checked inside notifyEmail() at send time — a stored preference is only worth anything if the sender consults it. A missing row means "whatever that template defaults to", so adding a new type does not silently opt everyone out of it.
Core environment variables
| Variable | Purpose |
|---|---|
DATABASE_URL |
PostgreSQL connection string |
JWT_SECRET |
Signs admin/member session tokens. Required in production |
SECRET_KEY |
AES-256-GCM key that encrypts stored integration secrets |
CRON_SECRET |
Guards /api/v1/cron — without it the endpoint stays closed |
PEXELS_API_KEY |
Demo imagery instead of placeholders |
LICENSE_SERVER_URL |
License server (defaults to https://creative-cape.com) |
Storage (R2/S3) and payment credentials are not environment variables — they live encrypted in integration_connections, managed under admin → Settings → Channels.
Where to go next
- Installation Guide — detailed setup
- Deployment Guide — ship to production
- Admin Guide — run the platform day-to-day
- API Documentation — the REST surface, plus the live reference at
/api/docs/v1 - Security Guide — the threat model and what enforces it
- Customization Guide — theming, vocabulary and layout
© CreativeCape Solutions · creative-cape.com · support@creative-cape.com