Pseudo-REST Static API Generator β Compile raw JSON datasets into structured, production-ready static API endpoints deployable directly to cost-effective, infinitely scalable CDNs (GitHub Pages, Cloudflare Pages, Netlify, AWS S3, etc.).
fauxrest is a zero-maintenance, blazingly fast command-line utility written in Rust. It eliminates the need for dynamic server processes (such as Node.js or Python) and databases for read-only APIs, enabling infinite scalability and sub-millisecond response times at zero hosting cost.
- Two Configuration Tiers: From zero-config auto-inference (Tier 1) to shorthand JSON routes (Tier 2).
- Flexible Routing Patterns: Support Single Object, Collections (Lists), Item Details (via URL parameters), and Grouping transformations out of the box.
- Advanced Data Cleaning: Deep JSONPath extraction, along with robust sanitization using
pick(allowlist) andomit(denylist). - Multi-Platform Target Formats: Output formats tailored for all static hosting environments, supporting trailing slashes, directory index resolutions, extensionless files, or fully bundled files.
- Asset Bundling & Path Rewriting: Scans compilation output for local asset references (e.g., images), copies them to the distribution folder, and rewrites path links safely.
To install fauxrest into your local environment, type the following command.
# install fauxrest
brew install tamada/tap/faurestFauxrest also supports container images distributed on Quay.io. Use it with the following command (in the following example, we use docker; however, podman, finch, and/or apple/container might be supported).
docker run -it --rm -v $PWD:/opt quay.io/tama5/faurest:latest Options and arguments should follow the above command.
To compile fauxrest from source, ensure you have Rust installed.
# Clone the repository
git clone https://github.com/username/fauxrest.git
cd fauxrest
# Build in release mode
cargo build --releaseThe compiled binary will be located in target/release/fauxrest.
No configuration files are needed. Organize your JSON data into a directory:
data/
βββ profile.json # direct single object
βββ users.json # list of user objects with "id"
Then run fauxrest:
fauxrest data -d distfauxrest will scan ./data, infer the routes, and output:
dist/
βββ profile/
β βββ index.json # Resolves to /profile
βββ users/
βββ index.json # Resolves to /users
βββ 1/
β βββ index.json # Resolves to /users/1 (derived from ID)
βββ 2/
βββ index.json # Resolves to /users/2 (derived from ID)
- Object files (
profile.json): Mapped to/profile. - Array files (
users.json) are mapped to/users/index.json(list view), and if elements contain anidfield, individual items map to/users/:id(detail view).
For basic routing overrides, create a simple _config.json configuration in the data directory. The files starting with a dot (.) or an underscore (_) are ignored for the resultant JSON files.
To ensure seamless routing behavior across different CDN and static hosts:
--format index(Default): Outputs/endpoint/index.json. Perfect for standard servers resolving/endpoint/.--format file: Outputs/endpointfile with no file extension.--format extension: Outputs/endpoint.json. Zero-risk option compatible with every hosting platform.
To maintain simplicity, high speed, and ease of deployment, certain features are explicitly out of scope:
- Dynamic Write Operations (
POST,PUT,DELETE):fauxrestis purely a static read-only generator. If your clients require dynamic, stateful database updates, you should migrate to a standard, dynamic API backend. - API Versioning (Simultaneous
/v1and/v2branches): Maintaining legacy endpoint schemas within a static compiler adds unnecessary overhead. If multiple active versions must be supported, standard dynamic API gateways or hosting-level rewrite layers should be utilized. - Advanced Mock Server Latency or Status Emulation: This is a deployment publisher, not a test suite mock framework. If you need rich latency simulation (
?_delay=2000) or status-code mocking, please use standard client-side libraries like MSW (Mock Service Worker).
For comprehensive technical architecture design, command line args, and subcommands, see:
- Haruaki Tamada (@tamada)
- Google Gemini, GitHub Copilot
This project is licensed under the MIT License. See LICENSE for details.
The project name fauxrest is pronounced /fΙΛrΙͺst/ or /foΚrΙͺst/, which is the same as "forest".
And it is derived from Faux (meaning `fake' in French) and REST.
This logo is based on the one published on SVGRepo.