01 · Installation
Installation & Environment Setup
The X2Y Dev Tools SDK is engineered as a zero-dependency, lightweight module designed for seamless integration into modern Node.js and TypeScript ecosystems. It operates entirely in-memory, ensuring that installation introduces no external network overhead or complex dependency trees.
Prerequisites
Baseline environment requirements
Node.js
Version 18.0.0 or higher. Node.js 20+ recommended for optimal perf_hooks performance.
TypeScript
Version 5.0.0 or higher if utilizing the SDK within a TypeScript project. Native type definitions ship with the package — no @types/ required.
Package manager
npm, yarn, or pnpm. Any registry-compatible workflow is supported, including air-gapped mirrors.
Installation vectors
Choose the method that matches your architecture
NPM (Project Dependency)
For standard application development and microservices. Installs the SDK as a localized dependency within node_modules, ensuring version consistency across your team, staging environments and production CI/CD pipelines.
npm install x2y-dev-tools-sdkIntegration context. Use when the SDK is required at runtime to monitor live API traffic, perform predictive analytics on incoming request telemetry, or execute build-time refactoring checks.
// CommonJS
const { X2YSdk } = require('x2y-dev-tools-sdk');
// ES Modules / TypeScript
import { X2YSdk } from 'x2y-dev-tools-sdk';NPM (Global Execution)
For standalone scripting, CI/CD automation and cross-repository auditing. Makes the core engine accessible from any directory without a local package.json.
npm install -g x2y-dev-tools-sdkIntegration context. Ideal for global utility scripts analyzing legacy codebases across repositories, pre-commit hooks, or automated refactoring audits in isolated CI/CD runners without polluting project dependencies.
Implementation. The compiled distribution is available in your global node_modules path and can be referenced directly in standalone Node.js scripts executed via the CLI.
GitHub (Source & Bleeding Edge)
For contributors, security auditors and early adopters. Bypasses the npm registry — strictly necessary where security policy requires building from audited source, or for features not yet published to stable.
npm install git+https://github.com/x2yDevs/x2y-sdk.gitIntegration context. Fork the repository, apply custom patches via patch-package, or contribute directly to the core engine.
Post-installation build step. If you clone manually rather than via npm install git+…, compile the TypeScript source first:
git clone https://github.com/x2yDevs/x2y-sdk.git
cd x2y-sdk
npm install
npx tscTypeScript configuration
Recommended compiler options
Because the SDK is written in TypeScript and ships with native type definitions, no additional @types/ packages are required. To ensure strict type checking and proper module resolution, verify your tsconfig.json includes the following:
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
}
}Verification
Confirm the SDK is operational
Execute the following diagnostic script. If it runs without module resolution errors, the SDK is fully operational and ready for production integration.
const { X2YSdk } = require('x2y-dev-tools-sdk');
const sdk = new X2YSdk(
{ rateLimitThreshold: 80 },
{ targetLanguage: 'javascript', rules: ['idiom'] }
);
console.log(`X2Y SDK v${sdk.version} initialized successfully.`);
console.log(`Active Rules: ${sdk.config.rules.join(', ')}`);X2Y SDK v1.0.4 initialized successfully.
Active Rules: idiom