Skip to main content

Overview

EpiNeko provides a comprehensive profile system where users can view their anime statistics, manage account settings, and track their viewing habits. The profile system is built on Supabase Auth with custom profile data stored in a separate profiles table.

Profile Dashboard

View personalized stats and viewing analytics

Account Settings

Update profile information and preferences

Library Stats

Track progress across different watch statuses

Activity Summary

Monitor viewing efficiency and completion rates

Profile Structure

User profiles extend Supabase Auth with additional metadata:
Database Schema (supabase/migrations/20260218_initial_schema.sql:2-11):

Profile Statistics

Calculated Metrics

The profile page calculates real-time statistics from your library:
Implementation (src/app/profile/page.tsx:48-56):

Viewing Efficiency

Track completion rate as a percentage:
Display (src/app/profile/page.tsx:157-163):
  • Large percentage display
  • “completado versus total” subtitle
  • Visual prominence on profile page

Profile Page Components

Profile Card

The left sidebar displays user identity and basic info:
1

Avatar

Gradient-bordered circular avatar with fallback to first letter of name
2

Display Name

Shows full_name or email username as fallback
3

Username

Displays @username handle
4

Member Since

Shows account creation date in Spanish format
5

Edit Button

Links to settings page for profile updates
Code Reference (src/app/profile/page.tsx:92-132):

Statistics Cards

Four summary cards showing key metrics:

Total Animes

Total count of all library itemsIcon: 📊

Viendo

Currently watching countIcon: 📺

Completado

Completed series countIcon: ✅

Pendiente

Plan to watch countIcon: ⏳
Component (src/app/profile/page.tsx:195-202):

Activity Summary

Visual progress bars showing distribution across statuses:

Quick Navigation

Two action cards linking to main sections:
  1. Mi Biblioteca - Navigate to library page
  2. Descubrir - Navigate to discovery/homepage
Design (src/app/profile/page.tsx:168-187):
  • Hover effects with color transitions
  • Icon arrows with background color change
  • Subtle descriptions of each section

Settings Page

Editable Profile Fields

Users can update their profile information:
string
required
Unique identifier, minimum 3 charactersValidation: Database constraint enforces uniqueness and length
string
Display name shown throughout the app
string
Optional personal website URL
string
URL to profile picture image

Updating Profile

Profile updates use Supabase upsert for insert-or-update:
Implementation Details (src/app/settings/page.tsx:57-82):
  • Uses upsert to handle both insert and update
  • Updates updated_at timestamp automatically
  • Displays success/error messages to user
  • Disables button during save operation

Form Components

Settings form with controlled inputs:
Features (src/app/settings/page.tsx:113-169):
  • Username field with validation hint
  • Email field (disabled, cannot be changed)
  • Save button with loading state
  • Success/error alert messages
  • Back to profile navigation button

Security Features

Row-Level Security

Profile access is controlled by PostgreSQL policies:
Security Guarantees (supabase/migrations/20260218_initial_schema.sql:16-23):
  • Users cannot modify other users’ profiles
  • Profile creation is automatic via trigger
  • All operations validated at database level

Automatic Profile Creation

New users automatically get a profile via database trigger:
How It Works (supabase/migrations/20260218_initial_schema.sql:26-42):
  1. User signs up via Supabase Auth
  2. Trigger fires after user creation
  3. Profile row is automatically inserted
  4. Metadata from signup is copied to profile

Authentication Flow

Checking Login Status

Profile and settings pages verify authentication:
Implementation (src/app/profile/page.tsx:76-83):
  • Checks for authenticated user
  • Shows login prompt if not authenticated
  • Displays loading spinner during check

Fetching User Data

Combine auth data with profile data:

Loading States

Both pages implement proper loading states:

Message System

Settings page shows feedback messages:
Display (src/app/settings/page.tsx:153-158):

Best Practices

Username Validation

Validate username format client-side before submission

Optimistic Updates

Update UI immediately while save is in progress

Error Handling

Display user-friendly error messages for all failure cases

Loading States

Always show loading indicators during async operations