Rust backend for a GitHub-backed CMS. It exposes allowlisted UTF-8 content, creates a draft pull request per editing session, and pushes session commits using the authenticated GitHub user's GitHub App user token.
- Copy
cms.example.tomltocms.tomland set the repository/content values. - Copy
.env.exampleto.envand provide the GitHub App and CMS JWT secrets. - Register the GitHub App user authorization callback as
http://localhost:3000/auth/github/callback(or your configured public URL). - Run
cargo run.
The frontend directory contains a small Vite-based editor. It handles the
GitHub sign-in callback, keeps the CMS JWT in browser local storage, and creates
a draft session automatically when the user first saves a file.
In a second terminal, run:
cd frontend
npm install
npm run devOpen http://localhost:5173. The supplied cms.example.toml already uses
http://localhost:5173/auth/callback as its frontend_callback_url.
Start authorization at GET /auth/github/start. The callback redirects to
server.frontend_callback_url?token=<cms-jwt>; the frontend sends that token
as Authorization: Bearer <cms-jwt> to /api/*.
The app installation needs repository read access for startup cloning. Users need repository write access for session branch pushes and pull request changes. No GitHub token is saved in repository configuration; user credentials are held only in process memory, so signing in again is required after a backend restart.