Skip to content

feat: Convert ReVanced API from a Ktor server to serverless#211

Merged
oSumAtrIX merged 35 commits intoReVanced:devfrom
mostafaNazari702:dev
Mar 7, 2026
Merged

feat: Convert ReVanced API from a Ktor server to serverless#211
oSumAtrIX merged 35 commits intoReVanced:devfrom
mostafaNazari702:dev

Conversation

@mostafaNazari702
Copy link

No description provided.

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.
Copy link
Member

@validcube validcube left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consistency problem

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oSumAtrIX Is it fine committing this directly to source? Note there's an about.example.json in the root of this repository.

@oSumAtrIX oSumAtrIX force-pushed the dev branch 2 times, most recently from 9433362 to 2dda0d5 Compare March 6, 2026 19:59
mostafaNazari702 and others added 6 commits March 7, 2026 00:24
- 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.
@oSumAtrIX oSumAtrIX changed the title Convert ReVanced API from a Ktor Server to Serverless feat: Convert ReVanced API from a Ktor server to serverless Mar 7, 2026
@oSumAtrIX oSumAtrIX merged commit 4fe8a96 into ReVanced:dev Mar 7, 2026
@welcome
Copy link

welcome bot commented Mar 7, 2026

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))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants