A powerful CLI application for comprehensive API testing and mocking, enabling developers to streamline API validation and development workflows with rich configuration and execution capabilities.
- Comprehensive API Testing: Define and run detailed API tests.
- Multiple Request Methods: Support for GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS.
- Rich Payload Types: JSON, Text, Form Data.
- File Upload Support: Test multipart/form-data requests with file uploads.
- Detailed Assertions: Validate response status, headers, body content (JSON properties, arrays, values), and response time.
- Integrated Mock Server: Simulate API endpoints for development and testing.
- Dynamic & Conditional Responses: Define mock responses based on request parameters, headers, or body content.
- Template Variables: Use built-in (random data, timestamps) and custom (request-derived) variables in mock responses.
- File-based Configuration: Manage mock definitions in simple
.mock.json
files.
- Environment Management: Use different configurations for development, staging, production, etc.
- Variable Overriding: Project, Environment, and Request-level variable support with clear precedence.
- User-Friendly CLI:
- Interactive Creation: Commands to interactively create test and mock definitions.
- Detailed Reports: Comprehensive output with request, response, and assertion details.
- Visual Progress Indicators: Animated progress display for running multiple tests.
- Deployment & Extensibility:
- Single File Deployment: Simplified deployment as a single executable file.
- .NET 8.0 & .NET 9 Ready: Built with .NET 8.0, with automatic multi-targeting for .NET 9.0 when available.
The easiest way to get Apify is to download the pre-built executable from the GitHub Releases page.
- Go to the latest release.
- Download the appropriate
.zip
file for your operating system and architecture (e.g.,apify-win-x64.zip
for Windows 64-bit,apify-linux-x64.zip
for Linux 64-bit,apify-osx-arm64.zip
for macOS ARM64). - Extract the contents of the
.zip
file to a directory of your choice (e.g.,C:\Program Files\Apify
on Windows,/opt/apify
on Linux/macOS). - Add the directory where you extracted Apify to your system's PATH environment variable. This allows you to run
apify
from any terminal.
For a quick installation via your command line, use the following platform-specific instructions. Remember to replace [DOWNLOAD_URL]
with the actual download link for your OS and architecture from the latest GitHub release.
# Download the appropriate zip file and extract it
curl -L [DOWNLOAD_URL] -o apify.zip
unzip apify.zip
This will extract the apify
binary (and possibly other files) to your current directory.
# Make the binary executable and move it to /usr/local/bin
chmod a+x apify
sudo mv apify /usr/local/bin/
# Verify installation
apify --version
On macOS, you may see a security warning when running the binary for the first time (e.g., "cannot be opened because the developer cannot be verified"). To allow execution:
- Attempt to run
apify
from the terminal. If blocked, note the warning. - Open System Settings > Privacy & Security.
- Scroll down to the "Security" section. You should see a message about
apify
being blocked. - Click Allow Anyway.
- Run
apify
again from the terminal. If prompted, click Open in the dialog.
Alternatively, you can remove the quarantine attribute via terminal:
sudo xattr -rd com.apple.quarantine /usr/local/bin/apify
This will allow the binary to run without further security prompts.
-
Download the appropriate
.zip
file for Windows from the latest release and extract it using File Explorer or a tool like WinRAR. Inside the extracted folder, you'll findapify.exe
. -
Create a new folder for Apify in
Program Files
(run PowerShell as Administrator):New-Item -ItemType Directory -Force -Path "$env:ProgramFiles\Apify"
-
Move
apify.exe
to the new folder:Move-Item -Path ".\apify\apify.exe" -Destination "$env:ProgramFiles\Apify"
-
Add Apify to your user PATH environment variable:
[Environment]::SetEnvironmentVariable("PATH", $env:PATH + ";C:\Program Files\Apify", "User")
-
Restart your terminal, then verify the installation:
apify --version
Ensure you run PowerShell as Administrator for steps that modify
Program Files
.
Alternatively, you can build Apify from source:
Apify supports Native AOT (Ahead-of-Time) compilation, which produces a self-contained executable with no dependency on the .NET runtime. This results in:
- Faster startup time
- Smaller deployment size
- No dependency on the .NET runtime
- Improved performance
To build the Native AOT version:
# Using the build script
./build-native.sh
# Or manually
dotnet publish -c Release -r linux-x64 --self-contained true -p:PublishAot=true
The resulting executable will be located at:
bin/Release/net8.0/linux-x64/publish/apify
You can run it directly without needing the .NET runtime:
./bin/Release/net8.0/linux-x64/publish/apify
For other platforms, replace linux-x64
with your target platform:
- Windows:
win-x64
- macOS:
osx-x64
- ARM64:
linux-arm64
orosx-arm64
For documentation, please visit Apify Documentation.
To contribute to Apify or build it from source, follow these steps:
- .NET 8.0 SDK (required)
- .NET 9.0 SDK (optional, for building with .NET 9.0 when available)
git clone [email protected]:nahid/apify.git
Navigate to the project directory and run:
cd apify
dotnet build
To run the tests, use:
dotnet test
This project includes GitHub Actions workflows for continuous integration and releases.
The CI workflow (if included in your project, typically in .github/workflows/ci.yml
) runs on every push to the main branch and pull requests. It usually:
- Builds the project.
- Runs API tests (e.g.,
apify tests --env ci
) to verify functionality against a deployed or mocked environment.
To create a release (if configured, typically in .github/workflows/release.yml
):
- Tag-based release: Create and push a new tag:
git tag -a v1.0.0 -m "Version 1.0.0" && git push origin v1.0.0
- Manual release: Via GitHub Actions UI.
This process typically builds single file executables for various platforms and attaches them to a GitHub release.
This project is licensed under the MIT License. See the LICENSE file for details. (Ensure you have a LICENSE file).