The Smooth CDN CLI requires Node.js and an active Smooth CDN account.
Requirements
- Smooth CDN account – create an account
- Node.js ≥ 18.17.0 (recommended: Node.js 20 LTS)
Install CLI
Install the Smooth CDN CLI globally using npm:
npm install -g @smoothcdn/cliAfter installation, the scdn command will be available globally.
The Smooth CDN CLI authenticates the user and stores an access token locally. All subsequent commands use this token to communicate with the Smooth CDN API.
Login
To authenticate with your Smooth CDN account, run:
scdn loginThe login process opens a browser window where you can securely sign in to your account.
Re-running the login command replaces the current session and access token.
Environment variable
You can store your API token in the SCDN_TOKEN environment variable to authenticate CLI commands in non-interactive environments.
SCDN_TOKEN=your_token scdn statusThe Smooth CDN CLI uses a local configuration file (.scdn.json) to define project details, asset sources and version if applicable.
This file is created and maintained automatically when runningscdn init or scdn load and is required for all asset-related commands.
Configuration file
The configuration file must be located in the root directory of your project and named .scdn.json.
{
"project": "My New Project",
"projectSlug": "my-new-project",
"version": "1.0.0",
"blockBots": false,
"blockHeadless": false,
"sources": [
"./build/app/**/*.{js,css}",
"./build/images/**"
],
"excludes": [
"./build/app/tmp/*"
],
"protected": [
"./build/app/pro/*.{js,css}",
],
"imageVariants": [
"mobile": 360,
"tablet": 720,
"desktop": 1600
],
"replacePath": {
"/dist/": "/",
"/build/": "/assets/"
}
}Project and version
The top-level project fields identify the Smooth CDN project and define the active version used for deployments.
- project – Human-readable project name.
- projectSlug – URL-safe project identifier.
- blockBots – Blocks known bot user agents.
- blockHeadless – Blocks headless browser environments.
- version – Active version used when pushing assets - applicable for projects with type
versioned.
There're also properties projectId and userSlug that are automatically stored during scdn init or scdn load commands.
Asset sources and excludes
Asset discovery is based on glob patterns defined per project. Only matched files are uploaded during deployment.
- sources – Glob patterns defining which files are included.
- excludes – Glob patterns defining files that should be ignored.
- protected – Glob patterns defining files that should be flagged as protected - can be accessed only with access token.
Source, exclude and protected patterns are evaluated using standard glob matching.
Assets path adjustment
If you want to rewrite uploaded asset paths, add the replacePath field to .scdn.json.
Image variants
If you want to create multiple image variants, add the imageVariants field to .scdn.json. The CLI will automatically generate and upload resized variants for images, linked to the original asset.
The following commands are available in the Smooth CDN CLI. All commands operate based on the local .scdn.json configuration file.
Log in
Authenticates the user and stores an access token locally.
scdn loginLog out
Removes stored access token.
scdn logoutInitialize project
Initializes a new Smooth CDN project and creates a .scdn.json file.
scdn initLoad project
Loads an existing Smooth CDN project into the local configuration.
scdn loadPull project config
Pulls the current Smooth CDN user and project status into the local .scdn.json file.
scdn pull-configPush project config
Pushes project settings from .scdn.json to Smooth CDN.
This command does not publish or switch deployment versions. Use scdn publish-version for version publishing.
scdn push-configCreate version
Creates a new project version. Versioning is optional and can be skipped for simple workflows.
If no version is provided, the default version from .scdn.json will be used.
Optionally add --blank to create blank version (without any assets from previous version).
scdn create-version <version>Publish version
Publishes a version and makes it available via CDN URLs.
If no version is provided, the default version from .scdn.json will be published.
scdn publish-version <version>Publishing version via CLI sets it also as latest for project.
Push assets
Uploads assets to Smooth CDN based on the current configuration.
The same command can publish frontend bundles, PDFs, audio files, and supported video files from one project config.
Use --concurrency <number> to set parallel upload workers (default: 4).
Use --optimize=local to optimize assets in the CLI before upload (default value).
Use --optimize=remote to queue assets optimization on Smooth CDN level.
scdn pushSync assets
Cross-checks local assets against the ones on Smooth CDN and removes remote assets that do not exist locally.
The same command can publish frontend bundles, PDFs, audio files, and supported video files from one project config.
Use --force to sync published versions too..
scdn syncGet snippet for asset
Output HTML snippet for selected asset based on user preferences.
scdn get-snippetInspect asset paths
Validates asset paths and displays the list of assets before deployment.
scdn check-assetsGrant access
Grants direct access to protected assets.
scdn grant-accessRevoke access
Revokes previously granted access.
scdn revoke-accessShow account summary
Displays account status, including current user, plan, and limits.
scdn statusSmooth CDN CLI can be integrated into CI/CD pipelines to automate asset uploads during your build or deployment process.
This allows you to treat assets as part of your deployment pipeline instead of manually uploading files or committing built assets to your repository.
Why use CI/CD with Smooth CDN?
- Automated uploads — assets are pushed on every build or release.
- Consistent environments — the same pipeline runs locally and in CI.
- No secrets in frontend — authentication happens in the pipeline.
Authentication
In CI environments, authenticate the CLI using the SCDN_TOKEN environment variable.
You can generate API token in API Keys.
export SCDN_TOKEN="your_api_token"Add following file in .github/workflows/deploy-scdn.yml to add GitHub Action:
name: Upload assets to Smooth CDN
on:
push:
branches: [main]
jobs:
upload-assets:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- name: Install Smooth CDN CLI
run: npm install -g @smoothcdn/cli
- name: Install dependencies
run: npm ci
- name: Build assets
run: npm run build
- name: Upload assets to Smooth CDN
env:
SCDN_TOKEN: ${{ secrets.SCDN_TOKEN }}
run: |
scdn create-version
scdn push
scdn publish-versionStore your API token as a repository secret named SCDN_TOKEN.
GitHub secrets can be added at https://github.com/[login]/[repo-name]/settings/secrets/actions/new