Static Next.js 14 + Bun soundboard deployed to GitHub Pages with NextUI and Tailwind. Audio ships from public/audio, imagery from bundled assets with optional Pexels enrichment, and analytics/favorites persist locally in the browser.
- Next.js App Router with Bun scripts
- NextUI 2 + Tailwind; light/dark/system themes via next-themes
- Offline-ready MP3s in
public/audio - Client-side favorites and local analytics stored in
localStorage - Optional Pexels photo enrichment (fallback to bundled images)
- Base-path aware asset loading for GitHub Pages deployments
- Install dependencies (Bun):
bun install- Configure environment:
cp .env.example .env.localOptional: add PEXELS_API_KEY and set NEXT_PUBLIC_ENABLE_PEXELS=true for live photos in dev.
- Run development server:
bun run devVisit http://localhost:3000.
- Build static export:
bun run buildOutput is written to out/ with .nojekyll for Pages.
app/
api/images/route.js # Pexels proxy (disabled when NEXT_DISABLE_PEXELS_API=1)
layout.jsx # Metadata + providers
page.jsx # Main soundboard UI (filters, audio, favorites, stats)
globals.css # Tailwind layers + theme tokens
components/
navbar.jsx, hero.jsx, filters.jsx, favorites-bar.jsx,
sound-card.jsx, stats-overview.jsx, theme-toggle.jsx, providers.jsx
data/
animals.js # Catalog with audio paths and fallback images
lib/
base-path.js # Base path resolution for static hosting
analytics.js # Local analytics load/save/summarize
public/
audio/ # MP3 assets
images/ # Fallback photography/illustrations
scripts/postbuild.mjs # Adds .nojekyll to out/
| Variable | Description |
|---|---|
PEXELS_API_KEY |
Optional Pexels key for image enrichment (used when enabled). |
NEXT_PUBLIC_ENABLE_PEXELS |
true to fetch Pexels images in dev; leave false/unset for static deploys. |
NEXT_PUBLIC_BASE_PATH |
Base path for static hosting (e.g., /AnimalSounds); set in CI for Pages. |
NEXT_PUBLIC_SITE_URL |
Canonical site origin for metadata (e.g., https://bradleymatera.github.io). |
NEXT_DISABLE_PEXELS_API |
Set to 1 during static export (build script sets this). |
Create .env.local from .env.example. Without a Pexels key, bundled images are used.
bun run devfor local;bun run buildfor static export.- Audio/image URLs are base-path aware via
lib/base-path.js; ensureNEXT_PUBLIC_BASE_PATHmatches your hosting subpath. - Analytics and favorites stay in
localStorage; there is no server persistence.
- Workflow injects
NEXT_PUBLIC_BASE_PATH=/${{ github.event.repository.name }}andNEXT_PUBLIC_SITE_URL=https://${{ github.repository_owner }}.github.ioduring build. - Static export goes to
out/and includes.nojekyll.
MIT © Bradley Matera