# Aniplay API API for [Aniplay](https://github.com/silverAndroid/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](https://anilist.co) API. - **Drizzle ORM**: TypeScript ORM for D1 (Cloudflare's serverless SQL database). - **Vitest**: Testing framework. ## Prerequisites - **Node.js** - **pnpm**: Package manager. ## Getting Started 1. **Installation** ```bash pnpm install ``` 2. **Environment Setup** Generate the environment types: ```bash pnpm exec wrangler types ``` 3. **Database Setup** Apply migrations to the local D1 database: ```bash pnpm exec wrangler d1 migrations apply aniplay ``` ## Development ### Running Locally Start the development server: ```bash pnpm run dev ``` ### Testing Run the tests using Vitest: ```bash pnpm test ``` ## Deployment Deploy to Cloudflare Workers: ```bash 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/models`: Database schema and models - `src/scripts`: Utility scripts for maintenance and setup - `src/types`: TypeScript type definitions