To follow this guide you need a SafeDep Cloud API Key and Tenant Identifier. See Cloud Quickstart on how to onboard to SafeDep Cloud and get an API key.
Project Setup
Initialize TypeScript Project
Start by creating a new TypeScript project:Configure Buf Registry
Configure npm to use the Buf Registry for SafeDep API SDKs:Install SafeDep API SDKs
Install the required SafeDep API libraries:Authentication Setup
Environment Variables
Set your SafeDep Cloud credentials:Never hardcode API keys in your source code. Always use environment variables or secure configuration management.
Implementation
Import Dependencies
Set up the necessary imports for ConnectRPC client and SafeDep services:Authentication Interceptor
Create an interceptor to add authentication headers to each API call:Main Application Logic
Implement the main function to query package insights:Advanced Examples
Batch Package Analysis
Analyze multiple packages in a single application:Vulnerability Filtering
Filter packages by vulnerability severity:Error Handling and Retry Logic
Implement robust error handling:Integration Examples
Express.js Web API
Create a web API that exposes package insights:CLI Tool
Build a command-line tool for package analysis:API Reference
For complete information on request and response schemas, see the Insights v2 API Specification.Available Ecosystems
The API supports multiple package ecosystems:NPM
- Node.js packagesPYPI
- Python packagesMAVEN
- Java/JVM packagesCARGO
- Rust packagesNUGET
- .NET packages- And more…
Response Data
The API returns comprehensive security metadata including:- Vulnerabilities: Known security vulnerabilities
- Licenses: License information and compliance data
- Scorecard: OpenSSF Scorecard metrics
- Malware: Malware detection results
- Metadata: Package information and statistics