From c527a6eac5f314ac2022a89f48a8435bb3a1ac87 Mon Sep 17 00:00:00 2001 From: Rushil Perera Date: Wed, 17 Dec 2025 06:52:58 -0500 Subject: [PATCH] docs: expand README with detailed setup, tech stack, development, and project structure. --- README.md | 75 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 67 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 65aca36..7dd5c5a 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,71 @@ -``` -npm install -npm run dev -``` +# Aniplay API -``` -npm run deploy -``` +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 -If a route is internal-only or doesn't need to appear on the OpenAPI spec (that's autogenerated by Hono), use the `Hono` class. Otherwise, use the `OpenAPIHono` class from `@hono/zod-openapi`. +### 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