Tariq Brown

Tariq Brown

Software Engineer

All Projects

SakuraTV

Building a fast, responsive anime streaming site with Vidstack, React Query, and API route proxying to handle CORS and data fetching.

10th June, 2025

Challenge

Building a modern anime streaming site isn’t just about displaying episodes—it requires real-time data fetching, video streaming performance, and robust error handling. One of the biggest challenges when developing SakuraTV was working with external anime APIs that often lacked proper CORS headers, making direct client-side requests infeasible.

In addition, streaming video content demands a clean, immersive UI that performs smoothly across devices—especially for long-form viewing experiences like anime.

Solution

SakuraTV was developed as a Next.js application with a strong focus on developer experience, performance, and modern frontend architecture. By using Next.js API routes as a proxy layer, the site avoids client-side CORS issues. On the frontend, React Query handles asynchronous data fetching and caching, while Vidstack powers a customizable and accessible video player.

From dynamic episode lists to clean theme transitions and mobile-ready layouts, SakuraTV is built with UI/UX best practices in mind.

Key Features

  • Fully Functional Streaming Interface: Users can browse shows, select episodes, and stream anime with minimal loading time.
  • CORS Handling via API Routes: External anime APIs often block direct frontend access. SakuraTV uses Next.js API routes to proxy these requests and avoid CORS errors entirely.
  • Dynamic Routing: Each anime has a dedicated page with route-based episode navigation.
  • Custom Video Player: Streaming is handled via Vidstack, providing a modern, accessible media player with playback controls, keyboard shortcuts, and mobile support.
  • Loading States & Error Boundaries: Implemented with React Query, ensuring a graceful experience even when external APIs are slow or unavailable.

Technology Stack

  • Next.js: Provides a hybrid static/server rendering model ideal for performance and SEO.
  • React Query: Manages data fetching and caching across the app, keeping the UI in sync with API states.
  • Vidstack: A customizable, responsive video player library ideal for streaming interfaces.
  • Tailwind CSS: Speeds up UI development and ensures responsive styling out of the box.
  • TypeScript: Adds type safety and improves maintainability.
  • Next.js API Routes: Used to create server-side proxies for fetching anime data without CORS errors.

Performance & Error Handling

CORS errors are a common pitfall when working with third-party APIs. SakuraTV solves this by routing all API calls through pages/api/, allowing requests to execute server-side where CORS restrictions don't apply. This makes the frontend cleaner and prevents browser-level rejections.

In addition, React Query enables sophisticated handling of loading, error, and retry states, giving users real-time feedback when content is being fetched or unavailable.

UX Considerations

SakuraTV uses a cohesive theme with a well defined colour-palette, inspired by modern streaming platforms like Crunchyroll and Netflix. The layout is mobile-first, with swipe-friendly interactions and prominent call-to-actions. Components are animated subtly to keep the UI lively without being distracting.

Each anime card features clear thumbnails, titles, and descriptions, while hover states and episode transitions are fluid and responsive.

Further Work

SakuraTV is already a feature-rich MVP, but several improvements are planned:

  • User Authentication: Enable users to save favorites and resume watching progress.
  • Watch History & Continue Watching: Allow users to pick up where they left off.
  • Improved Search Functionality: Add fuzzy search and filters by genre, season, and popularity.
  • Progressive Streaming Support: Enable adaptive streaming for better performance on slow networks.

SakuraTV is a showcase of how modern frontend tools like React Query, Vidstack, and Next.js API routes can be combined to build a polished streaming experience—even when working around API limitations like CORS. Whether you're a casual anime fan or a binge-watcher, SakuraTV delivers content quickly, reliably, and with style.