The QuickDeployer TypeScript SDK enables developers to interact with the QuickDeployer API in both Node.js (backend) and browser (frontend) environments. It provides a type-safe interface for managing projects and servers, with robust error handling and modern JavaScript features.
- Manage projects (list, get, create, update, delete).
- Manage servers within projects (list, get, create, update, delete, check status).
- TypeScript support for type safety and IDE autocompletion.
- Compatible with Node.js and browser environments.
- Unit tests with Jest for reliability.
- Node.js >= 18.0.0 (for native
fetch
support) - TypeScript >= 5.4.5
- A QuickDeployer API key
Install the SDK via npm:
npm install node-quick-deployer-sdk
If the SDK is not published, clone the repository and install locally:
git clone https://github.com/niravsutariya/node-quick-deployer-sdk.git
cd node-quick-deployer-sdk
npm install
npm run build
import { Client } from 'node-quick-deployer-sdk';
const apiKey = 'your-api-token';
const client = new Client(apiKey, { baseUrl: 'https://api.quickdeployer.com/api' });
const projects = await client.projects().list();
console.log(projects); // [{ id: 'project-123', name: 'Test Project' }, ...]
const project = await client.projects().get('project-123');
console.log(project.name); // Test Project
const newProject = await client.projects().create({ name: 'New Project' });
console.log(newProject.id); // project-456
const updatedProject = await client.projects().update('project-123', { name: 'Updated Project' });
console.log(updatedProject.name); // Updated Project
await client.projects().delete('project-123');
console.log('Project deleted');
const servers = await client.servers('project-123').list();
console.log(servers); // [{ id: 'server-456', name: 'Test Server' }, ...]
const server = await client.servers('project-123').get('server-456');
console.log(server.name); // Test Server
const newServer = await client.servers('project-123').create({ name: 'New Server', type: 'web' });
console.log(newServer.id); // server-789
const updatedServer = await client.servers('project-123').update('server-456', { name: 'Updated Server' });
console.log(updatedServer.name); // Updated Server
await client.servers('project-123').delete('server-456');
console.log('Server deleted');
const status = await client.servers('project-123').checkStatus('server-456');
console.log(status.status); // online
Use try-catch for API errors:
try {
const projects = await client.projects().list();
} catch (error) {
console.error('Error:', error.message);
}
- API Key: Obtain from the QuickDeployer dashboard.
- Base URL: Defaults to
https://staging.quickdeployer.com/api
. Override viaClient
options.
For browser usage, bundle the SDK with a module bundler (e.g., Webpack, Vite):
npm run build
Ensure your bundler targets ES Modules and includes fetch
(available in modern browsers).
Run unit tests with Jest:
npm test
Tests are located in the tests/
directory and cover Client
, ProjectResource
, and ServerResource
.
- Fork the repository.
- Create a feature branch (
git checkout -b feature/your-feature
). - Commit changes (`git commit -m "Add feature"').
- Push to the branch (
git push origin feature/your-feature
). - Open a pull request.
Include tests and follow TypeScript/ESLint coding standards.
MIT License. See LICENSE for details.
Open issues on GitHub or contact support@quickdeployer.com.