How shreyasuday/reccoflix works
1. Overall shape
ReccoFlix is a server-rendered Node.js/Express application with a classic three-layer flow: browser requests hit Express, Express renders EJS views, and data is pulled from PostgreSQL and the external Kitsu anime API.
2. Entry point and request routing
index.js is the application entry point. It is likely where the Express app, middleware, routes, auth setup, static asset serving, and server listen call are composed into one request pipeline.
3. Database boundary
db.js centralizes PostgreSQL access. The app persists user accounts, sessions, and anime library state in Postgres rather than in-memory, which is what makes login state and user lists survive restarts.
4. Schema and maintenance scripts
schema.sql defines the initial database structure, while update_schema.js, update_schema_safe.js, and add_reset_columns.js are schema-evolution utilities. This suggests the app has had iterative changes to support features like password reset and user-library tracking.
5. Authentication subsystem
The readme and page set indicate two auth paths: local email/password login and Google OAuth. Authentication is session-based, so the browser holds a session cookie and the server uses that session to identify the current user across requests.
6. User and profile data flow
After authentication, the app routes users to profile-oriented pages such as views/profile.ejs. That profile area is the main hub for account-specific data, especially the anime library and any user metadata returned from the auth provider or local account record.
7. Anime discovery and catalog browsing
Browse/home/category pages (home.ejs, browse.ejs, category.ejs) present anime lists fetched from Kitsu. These pages are primarily read-only discovery surfaces that transform API data into cards, filters, and category views.
8. Search and detail pipeline
search.ejs and description.ejs represent a search-to-detail flow: the user searches titles, selects a result, and lands on a detail page with synopsis, ratings, episode counts, and franchise/related metadata from Kitsu.
9. Personal library subsystem
The key application-specific feature is the tracked anime library. Users can classify titles into statuses like Watched, Watching, Planned, On Hold, and Dropped, and then update or remove entries later from the profile/library UI.
10. Frontend assets
public/js/main.js provides client-side interactivity, likely for actions such as search behavior, status selection, and UI updates without a full page refresh. public/styles/main.css, fonts, and images are the static presentation layer shared across all templates.
11. Template composition
The app uses EJS partials (views/partials/header.ejs, footer.ejs) to share layout chrome across pages. This keeps navigation, auth links, and footer/legal content consistent while each page template focuses on its own data binding.
12. Supporting pages and legal flow
about.ejs, privacy.ejs, terms.ejs, login.ejs, register.ejs, forgot-password.ejs, and reset-password.ejs show that the application includes both onboarding and account-recovery flows, alongside informational/legal pages. These are separate from the discovery/library paths but share the same rendering and session/auth infrastructure.
Main entry points: index.js Entry · profile.ejs Profile · db.js Postgres · header.ejs Layout
Components 20
Application
Runtime request handling and orchestration
- Entry · Application bootstrap and request pipeline
index.js - Auth · Local login, Google OAuth, and session handling
- Pages · Page routing and server-side rendering coordination
Data
Persistence and external content sources
- Postgres · Central PostgreSQL connection and queries
db.js - Schema · Base database schema definition
schema.sql - Migrations · Database evolution scripts for new columns and fixes
update_schema.js - Kitsu API · Anime catalog and metadata source
UI
Rendered templates and client assets
User Flows
Main page-level experiences
- Home · Landing page for featured anime
views/home.ejs - Browse · Broad anime browsing and filtering
views/browse.ejs - Category · Genre or category-based listing
views/category.ejs - Search · Title search and result selection
views/search.ejs - Detail · Anime synopsis, ratings, and related metadata
views/description.ejs - Profile · Account hub and tracked anime library
views/profile.ejs - Login · Sign-in form for local and OAuth users
views/login.ejs - Register · Account creation flow
views/register.ejs - Recovery · Password reset request and reset pages
views/forgot-password.ejs - Legal · About, privacy, and terms pages
views/about.ejs
Connections 28
- Entry → Auth: initializes · Wires authentication and session flow into the app
- Entry → Pages: serves · Main server entry dispatches page requests
- Entry → Postgres: connects · Uses PostgreSQL for persisted state
- Entry → Layout: renders · All pages share common EJS chrome
- Pages → Home: renders · Serves the landing experience
- Pages → Browse: renders · Serves catalog browsing
- Pages → Category: renders · Serves category views
- Pages → Search: renders · Serves search results
- Pages → Detail: renders · Serves title detail pages
- Pages → Profile: renders · Serves the authenticated account hub
- Pages → Login: renders · Serves sign-in form
- Pages → Register: renders · Serves sign-up form
- Pages → Recovery: renders · Serves reset and recovery pages
- Pages → Legal: renders · Serves informational and policy pages
- Profile → Postgres: reads/writes · Persists user accounts, sessions, and library entries
- Profile → Kitsu API: enriches · Combines saved library data with anime metadata
- Home → Kitsu API: fetches · Loads featured anime lists
- Browse → Kitsu API: fetches · Loads browseable catalog data
- Category → Kitsu API: fetches · Loads category-filtered catalog data
- Search → Kitsu API: queries · Searches anime titles and returns matches
- Detail → Kitsu API: fetches · Loads synopsis, ratings, and related titles
- Auth → Postgres: stores · Persists users and session-linked state
- Schema → Postgres: defines · Initial database structure for the app
- Migrations → Schema: evolves · Updates the database shape over time
- Layout → Styles: loads · Shared templates are styled by the global stylesheet
- Layout → Client JS: boots · Shared chrome includes client-side behavior
- Client JS → Profile: enhances · Supports interactive library actions on the client
- Client JS → Search: enhances · Supports search interaction and UI updates