feat: Convert ReVanced API from a Ktor server to serverless#211
Merged
oSumAtrIX merged 35 commits intoReVanced:devfrom Mar 7, 2026
Merged
feat: Convert ReVanced API from a Ktor server to serverless#211oSumAtrIX merged 35 commits intoReVanced:devfrom
oSumAtrIX merged 35 commits intoReVanced:devfrom
Conversation
Set up the new project scaffold targeting Cloudflare Workers with Hono as the web framework, TypeScript, and Wrangler as dev toolchain. - package.json: Runtime deps (hono, @hono/zod-openapi, @hono/swagger-ui, drizzle-orm, zod) and dev deps (@cloudflare/workers-types, drizzle-kit, typescript, wrangler). Scripts for dev, deploy, and D1 migrations. - tsconfig.json: ESNext target/module, Bundler resolution, strict mode, Hono JSX, @cloudflare/workers-types, @/* path alias. - wrangler.toml: Entry src/index.ts, D1 binding, all non-secret config as [vars] (replacing configuration.example.toml). - types.ts: Env interface for all Cloudflare Worker bindings. - .gitignore: Rewritten for Node.js/Workers. - .env.example: Updated for bearer token auth model.
Port the backend interface pattern from the original Kotlin BackendRepository and GitHubBackendRepository to TypeScript. - backend.ts: Backend interface with release(), fileContent(), contributors(), members(), rateLimit() and supporting data interfaces. - github.ts: GitHubBackend class using native fetch() against api.github.com and raw.githubusercontent.com. Optional GITHUB_TOKEN auth. Parallel member detail + GPG key fetching. Datetime formatting strips timezone suffixes.
Replace Exposed ORM / H2 with Drizzle ORM targeting Cloudflare D1 (SQLite). - schema.ts: announcements table (id, author, title, content, created_at, archived_at, level). Attachments and tags tables removed — attachments were deprecated, tags removed to enable full edge caching. - client.ts: createDb() factory wrapping D1 with Drizzle. - drizzle.config.ts: SQLite dialect, migrations to ./drizzle/migrations. - 0000_initial.sql: Generated CREATE TABLE migration.
Replace JWT + Digest auth with simple environment-token bearer auth. - auth.ts: Middleware validates Authorization: Bearer <token> against API_TOKEN env var. Returns 401 for missing/malformed, 403 for invalid. Applied selectively to non-GET announcement requests.
Define request/response schemas using Zod with @hono/zod-openapi for automatic OpenAPI 3.1 specification generation, replacing Kotlin @serializable data classes from APISchema.kt. - common.ts: PrereleaseQuery, ErrorResponse, IdParam. - announcements.ts: CRUD schemas with snake_case fields. - contributors.ts: Contributor, Contributable, TeamMember, GpgKey schemas. - releases.ts: Release, Version, History, PublicKey, RateLimit responses.
Port all route handlers to Hono OpenAPIHono with createRoute() and mount
in the main entry point with Swagger UI at root.
- index.ts: Mount routes under /v1/*, OpenAPI spec at /openapi, Swagger at /.
- patches.ts: GET /, /version, /history, /keys (no /list — JVM dep removed).
- manager.ts: GET /, /version, /history, /downloaders, /downloaders/version.
- announcements.ts: GET /, GET /{id}, POST / (auth), PATCH /{id} (auth),
DELETE /{id} (auth). Returns full list for edge caching.
- contributors.ts, team.ts, about.ts, ping.ts, rate-limit.ts.
- about.json: Static data file replacing runtime config file reading.
GitHub Actions workflow for Cloudflare Workers deployment, replacing the previous semantic-release + Docker publish pipeline. - Triggers on push to main and dev branches. - Node.js 20 setup, npm ci, D1 remote migrations, wrangler deploy. - Requires CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID secrets.
Rewrite README for the Hono/Cloudflare Workers implementation. - Quick start with npm install, D1 migration, wrangler dev. - Endpoint table with auth indicators. - Config via wrangler.toml and wrangler secret put. - Deploy via npm run deploy. - Removed Docker, JRE, Gradle instructions and branding header.
PalmDevs
reviewed
Mar 2, 2026
PalmDevs
reviewed
Mar 2, 2026
PalmDevs
reviewed
Mar 2, 2026
PalmDevs
reviewed
Mar 2, 2026
validcube
reviewed
Mar 2, 2026
PalmDevs
reviewed
Mar 2, 2026
PalmDevs
reviewed
Mar 2, 2026
PalmDevs
reviewed
Mar 2, 2026
PalmDevs
reviewed
Mar 2, 2026
PalmDevs
reviewed
Mar 2, 2026
PalmDevs
reviewed
Mar 2, 2026
PalmDevs
reviewed
Mar 2, 2026
PalmDevs
reviewed
Mar 2, 2026
PalmDevs
reviewed
Mar 2, 2026
PalmDevs
reviewed
Mar 2, 2026
PalmDevs
reviewed
Mar 2, 2026
PalmDevs
reviewed
Mar 2, 2026
src/data/about.json
Outdated
Member
There was a problem hiding this comment.
@oSumAtrIX Is it fine committing this directly to source? Note there's an about.example.json in the root of this repository.
PalmDevs
reviewed
Mar 2, 2026
PalmDevs
reviewed
Mar 2, 2026
PalmDevs
reviewed
Mar 2, 2026
PalmDevs
reviewed
Mar 2, 2026
9433362 to
2dda0d5
Compare
- Replace custom cacheControl() with Hono's built-in cache() middleware - Export edgeCache() helper wrapping cache() from hono/cache - Fix about.json import path (about.json -> ../../data/about.json) - Remove unused cacheControl import from manager route
Drop hono/cache and Cache API usage. Restore original cacheControl() pattern — just sets Cache-Control header before next(). Remove redundant s-maxage since Cloudflare respects max-age for edge caching.
|
Thank you for contributing to ReVanced. Join us on Discord to receive a role for your contribution. |
oSumAtrIX
added a commit
that referenced
this pull request
Mar 7, 2026
Co-Authored-By: oSumAtrIX <johan.melkonyan1@web.de>
github-actions bot
pushed a commit
that referenced
this pull request
Mar 7, 2026
# [1.7.0-dev.4](v1.7.0-dev.3...v1.7.0-dev.4) (2026-03-07) ### Features * Convert ReVanced API from a Ktor server to serverless ([#211](#211)) ([5e0378b](5e0378b))
github-actions bot
pushed a commit
that referenced
this pull request
Mar 7, 2026
# [1.7.0-dev.4](v1.7.0-dev.3...v1.7.0-dev.4) (2026-03-07) ### Features * Convert ReVanced API from a Ktor server to serverless ([#211](#211)) ([5e0378b](5e0378b))
oSumAtrIX
added a commit
that referenced
this pull request
Mar 7, 2026
Co-Authored-By: oSumAtrIX <johan.melkonyan1@web.de>
github-actions bot
pushed a commit
that referenced
this pull request
Mar 7, 2026
# [1.7.0-dev.4](v1.7.0-dev.3...v1.7.0-dev.4) (2026-03-07) ### Features * Convert ReVanced API from a Ktor server to serverless ([#211](#211)) ([5e8508a](5e8508a))
oSumAtrIX
added a commit
that referenced
this pull request
Mar 7, 2026
Co-Authored-By: oSumAtrIX <johan.melkonyan1@web.de>
github-actions bot
pushed a commit
that referenced
this pull request
Mar 7, 2026
# [1.7.0-dev.4](v1.7.0-dev.3...v1.7.0-dev.4) (2026-03-07) ### Features * Convert ReVanced API from a Ktor server to serverless ([#211](#211)) ([4c900a2](4c900a2))
oSumAtrIX
added a commit
that referenced
this pull request
Mar 7, 2026
Co-Authored-By: oSumAtrIX <johan.melkonyan1@web.de>
github-actions bot
pushed a commit
that referenced
this pull request
Mar 7, 2026
# [1.7.0-dev.4](v1.7.0-dev.3...v1.7.0-dev.4) (2026-03-07) ### Features * Convert ReVanced API from a Ktor server to serverless ([#211](#211)) ([0a0e002](0a0e002))
oSumAtrIX
added a commit
that referenced
this pull request
Mar 7, 2026
Co-Authored-By: oSumAtrIX <johan.melkonyan1@web.de>
github-actions bot
pushed a commit
that referenced
this pull request
Mar 7, 2026
# [1.7.0-dev.4](v1.7.0-dev.3...v1.7.0-dev.4) (2026-03-07) ### Features * Convert ReVanced API from a Ktor server to serverless ([#211](#211)) ([2ba8849](2ba8849))
github-actions bot
pushed a commit
to mostafaNazari702/revanced-api
that referenced
this pull request
Mar 9, 2026
# [1.7.0-dev.1](v1.6.1...v1.7.0-dev.1) (2026-03-09) ### Features * Add `downloaders` route ([ReVanced#208](https://github.com/mostafaNazari702/revanced-api/issues/208)) ([64f9431](64f9431)) * Add history route ([f0c9d4b](f0c9d4b)) * Convert ReVanced API from a Ktor server to serverless ([ReVanced#211](https://github.com/mostafaNazari702/revanced-api/issues/211)) ([2ba8849](2ba8849))
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.