How devxoshakya/anveshna works
1. Repository shape
- This is a Next.js App Router frontend written in TypeScript + React.
- The code is organized as a multi-page consumer app for an anime platform called Anveshna.
- There is no separate backend in this repo; the UI appears to call external/content APIs through client-side hooks.
2. Routing and page boundaries
- All user-facing screens live under app/(shared), which suggests a shared site shell reused across pages.
- Main routes include home, search, trending, watch, chat, history, about, privacy-policy, dmca-policy.
- app/(shared)/watch/[id] is the dynamic detail/playback route for an individual anime title.
3. Global shell and layout
- app/layout.tsx and app/globals.css define the root document and global styling.
- components/layout/* contains the persistent chrome: Navbar, Sidebar, Footer, plus search/filter controls.
- components/theme-provider.tsx and components/ui/theme-toggle.tsx indicate a theme system for dark/light behavior.
4. Home/discovery subsystem
- The home experience is built from components/home/* and components/cards/*.
- Key pieces:
- HomeCardList for listing anime cards
- category-nav and pagination-component for browsing sets of content
- watch-history-slider for recently watched items
- TrendingAnimeCard, CardGrid, CardItem for reusable catalog presentation
- This is the main discovery surface for the catalog.
5. Search and filtering flow
- Search-related UI is split between components/layout/anime-search.tsx, SearchFilter.tsx, and the app/(shared)/search route.
- hooks/useFilters.ts likely owns filter state and query shaping.
- components/chat/SearchResultCard.tsx and cards in the search route suggest shared result presentation across features.
6. Watch/playback subsystem
- The watch experience is centered on app/(shared)/watch/[id]/page.tsx.
- components/watch/* handles title metadata and episode navigation:
- AnimeDataList, WatchAnimeData for title/episode data
- EpisodeList, Seasons for episode grouping
- Playback is isolated in components/watch/video/*:
- UnifiedPlayer as the top-level player abstraction
- Player, MediaSource, IFramePLayer, Loader
- PlayerStyles.css for player-specific styling
- types/streaming.ts defines the data contract for streaming/video sources.
7. Chat / AI subsystem
- The chat page (app/(shared)/chat) is a separate conversational UI.
- hooks/useAi.ts and components/kokonutui/* show an AI/streaming response flow with loading states.
- components/chat/ChatMessages, ChatPlaceholder, and SearchResultCard suggest the chat can return anime-oriented answers or recommendations.
- hooks/useAutoScroll.ts supports the streaming-message UX by keeping the latest response visible.
8. Shared UI kit
- components/ui/* is a reusable design system: button, card, input, textarea, table, pagination, badge, breadcrumb, alert, skeleton, etc.
- components/skeletons/* and components/shared/StatusIndicator.tsx provide loading and status primitives used across pages.
- components.json suggests the project uses a structured component setup similar to a modern UI toolkit.
9. Behavioral hooks and client-side state
- hooks/ contains the main interaction logic:
- useApi for fetching
- useAi for AI/streaming requests
- useCountdown and useTime for timed UI behavior
- use-mobile for responsive behavior
- useAutoScroll for message streams
- These hooks are the main boundary between UI components and runtime behavior/data fetching.
10. Utilities, assets, and styling
- lib/utils.ts and lib/registry.tsx provide shared helpers and integration glue.
- public/ contains static assets, including the landing imagery referenced in the README.
- The app uses standard Next.js global CSS plus component-scoped styling where needed.
11. Testing strategy
- __tests__ mirrors the production structure: components, hooks, pages, and shared utilities.
- Jest configuration (jest.config.js, jest.setup.js, test-setup.ts) indicates the repo is designed for component-level and hook-level verification rather than end-to-end infrastructure.
- Test coverage is especially strong around watch/player, chat, and home-page behavior.
12. Runtime and deployment context
- The repo is set up for Bun (bun.lock, bunfig.toml) but remains Node-compatible.
- The README shows deployment targets like Vercel and self-hosting via Diploi.
- .env.example implies runtime configuration is driven by environment variables, likely for API keys or endpoint settings.
13. Architectural summary
- The main data flow is: route → page component → feature component tree → hooks/API/AI layer → rendered UI.
- The most important domain boundaries are:
- catalog/discovery
- watch/playback
- chat/AI
- shared shell and design system
- For an architecture diagram, the repo should be drawn as a frontend-only Next.js application with feature modules feeding off shared UI primitives and hook-based data access.
Main entry points: layout.tsx Shared Shell · HomeCardList.tsx Discovery UI · useApi.ts Core Hooks · page.tsx Watch Detail
Components 24
Routing
App Router pages and route boundaries
- App Root · Root document and global app entry
app/layout.tsx - Shared Shell · Persistent app shell for shared pages
app/(shared)/layout.tsx - Home Page · Main discovery landing page
app/(shared)/home/page.tsx - Search Page · Search and filtered catalog route
app/(shared)/search/page.tsx - Trending Page · Trending catalog route
app/(shared)/trending/page.tsx - Watch Page · Watch landing and detail route
app/(shared)/watch/page.tsx - Watch Detail · Dynamic title playback route
app/(shared)/watch/[id]/page.tsx - Chat Page · AI/chat interaction route
app/(shared)/chat/page.tsx - Static Pages · About, history, and policy pages
app/(shared)/about/page.tsx
Features
Major product areas and page-level subsystems
- Site Chrome · Navbar, sidebar, footer, and search controls
components/layout/Navbar.tsx - Discovery UI · Home browsing, category navigation, pagination, and history
components/home/HomeCardList.tsx - Catalog Cards · Reusable anime card and grid presentation
components/cards/CardGrid.tsx - Search & Filters · Search input, filters, and result shaping
components/layout/anime-search.tsx - Watch Metadata · Title data, episode lists, and season grouping
components/watch/AnimeDataList.tsx - Player Stack · Unified player, sources, iframe fallback, and loader
components/watch/video/UnifiedPlayer.tsx - Chat UI · Messages, placeholder states, and anime result cards
components/chat/ChatMessages.tsx - AI Stream · Streaming AI hooks and loading states
hooks/useAi.ts
Shared Foundation
Reusable chrome, UI kit, hooks, and helpers
- Theme System · Light/dark theme provider and toggle
components/theme-provider.tsx - UI Kit · Reusable inputs, cards, buttons, tables, badges, and alerts
components/ui/button.tsx - Loading Primitives · Skeleton and status components
components/skeletons/skeletons.tsx - Core Hooks · API, timing, mobile, and countdown behavior
hooks/useApi.ts - Shared Helpers · Common utilities and registry glue
lib/utils.ts
Assets & Types
Static assets and shared contracts
- Streaming Types · Data contract for video and stream sources
types/streaming.ts - Public Assets · Images and other static media
public
Connections 32
- App Root → Shared Shell: wraps · Root document provides the shared app shell
- Shared Shell → Theme System: provides · Shared shell wires theme behavior for the site
- Shared Shell → Site Chrome: renders · Persistent navigation and footer chrome
- Shared Shell → Home Page: hosts · Shared shell contains the main site routes
- Shared Shell → Search Page: hosts · Shared shell contains the main site routes
- Shared Shell → Trending Page: hosts · Shared shell contains the main site routes
- Shared Shell → Watch Page: hosts · Shared shell contains the main site routes
- Shared Shell → Watch Detail: hosts · Shared shell contains the main site routes
- Shared Shell → Chat Page: hosts · Shared shell contains the main site routes
- Shared Shell → Static Pages: hosts · Shared shell contains the support and policy routes
- Home Page → Discovery UI: composes · Home route is built from discovery modules
- Discovery UI → Catalog Cards: uses · Discovery lists render shared catalog cards
- Discovery UI → Core Hooks: fetches · Home browsing depends on client-side hooks
- Discovery UI → Public Assets: shows · Landing content can reference static imagery
- Search Page → Search & Filters: composes · Search route is centered on filter and query flow
- Search & Filters → Core Hooks: filters · Search state and query shaping use hooks
- Search & Filters → Catalog Cards: renders · Search results reuse catalog presentation
- Trending Page → Catalog Cards: renders · Trending route is presented as catalog cards
- Watch Page → Watch Metadata: composes · Watch route assembles title and episode metadata
- Watch Detail → Watch Metadata: loads · Dynamic watch page drives title-specific metadata
- Watch Detail → Player Stack: plays · Playback is delegated to the player stack
- Watch Metadata → Streaming Types: shapes · Episode and source data follow the streaming contract
- Player Stack → Streaming Types: consumes · Player stack consumes source definitions
- Player Stack → Loading Primitives: shows · Loader and placeholder states are shared primitives
- Chat Page → Chat UI: composes · Chat route is built from conversation UI
- Chat Page → AI Stream: streams · Chat page relies on AI response hooks
- Chat UI → AI Stream: uses · Message UI is driven by streaming response state
- AI Stream → Core Hooks: extends · AI flow depends on shared client behavior hooks
- Site Chrome → UI Kit: uses · Layout controls are built from the UI kit
- Site Chrome → Loading Primitives: uses · Chrome reuses loading/status primitives
- UI Kit → Shared Helpers: depends on · UI primitives share helper utilities
- Core Hooks → Shared Helpers: depends on · Runtime hooks share common helpers