
Product
Introducing Scala and Kotlin Support in Socket
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
@vc-shell/api-client-generator
Advanced tools
This guide describes the process of generating an API client to access the VC Platform API from your custom application.
!!! note Platform Manager REST Client offers generated REST API methods that make it easy to interact with the existing VirtoCommerce Platform API.
To enable TypeScript API client generation in your project:
Using command
yarn add @vc-shell/api-client-generator cross-env
cross-env
runs scripts that set and use environment variables across platforms.
Manually
Add the dependencies to your project's package.json:
{
...
"devDependencies": {
...
"@vc-shell/api-client-generator": "latest",
"cross-env": "latest",
...
}
}
Configure client generation in your project. Inside your project's package.json file, add a "generate-api-client"
command to the list of scripts:
{
"scripts": {
...
"generate-api-client": cross-env api-client-generator --APP_PLATFORM_MODULES='[Virtocommerce.MarketplaceVendor,Virtocommerce.Catalog,Virtocommerce.Orders]' --APP_API_CLIENT_DIRECTORY=./src/api_client/
}
}
The options are listed in the table below:
Options | Description | Example |
---|---|---|
--APP_PLATFORM_MODULES | Platform modules to generate API client. {==string[]==} Customize the --APP_PLATFORM_MODULES listto match your project's requirements. | --APP_PLATFORM_MODULES='[Virtocommerce.MarketplaceVendor,Virtocommerce.Orders,Virtocommerce.Catalog]' |
--APP_API_CLIENT_DIRECTORY | Output directory for generated API clients. {==string==} | --APP_API_CLIENT_DIRECTORY=./src/api_client/ |
--APP_PLATFORM_URL | Platform URL to obtain client API configs. {==string==} | --APP_PLATFORM_URL=https://vcmp-dev.govirto.com/ |
--APP_PACKAGE_NAME | Package name for generated API clients. {==string==} | --APP_PACKAGE_NAME=@api-client |
--APP_PACKAGE_VERSION | Package version for generated API clients. {==string==} | --APP_PACKAGE_VERSION=1.1.0 |
--APP_OUT_DIR | Output directory for generated API clients. {==string==} | --APP_OUT_DIR=./src/api_client/ |
--APP_TYPE_STYLE | Sets the type style for generated DTOs. Can be 'Class' or 'Interface'. {==string==} | --APP_TYPE_STYLE=Interface |
--APP_BUILD_DIR | Directory where TypeScript files will be compiled. {==string==} | --APP_BUILD_DIR=lib (default is "dist") |
--SKIP_BUILD | Skip build step. {==boolean==} | --SKIP_BUILD=true |
--VERBOSE | Enable verbose logging. {==boolean==} | --VERBOSE=true |
Configure Platform URL to ensure your project can access the platform's API configurations. Add the platform URL to your project's .env file:
APP_PLATFORM_URL=https://vcmp-dev.govirto.com/
!!! note
Alternatively, you can specify the Platform URL as a command option in the previous step when running the "generate-api-client"
command.
Generate the API clients using the following command:
yarn generate-api-client
This command generates the required API clients for your custom application. Now you can effortlessly access the VC Platform API from your custom application using the generated API client.
The generator now intelligently merges configuration files to preserve your custom settings. When you update an existing API client:
API client now includes metadata to track the generation:
{
"apiClientGenerator": {
"version": "1.1.0",
"generatedAt": "2025-04-01T12:30:45.123Z"
}
}
The generator handles multiple API clients effectively:
./{moduleName}
) and full names (./virtocommerce.{moduleName}
)module
and types
fields that conflict with multiple exportsThe generator now intelligently handles root exports based on the number of API modules:
.
) and module
/types
fields are maintained./moduleA
, ./moduleB
)This enables both simple usage for single-API packages and proper subpath exporting for multi-API packages:
// Single API package (using root export)
import { MyClient } from '@myapp/api';
// Multi-API package (using subpath exports)
import { ClientA } from '@myapp/api/moduleA';
import { ClientB } from '@myapp/api/moduleB';
Target directories are automatically created if they don't exist.
Enable detailed logging to troubleshoot generation issues:
yarn generate-api-client --VERBOSE=true
You can specify a custom build directory where TypeScript files will be compiled:
yarn generate-api-client --APP_BUILD_DIR=lib
By default, the build directory is "dist".
Better error handling and reporting make it easier to diagnose issues during client generation.
If you encounter issues during API client generation:
--VERBOSE=true
--VERBOSE=true
flag to see detailed error messagesFAQs
Tool for API clients generation
The npm package @vc-shell/api-client-generator receives a total of 263 weekly downloads. As such, @vc-shell/api-client-generator popularity was classified as not popular.
We found that @vc-shell/api-client-generator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
Application Security
/Security News
Socket CEO Feross Aboukhadijeh and a16z partner Joel de la Garza discuss vibe coding, AI-driven software development, and how the rise of LLMs, despite their risks, still points toward a more secure and innovative future.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.