The existing .github/workflows/deploy-pages.yml builds the Vite frontend and deploys dist to GitHub Pages.
The app uses hash routing on GitHub Pages. Use https://vrtxomega.github.io/coded/#/submit for the live submit page.
Set this non-secret repository variable if you want to override the default API URL:
CODED_API_URL: public API base URL, for examplehttps://coded-api.example.comorhttps://pop-os.tail43dc9a.ts.net/api
Do not set tokens with a VITE_ prefix. Vite embeds VITE_* values into browser JavaScript.
If CODED_API_URL is not set, production builds default to https://pop-os.tail43dc9a.ts.net/api. If that API is unavailable, submissions fall back to browser localStorage plus public GitHub API metadata.
Run the backend with:
npm run apiEnvironment variables:
CODED_API_PORT: optional port, defaults to8787CODED_API_HOST: optional bind host, defaults to127.0.0.1CODED_ADMIN_TOKEN: server-only token required for moderation endpointsGITHUB_CLIENT_ID: optional GitHub OAuth app client ID for no-scope owner verificationGITHUB_CLIENT_SECRET: optional GitHub OAuth app client secret for no-scope owner verificationGITHUB_TOKEN: optional server-only GitHub token for higher API limitsALLOWED_ORIGINS: comma-separated browser origins allowed by CORS, for examplehttps://vrtxomega.github.io,http://localhost:3000MAX_BODY_BYTES: optional request body cap, defaults to16384RATE_LIMIT_WINDOW_MS: optional write rate window, defaults to60000RATE_LIMIT_MAX: optional POSTs per window per IP, defaults to10
The backend stores submissions in data/coded.sqlite. It migrates old data/submissions.json data if the SQLite database is empty. The data/ directory is ignored by git.
GitHub OAuth sessions are also stored in data/coded.sqlite, not process memory, so a backend restart does not invalidate a current browser session. Session tokens expire after seven days by default. Set GITHUB_SESSION_TTL_MS on the backend host to shorten or lengthen that window.
Admin endpoints:
GET /api/admin/submissionsGET /api/admin/exportPOST /api/admin/submissions/:id/approvePOST /api/admin/submissions/:id/hidePOST /api/admin/submissions/:id/deletePOST /api/admin/submissions/:id/reanalyze
Send the token with:
X-Admin-Token: <CODED_ADMIN_TOKEN>
The live deployment includes a user timer:
coded-api-backup.timercoded-api-backup.service
It runs daily around 03:17 and writes timestamped archives to:
/home/vrtxomega/backups/coded-api
Each archive includes:
data/coded.sqliteadmin-token.txtcoded-api.servicecoded-api.service.d/secrets.conf
Archives older than 14 days are deleted by the backup script.
Manual backup:
systemctl --user start coded-api-backup.serviceList backups:
ls -lh /home/vrtxomega/backups/coded-api- Never commit
.envfiles, API keys, GitHub tokens, private keys, database passwords, or production data. - Never expose
GITHUB_TOKENthroughVITE_*, GitHub Pages variables, or client-side code. - Never expose
CODED_ADMIN_TOKENthroughVITE_*, GitHub Pages variables, or client-side code. - Keep tokens in the backend host secret store only.
CODED_API_URLis not a secret; it is safe to expose.- GitHub Pages cannot securely run server code or hold server secrets.
- Deploy the frontend with GitHub Pages.
- Deploy
server/index.mjsto a server host such as Render, Fly.io, Railway, a VPS, or a serverless Node host. - Set
GITHUB_TOKENonly on that backend host if higher GitHub API limits are needed. - Set
CODED_ADMIN_TOKENonly on that backend host. - Set
ALLOWED_ORIGINSto the GitHub Pages origin. - Add
CODED_API_URLas a GitHub repository variable, not a secret, so the Pages build points to the API. - Optional: create a GitHub OAuth app and set its callback URL to
<CODED_API_URL>/auth/github/callback, then setGITHUB_CLIENT_IDandGITHUB_CLIENT_SECRETonly on the backend host. The OAuth flow requests no repository scopes; public repo analysis uses public GitHub APIs.
The current OAuth app intentionally requests no repository scopes. That keeps the consent screen narrow and lets public repo analysis keep working with anonymous public GitHub APIs. With no repository scope, Coded can only verify direct owner submissions where the GitHub login matches the repository owner.
Move to a GitHub App when Coded needs organization ownership, collaborator/team checks, private repository analysis, or future write actions. Start with zero repository permissions for public-only identity flows. If repository access becomes necessary, request the smallest permission needed, such as Contents: Read-only for private repo analysis. Do not return to OAuth public_repo; it bundles read and write permissions and creates a worse consent screen.