Overview
EpiNeko uses PostgreSQL via Supabase with two main tables:profiles for user information and user_library for tracking anime in user libraries.
The complete schema is defined in
supabase/migrations/20260218_initial_schema.sql:1Tables
profiles
Stores user profile information. Automatically populated when a new user signs up via thehandle_new_user() trigger.
Columns
uuid
required
Primary key. References
auth.users.id. Automatically deleted when user is deleted (cascade).timestamp with time zone
Timestamp of last profile update
text
Unique username for the user. Must be at least 3 characters long.
text
User’s full name or display name
text
URL to user’s avatar/profile picture
text
User’s personal website or social media link
Constraints
Example Queries
user_library
Stores anime in each user’s personal library with status, score, and progress tracking.Columns
uuid
required
Primary key. Automatically generated using
gen_random_uuid().uuid
required
Foreign key to
profiles.id. The owner of this library item.integer
required
The MyAnimeList ID from Jikan API. Used to identify the anime.
text
required
Cached anime title for quick display without API calls.
text
Cached image URL for the anime poster/cover.
library_status
default:"watching"
required
Current status:
watching, completed, dropped, or plan_to_watch.integer
User’s rating from 0-10. Optional.
integer
default:0
Number of episodes the user has watched.
timestamp with time zone
required
When the anime was added to the library. Defaults to current UTC time.
timestamp with time zone
required
Last time the library item was modified. Defaults to current UTC time.
library_status Enum
enum
Currently watching this anime
enum
Finished watching this anime
enum
Started but stopped watching
enum
Intend to watch in the future
Constraints
Indexes
The schema should include these indexes for optimal performance:Example Queries
Relationships
Relationship Details
Database Triggers
handle_new_user()
Automatically creates a profile when a new user signs up.This trigger extracts user metadata from the signup form and populates the profile automatically. No manual profile creation needed!
Security
All tables have Row Level Security (RLS) enabled. See Row Level Security for details on policies.Best Practices
Migration
The complete schema is defined in a single migration file:Related Resources
Row Level Security
Learn about RLS policies
Supabase Integration
How to use Supabase clients
Library Service
High-level library operations
Supabase CLI
Managing migrations