Aniplay API
API for Aniplay, built with Cloudflare Workers, Hono, and Drizzle ORM.
Tech Stack
- Cloudflare Workers: Serverless execution environment.
- Hono: Ultrafast web framework (OpenAPI).
- GraphQL: Used internally for communicating with the AniList API.
- Drizzle ORM: TypeScript ORM for D1 (Cloudflare's serverless SQL database).
- Vitest: Testing framework.
Prerequisites
- Node.js
- pnpm: Package manager.
Getting Started
-
Installation
pnpm install -
Environment Setup Generate the environment types:
pnpm exec wrangler types -
Database Setup Apply migrations to the local D1 database:
pnpm exec wrangler d1 migrations apply aniplay
Development
Running Locally
Start the development server:
pnpm run dev
Testing
Run the tests using Vitest:
pnpm test
Deployment
Deploy to Cloudflare Workers:
pnpm run deploy
Project Structure
src/controllers: API route handlers (titles, episodes, search, etc.)src/libs: Shared utilities and logic (AniList integration, background tasks)src/middleware: Middleware handlers (authentication, authorization, etc.)src/models: Database schema and modelssrc/scripts: Utility scripts for maintenance and setupsrc/types: TypeScript type definitions
Description
Languages
TypeScript
100%