Add Bunny Edge deployment with edge runtime implementation#356
Closed
stefan-burke wants to merge 2 commits into
Closed
Add Bunny Edge deployment with edge runtime implementation#356stefan-burke wants to merge 2 commits into
stefan-burke wants to merge 2 commits into
Conversation
Port the entire Pages CMS application to run on Bunny Edge Scripting (Deno 2.x). This creates a parallel deployment target alongside the existing Next.js/Vercel setup. Key changes: - edge/ directory with complete API route handlers ported from Next.js - Custom HTTP router with pattern matching (based on tickets project) - libsql/Turso database support replacing PostgreSQL/Drizzle ORM - Session-based auth replacing Lucia (no Next.js cookie dependency) - Lightweight GitHub API client replacing heavy octokit npm package - esbuild build script that bundles API + inlined frontend assets - Bunny Edge entry point (BunnySDK.net.http.serve) + Deno dev server - GitHub Actions workflow for automated deployment to Bunny - next.config.mjs updated to support static export via BUNNY_BUILD env https://claude.ai/code/session_01HvJvQSNapUyFfxaiPpapjH
- Add 8 test files covering auth, crypto, env, file-utils, middleware, octokit, router, and schema modules (71 tests total, all passing) - Switch test imports from deno.land to JSR @std/assert - Fix router compilePattern to use single-pass replacement, preserving correct param name ordering when mixing :params and *catch-all - Update deno.json with @std/assert dependency and test task https://claude.ai/code/session_01HvJvQSNapUyFfxaiPpapjH
Author
|
whoops, i did not mean to create this in the main pagescms repo, my bad |
Owner
|
I recommend you work form the development branch, I have made a LOT of changes in that new version. It will be released this week. It introduces new features, upgrades across the board (new auth, Next.js 16, latest shadcn/ui, updated UI/UX) and a ton of bug fixes. |
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.
Summary
This PR adds a complete edge runtime implementation of Pages CMS designed to run on Bunny Edge Scripting (Deno 2.x based). The entire application—API routes and frontend—is bundled into a single deployable file for edge network execution.
Key Changes
Edge Runtime Architecture: New
edge/directory containing a complete reimplementation of the Pages CMS API and frontend serving layer optimized for edge runtimesCore Libraries:
edge/lib/auth.ts: Session-based authentication with Web Crypto API for session ID generationedge/lib/octokit.ts: Lightweight GitHub API client using direct fetch calls instead of the Octokit libraryedge/lib/github-cache.ts: File cache management with raw SQL queries for libsqledge/lib/token.ts: GitHub token management for both OAuth and GitHub App installation tokensedge/lib/crypto.ts: AES-GCM encryption/decryption using Web Crypto APIedge/lib/db/client.ts: libsql database client with query helpersedge/lib/file-utils.ts: File path utility functionsedge/middleware.ts: CSRF protection and security headersAPI Routes: Complete port of Next.js API routes to edge-compatible handlers
edge/routes/auth.ts(GitHub OAuth flow)edge/routes/files.ts(create/update/delete)edge/routes/repos.ts,edge/routes/branches.tsedge/routes/entries.ts,edge/routes/collections.ts,edge/routes/media.tsedge/routes/webhook.ts(GitHub webhook handling)edge/routes/history.ts,edge/routes/rename.ts,edge/routes/collaborators.ts,edge/routes/cron.tsRouter & Entry Points:
edge/router.ts: Declarative HTTP router with pattern matching and typed route parametersedge/routes/index.ts: Main route dispatcher with O(1) prefix dispatchedge/entry.ts: Bunny Edge Script entry pointedge/server.ts: Deno development server entry pointBuild System:
scripts/build-edge.ts: Build script that bundles edge entry point with inlined frontend assets into a single deployable filedeno.json: Deno configuration with tasks for development and building.github/workflows/bunny-deploy.yml: GitHub Actions workflow for Bunny Edge deploymentDatabase:
edge/lib/db/schema.ts: SQLite DDL migrations (mirrors PostgreSQL schema)edge/lib/db/migrations.ts: Migration runner for libsqlTesting: Comprehensive test suite for edge runtime components
edge/test/router_test.ts: Router pattern matching testsedge/test/auth_test.ts: Session management testsedge/test/octokit_test.ts: GitHub API client testsedge/test/file_utils_test.ts: File utility function testsedge/test/middleware_test.ts: CSRF and security header testsedge/test/crypto_test.ts: Encryption/decryption testsedge/test/schema_test.ts: Database schema testsedge/test/env_test.ts: Environment variable abstraction testsDocumentation:
edge/README.mdwith architecture overview and deployment guideConfiguration: Updated
next.config.mjsto support static export whenBUNNY_BUILD=trueNotable Implementation Details
https://claude.ai/code/session_01HvJvQSNapUyFfxaiPpapjH