Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Static JSON Data Store

Static JSON data store served as a read-only JSON API via GitHub Pages, fronted by the custom domain api.hyperweavers.com.

Purpose / idea: Commit plain .json files to this repo and fetch them over HTTPS with a simple GET, no server or database to maintain.

License: CC BY-NC-SA 4.0

How it works

  1. Add a JSON file anywhere in this repo, e.g. v1/products.json.
  2. Commit and push to the main branch.
  3. GitHub Pages serves it statically:
    • Default Pages URL: https://<org-or-user>.github.io/<repo>/<path>.json
    • Custom Domain (this repo): https://api.hyperweavers.com/<path>.json
    • Example: https://hyperweavers.github.io/data-store/products.json/https://api.hyperweavers.com/v1/products.json

Only GET is supported (static hosting). GitHub Pages serves JSON with Content-Type: application/json and Access-Control-Allow-Origin: *, so browsers and mobile apps can fetch() it directly from any origin.

Custom domain

The CNAME file at the repo root contains:

api.hyperweavers.com

This tells GitHub Pages to serve this repo from that hostname. Point the api subdomain at GitHub Pages with a CNAME DNS record (api → <org-or-user>.github.io) and enable Enforce HTTPS under repo Settings → Pages. See GitHub docs: Managing a custom domain.

The empty .nojekyll file disables Jekyll processing so files and folders (including _-prefixed ones) are served exactly as committed.

Local preview / validation

Windows

# validate every JSON file in the repo
Get-ChildItem -Recurse -Filter *.json | ForEach-Object { Get-Content $_.FullName -Raw | ConvertFrom-Json | Out-Null; Write-Host "OK $($_.FullName)" }

macOS

# validate every JSON file in the repo (python3 is preinstalled on macOS)
find . -name '*.json' -print0 | xargs -0 -n1 python3 -m json.tool > /dev/null && echo "All JSON valid"

# alternative if jq is installed (brew install jq):
find . -name '*.json' -exec jq empty {} \; && echo "All JSON valid"

Linux

# validate every JSON file in the repo (python3 is preinstalled on most distros)
find . -name '*.json' -print0 | xargs -0 -n1 python3 -m json.tool > /dev/null && echo "All JSON valid"

# alternative if jq is installed (apt install jq / dnf install jq / pacman -S jq):
find . -name '*.json' -exec jq empty {} \; && echo "All JSON valid"

Keep files small, UTF-8, and pretty-printed so diffs stay readable.

Contributing

Keep the API backward-compatible: prefer adding fields over renaming/removing them, and version breaking changes under a new top-level folder (e.g. /v2/).

License

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License — see LICENSE.

You may share and adapt the data with attribution for non-commercial purposes, provided you distribute derivatives under the same license.

About

Static JSON data store served as a read-only JSON API.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Used by

Contributors