Anime watchlist tracker based off Kitsu.io
This also includes a RESTful CRUD API for the following resources:
/api/users
GET
: (protected) Get the user information of an authenticated user via authorization tokensGET
: Get users based on the following search parameters ordered by relevancesearch: string
- Return users with usernames prefixed with the search stringexcludeWatchlistId: string
- Return users that are not already collaborators of this watchlistlimit: string
- Return this many users/api/users/:username
GET
: Get public user information associated with the user. For now, this is just the user id and username/api/users/:username/watchlists
GET
: Get the public watchlists associated with the user by their username. For an authenticated user, this would include any private watchlists for that specific user as well. This accepts two query parameters:editable: boolean
- Return watchlists that the user can edit.
If the requester is not the requested, this will always be true (outsiders cannot see watchlists for a viewer)overview: boolean
- Return watchlist overviews instead of base watchlists (i.e., includes some anime and collaborator information)/api/users/:username/anime
GET
: (protected) Get all anime related to user (rated, marked status, added to watchlist)/api/anime
GET
: Search and return a collection of anime, given query parameters/api/anime/:animeId
GET
: Retrieve the anime resource given the associated anime id. Also include any associated resources associated with this anime and an authenticated user (user ratings, watch status, watchlists added)PATCH
: (protected) Update anime status associated with the user (ratings, watch status)DELETE
: (protected) Remove anime status associated with the user (ratings, watch status)/api/watchlists
GET
: Search and return a collection of public watchlists, given query parameters. For an authenticated user, this would include any private watchlists for that specific user as well.POST
: (protected) Create a new watchlist./api/watchlists/:watchlistId
GET
: Retrieve the watchlist resource given the associated watchlist id.PUT
: (protected) Update the watchlist metadata (name, description, public)DELETE
: (protected) Delete the watchlist/api/watchlists/:watchlistId/users
GET
: Get collaborators for the watchlistPOST
: (protected) Add collaborators to the watchlist (editor, viewer). This accepts two request body formats:{ userId: string, role: 'editor' | 'viewer' }
- Add a single user{ users: { userId: string, role: 'editor' | 'viewer' }[] }
- Add multiple users/api/watchlists/:watchlistId/users/:userId
PATCH
: (protected) Update collaborator role in the watchlistDELETE
: (protected) Remove a collaborator from the watchlist/api/watchlists/:watchlistId/anime
GET
: Get anime associated with the watchlistPOST
: (protected) Add an anime to the watchlist/api/watchlists/:watchlistId/anime/:animeId
DELETE
: (protected) Remove the anime from the watchlistThis leverages Postgres features extensively, including using JSON validation, row-level security policies, full text search, and others. The data schema is as follows:
anime
: Saved anime resources from Kitsu (used to minimize dependency on Kitsu for watchlists)users
: User profile information that is publicly accessible. Note id
links to the UUID auth.users.id
columnuser_reviews
: User reviews on anime watch status and ratingswatchlists
: User anime watchlistswatchlists_anime
: Anime added to watchlistswatchlists_users
: Users (collaborators) added to watchlists as owner
, editor
, or viewer
# Install the node version assigned in .nvmrc
nvm install
# Enables corepack to set the pnpm version
corepack enable
# Install the pnpm version set by the `packageManager` field in `package.json`
corepack install
pnpm
:pnpm install
Copy .env.example
into .env
and add the configured supabase credentials.
Once supabase credentials are set up, run the following to generate the correct up-to-date types:
# Login to supabase and get credentials
pnpm db:login
# Generate types
pnpm gen:types
pnpm dev