{"id":37032041,"url":"https://github.com/alinangnaiba/anino","last_synced_at":"2026-01-14T03:56:48.160Z","repository":{"id":310994458,"uuid":"1041728054","full_name":"alinangnaiba/anino","owner":"alinangnaiba","description":"Lightweight .NET mock API server that serves JSON-defined endpoints and forwards unmatched requests to a live backend (YARP) for unified local API during frontend development and testing. Download the tool here https://www.nuget.org/packages/Anino.Tool","archived":false,"fork":false,"pushed_at":"2025-10-15T17:25:46.000Z","size":73,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-11-27T12:37:47.224Z","etag":null,"topics":["api-mocking","cli","devtools","dotnet","frontend-development","http","json","mock-server","reverse-proxy","testing","yarp"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/Anino.Tool","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alinangnaiba.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-20T23:38:53.000Z","updated_at":"2025-10-15T08:43:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"33674659-0902-477f-aa24-d30b83af75e7","html_url":"https://github.com/alinangnaiba/anino","commit_stats":null,"previous_names":["alinangnaiba/anino"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/alinangnaiba/anino","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alinangnaiba%2Fanino","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alinangnaiba%2Fanino/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alinangnaiba%2Fanino/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alinangnaiba%2Fanino/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alinangnaiba","download_url":"https://codeload.github.com/alinangnaiba/anino/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alinangnaiba%2Fanino/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408924,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-mocking","cli","devtools","dotnet","frontend-development","http","json","mock-server","reverse-proxy","testing","yarp"],"created_at":"2026-01-14T03:56:43.748Z","updated_at":"2026-01-14T03:56:48.146Z","avatar_url":"https://github.com/alinangnaiba.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Anino - Mock API Server\n\nAnino is a lightweight, fast mock API server that allows you to quickly spin up REST API endpoints from a simple JSON definition file. Perfect for frontend development, testing, and prototyping when you need a backend API that doesn't exist yet. Download in [NuGet](https://www.nuget.org/packages/Anino.Tool)\n\n## Features\n\n- 🚀 **Fast Setup** - Define all your API endpoints in a single JSON file.\n- 🔧 **Nested Subcommand Interface** - Clean and clear CLI with `server` and `def new` commands.\n- ⚡ **Latency Simulation** - Add artificial delays to simulate real network conditions.\n- 🎯 **Custom Status Codes** - Return any HTTP status code you need.\n- � **Proxy Pass-Through** - Forward unmatched requests to existing backend servers.\n- �📝 **Rich Definition Generator** - Quickly generate a sample definition file with common operations.\n- 🛠️ **Cross-Platform** - Runs on Windows, macOS, and Linux.\n- 📦 **.NET Global Tool** - Install once, use anywhere.\n\n## Installation\n\nInstall Anino as a .NET global tool:\n\n```bash\ndotnet tool install -g Anino.Tool\n```\n\n### Prerequisites\n\n- .NET 8.0 or .NET 9.0 runtime is required.\n- You can check your installed runtimes with `dotnet --list-runtimes`.\n- Download .NET from: https://dotnet.microsoft.com/download\n\n## Quick Start\n\n1.  **Generate a sample definition file:**\n    The `def new` command creates a `definition.json` file in your current directory.\n    ```bash\n    anino def new\n    ```\n\n2.  **Start the mock server:**\n    The `server` command starts the API server using the definition file.\n    ```bash\n    anino server --def definition.json\n    ```\n\n3.  **Test your new API:**\n    Open a new terminal and use `curl` or any API client to test the endpoints.\n    ```bash\n    curl http://localhost:7770/api/users\n    curl http://localhost:7770/api/health\n    ```\n\n## Command Line Reference\n\n### `anino server`\n\nStarts the Anino mock API server using a JSON definition file.\n\n| Option             | Alias | Description                                      | Required | Default |\n| ------------------ | ----- | ------------------------------------------------ | -------- | ------- |\n| `--def`            | `-d`  | Path to the JSON definition file.                | Yes      |         |\n| `--port`           | `-p`  | The port for the server to listen on.            | No       | `7770`  |\n| `--latency`        | `-l`  | Simulated network latency in milliseconds.       | No       | `0`     |\n| `--proxy`          | `-pp` | Base URL to forward unmatched requests to.       | No       |         |\n| `--use-secure`     | `-us` | Use HTTPS when proxy URL is HTTPS.              | No       | `true`  |\n\n**Examples:**\n\n```bash\n# Start server with a required definition file\nanino server --def ./api/definition.json\n\n# Start server on a different port with an alias\nanino server -d definition.json -p 8080\n\n# Start server with 500ms latency\nanino server -d definition.json -l 500\n\n# Start server with HTTP proxy fallback\nanino server -d definition.json -pp http://localhost:8000\n\n# Start server with HTTPS proxy (automatically uses HTTPS locally)\nanino server -d definition.json -pp https://dev.api.com\n\n# Force HTTP locally while proxying to HTTPS (bypasses SSL validation)\nanino server -d definition.json -pp https://dev.api.com --use-secure false\n\n# Combine multiple options\nanino server -d definition.json -p 3000 -l 200 -pp https://api.example.com\n```\n\n### `anino def new`\n\nCreates a new sample API definition file. This is a subcommand of `def`.\n\n| Option             | Alias | Description                                      | Required | Default          |\n| ------------------ | ----- | ------------------------------------------------ | -------- | ---------------- |\n| `--name`           | `-n`  | The name of the definition file to be created.   | No       | `definition.json` |\n\n**Examples:**\n\n```bash\n# Generate a default definition file named definition.json\nanino def new\n\n# Generate a definition file with a custom name\nanino def new --name my-api\n```\n\n## Sample Definition File\n\nThe `anino def new` command creates a file with a structure like this, which you can customize for your needs.\n\n```json\n[\n  {\n    \"path\": \"/api/users\",\n    \"method\": \"GET\",\n    \"statusCode\": 200,\n    \"response\": [\n      {\n        \"id\": 1,\n        \"name\": \"John Doe\",\n        \"email\": \"john.doe@example.com\"\n      }\n    ]\n  },\n  {\n    \"path\": \"/api/health\",\n    \"method\": \"GET\",\n    \"statusCode\": 200,\n    \"response\": {\n      \"status\": \"healthy\",\n      \"timestamp\": \"2025-08-21T12:00:00Z\"\n    }\n  }\n]\n```\n\n## Extending Existing APIs\n\nWhen working with existing applications, you can use Anino to extend your current API with new mock endpoints while keeping existing functionality intact. This is perfect for testing new features without disrupting your existing backend.\n\n### How It Works\n\nWhen you specify a `--proxy` URL, Anino acts as a smart proxy that:\n\n1. **Serves mock endpoints** defined in your JSON definition file\n2. **Forwards unmatched requests** to your existing backend server\n3. **Provides a single entry point** for both mocked and real endpoints\n\n### Example Workflow\n\nLet's say you have an existing API running on `http://localhost:8000` and you want to add new endpoints for testing:\n\n1. **Create a definition file for new endpoints only:**\n   ```json\n   [\n     {\n       \"path\": \"/api/new-feature\",\n       \"method\": \"GET\",\n       \"statusCode\": 200,\n       \"response\": {\n         \"id\": 1,\n         \"feature\": \"new functionality\",\n         \"enabled\": true\n       }\n     },\n     {\n       \"path\": \"/api/users\",\n       \"method\": \"POST\",\n       \"statusCode\": 201,\n       \"response\": {\n         \"id\": 999,\n         \"name\": \"Test User\",\n         \"created\": true\n       }\n     }\n   ]\n   ```\n\n2. **Start Anino with proxy enabled:**\n   ```bash\n   anino server -d new-features.json -pp http://localhost:8000\n   ```\n\n3. **Use a single URL for everything:**\n   ```bash\n   # These requests go to your new mock endpoints\n   curl http://localhost:7770/api/new-feature\n   curl -X POST http://localhost:7770/api/users -d '{\"name\":\"Test\"}'\n   \n   # These requests are forwarded to your existing API\n   curl http://localhost:7770/api/existing-users\n   curl http://localhost:7770/api/products\n   ```\n\n### Benefits\n\n- **No configuration changes** in your frontend application\n- **Seamless testing** of new features alongside existing ones\n- **Override existing endpoints** when needed for testing scenarios\n- **Single development workflow** regardless of backend availability\n\n## HTTPS and SSL Handling\n\nAnino automatically handles HTTPS scenarios to make development seamless:\n\n### Automatic HTTPS Detection\n\nWhen you specify an HTTPS proxy URL, Anino automatically runs your mock server on HTTPS to match:\n\n```bash\n# This automatically starts the mock server on https://localhost:7770\nanino server -d api.json -pp https://dev.api.com\n```\n\n### Handling HTTPS \u0026 SSL Certificates\n\nProxying to HTTPS endpoints can present certificate validation issues. Here’s how to handle the two most common scenarios.\n\n#### Scenario 1: Proxying to `localhost`\nWhen proxying to a local service (e.g., `https://localhost:5001`), your machine might not trust the .NET development certificate.\n\n✅ The Fix: The best practice is to explicitly trust the local dev certificate. Run this command once in your terminal:\n```bash\ndotnet dev-certs https --trust\n```\n\n#### Scenario 2: Proxying to a Dev Server with an Untrusted Certificate\nWhen proxying to a non-production API (e.g., `https://dev.api.com`), you may get an SSL error. This happens because the server is using a certificate that isn't trusted by your machine, such as a self-signed certificate or one from an internal company Certificate Authority (CA).\n\n\n##### Method 1: The Quick Workaround (Bypass Validation)\nFor quick tests, you can tell the proxy to ignore SSL validation errors using the `--use-secure false` flag.\n\n```bash\n# Runs mock server on HTTP, bypasses SSL validation for proxy requests\nanino server -d api.json -pp https://dev.api.com --use-secure false\n```\n\n\u003e **⚠️ Security Warning**\n\u003e The `--use-secure false` flag disables all SSL certificate checks, making the connection vulnerable to **Man-in-the-Middle (MitM) attacks**. This feature is for trusted development environments only. **NEVER use this flag when proxying to a production API.**\n\n##### Method 2: The Recommended Solution (Trust the Certificate)\n\nThe secure and long-term solution is to configure your machine to trust the certificate authority (CA) used by the dev API.\n\nThis usually involves:\n\n1. Obtain the root CA certificate (preferred) or the server’s public certificate (`.cer` or `.pem`).\n   - If your team or company provides a custom CA, request the root CA cert from them.\n2. Import it into your operating system’s trusted certificate store:\n   - **Windows**: Double-click the `.cer` file → *Install Certificate* → *Local Machine* → place it in *Trusted Root Certification Authorities*.\n   - **macOS**: Open *Keychain Access* → drag the `.cer` into *System* → mark it as *Always Trust*.\n   - **Linux**: Copy the `.cer` into `/usr/local/share/ca-certificates/` → run `sudo update-ca-certificates`.\n\nOnce trusted, your proxy will connect without needing the `--use-secure false` flag.\n\n\u003e ⚠️ **Note**: Only trust certificates that come from your team/company. Do not install arbitrary or unverified certificates. And only add them on your **development machine**—never on production servers.\n\n\n### Protocol Matching Examples\n\n```bash\n# HTTP proxy → HTTP mock server\nanino server -d api.json -pp http://localhost:3000\n# → Mock server: http://localhost:7770\n\n# HTTPS proxy → HTTPS mock server (default)\nanino server -d api.json -pp https://api.example.com\n# → Mock server: https://localhost:7770\n\n# HTTPS proxy → HTTP mock server (SSL bypass enabled)\nanino server -d api.json -pp https://api.example.com --us false -p 3000\n# → Mock server: http://localhost:3000 (with SSL bypass warning)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falinangnaiba%2Fanino","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falinangnaiba%2Fanino","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falinangnaiba%2Fanino/lists"}