GitHub Pages
GitHub Pages can serve the generated api-out/ folder as static files.
The current GitHub Pages flow is either:
- publish from a configured branch and folder
- or use a GitHub Actions workflow, which is the more flexible option for compiled output
Manual Deployment
If you use branch publishing, configure GitHub Pages to deploy from a branch and either the repository root or a /docs folder.
For a simple static output branch, you can push the generated files to a dedicated Pages branch:
git checkout --orphan gh-pages
git rm -rf .
cp -R api-out/. .
touch .nojekyll
git add .
git commit -m "Publish API output"
git push origin gh-pages
Your endpoints will be publicly accessible at:
https://username.github.io/repo-name/users/1/index.json
Git Integration
GitHub Pages now supports either a publishing source or a custom GitHub Actions workflow.
If you choose branch publishing, GitHub lets you select any branch as the source and either the repository root or a /docs folder as the publishing folder. Every push to that source republishes the site.
Automation with GitHub Actions
For compiled output, the current recommended flow is GitHub Actions.
Example workflow:
name: Deploy StatikAPI to GitHub Pages
on:
push:
branches: [main]
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/configure-pages@v5
- name: Build API
run: npx statikapi build
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: ./api-out
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
This workflow builds api-out/, uploads it as a Pages artifact, and deploys it with the official Pages actions.
Considerations
- Best for small APIs, demos, and documentation datasets.
- GitHub Pages has a recommended source repository limit of 1 GB, a published site limit of 1 GB, and a 10-minute deploy timeout.
- A custom GitHub Actions workflow does not count against the normal Pages build-per-hour limit.
- For larger or dynamic datasets, consider using Cloudflare R2, Amazon S3, or another CDN-backed object storage.
- You can also host your APIs directly with StatikAPI Cloud (coming soon) — a managed hosting platform with automatic builds, caching, and versioned JSON hosting.