Installation
Install the Backend SDK for your preferred language and platform.
Package Installation
npm install @dcid/server-sdkOr with alternative package managers:
yarn add @dcid/server-sdkModule Configuration
// ES Modules
import { DCIDServerSDK } from '@dcid/server-sdk';
// CommonJS
const { DCIDServerSDK } = require('@dcid/server-sdk');TypeScript Configuration
Python Requirements
- Python 3.8 or higher
- `requests` library (installed automatically)
- `pydantic` for type validation (optional)
Go Requirements
- Go 1.21 or higher
- Module-aware mode enabled (`GO111MODULE=on`)
PHP Requirements
- PHP 8.1 or higher
- `guzzlehttp/guzzle` (installed automatically)
- Composer for dependency management
Environment Variables
Create a `.env` file in your project root:
Initialize the SDK
import 'dotenv/config';
import { DCIDServerSDK } from '@dcid/server-sdk';
const sdk = new DCIDServerSDK({
apiKey: process.env.DCID_API_KEY!,
environment: 'prod',
timeout: 30000,
enableRequestLogging: process.env.NODE_ENV !== 'production'
});Verify Installation
import { DCIDServerSDK } from '@dcid/server-sdk';
const sdk = new DCIDServerSDK({
apiKey: process.env.DCID_API_KEY!,
environment: 'dev'
});
async function verifyInstallation() {
try {
const result = await sdk.auth.registerOTP({
email: 'test@example.com'
});
console.log('SDK connected successfully');
console.log('OTP (dev only):', result.otp);
} catch (error) {
console.error('Connection failed:', error.message);
}
}
verifyInstallation();Next Steps
- Server Setup — Build a complete backend server
- API Reference — Full SDK documentation