- Server-Side Rendering: Fast initial page loads with Astro SSR on Cloudflare Workers
- Global Search: Search across movies, series, and boxsets with real-time dropdown results
- Advanced Filtering: Sort by latest release, date added, release date, or title
- Smooth Transitions: View Transitions API for seamless page navigation with morphing animations
- Responsive Design: Fully responsive TailwindCSS layout with dark mode support
- Type-Safe: End-to-end type safety with GraphQL Code Generator
- Optimized Images: Automatic image optimization with Astro's built-in image service
- Framework: Astro with SSR
- Runtime: Cloudflare Workers
- Styling: TailwindCSS v4
- Data: GraphQL with graphql-request
- Interactivity: Preact
- Package Manager: pnpm
- Code Quality: Biome
- Node.js v24.21.0 LTS or later, pinned in
.node-version - pnpm v11.20.0 or later
- Global Cloudflare CLI, installed with
pnpm add --global cf, for account commands such ascf auth login
Project scripts use the locally installed Astro and cf versions.
# Clone the repository
git clone <repository-url>
cd thediscdb
# Install dependencies
pnpm install --frozen-lockfile
# Generate Cloudflare binding and runtime types
pnpm cf-typegen
# Generate TypeScript types from GraphQL schema
pnpm codegen
# Start development server
pnpm dev# Development
pnpm dev # Start dev server at http://localhost:4321
pnpm build # Build for production with Astro
pnpm deploy # Deploy the existing production build with cf
pnpm deploy:preview # Build and deploy a branch Worker Preview
pnpm preview # Preview production build with Cloudflare workerd
# Code Quality
pnpm check # Run Oxfmt and Oxlint checks
pnpm lint # Lint with Oxlint
pnpm format # Format with Oxfmt
# Code Generation
pnpm codegen # Regenerate TypeScript types from GraphQL schema
pnpm cf-typegen # Generate Cloudflare Workers typesthediscdb/
βββ src/
β βββ components/ # Reusable UI components
β β βββ GlobalSearch.tsx # Search component (Preact)
β β βββ MediaCard.astro # Movie/series card
β β βββ Navigation.astro # Top navigation bar
β β βββ Pagination.astro # Cursor-based pagination
β βββ graphql/
β β βββ queries.gql # GraphQL queries
β β βββ index.ts # GraphQL client setup
β β βββ sdk.gen.ts # Generated TypeScript SDK
β βββ layouts/
β β βββ Layout.astro # Base page layout
β βββ pages/
β β βββ movies/ # Movie list and detail pages
β β βββ series/ # Series list and detail pages
β β βββ boxsets/ # Boxset list and detail pages
β β βββ search.astro # Global search results
β β βββ api/ # API endpoints
β βββ styles/
β β βββ global.css # Global styles and utilities
β βββ utils/ # Utility functions
βββ astro.config.ts # Astro configuration
βββ codegen.config.ts # GraphQL Code Generator config
βββ cloudflare.config.ts # Cloudflare Workers config
- GraphQL queries are defined in
src/graphql/queries.gql - Running
pnpm codegengenerates a type-safe SDK - Pages fetch data server-side using the SDK
- Astro renders pages on Cloudflare Workers edge network
The site uses cursor-based pagination (not offset-based) for efficient data fetching:
- 48 items per page
- Bidirectional navigation (next/previous)
- Cursor state maintained via URL query parameters
Global Search:
- Real-time search with 300ms debounce
- Shows up to 3 results per content type
- Full results available at
/search?q=query
List Filtering:
- Each list page supports
?q=parameter for filtering - Combined with sort options for flexible browsing
Smooth client-side navigation using Astro's View Transitions:
- Cover art morphs between list and detail pages
- Navigation bar persists across pages
- Content slides in with custom animations
The project is configured for Cloudflare Workers deployment:
# Build for production
pnpm build
# Deploy to Cloudflare Workers
pnpm deployThe project uses the cf CLI, Astro 7.4 beta, and @astrojs/cloudflare v15 beta.
Worker settings live in cloudflare.config.ts, including the custom domain,
bindings, and observability. Build output and generated types live in the ignored
.cloudflare/ directory.
Sign in with cf auth login before deploying, or set
CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID in CI. cf does not reuse a
Wrangler login. For Workers Builds, use pnpm build as the build command and
pnpm deploy as the deploy command.
Deploy the production configuration once with pnpm build && pnpm deploy to
enable Preview URLs. Then build and deploy a branch Preview:
pnpm deploy:preview # Use the current Git or CI branch name
pnpm deploy:preview my-feature # Use an explicit Preview nameThe command builds with Preview settings and returns its URLs. Previews use
workers.dev, without the production custom domain. Rebuild with pnpm build
before deploying to production again. pnpm preview remains the local preview
command. See Cloudflare Workers Previews.
- Add your query to
src/graphql/queries.gql - Run
pnpm codegento regenerate types - Import and use:
import { query } from '~/graphql' - Call in your page:
await query.YourNewQuery({ ... })
This is a personal project, but suggestions and feedback are welcome!
- Data provided by TheDiscDB
- Built with Astro
- Deployed on Cloudflare Workers
MIT