Installation Guide
This guide will help you set up your development environment for integrating with the Logistics System.
Prerequisites
Before you begin, ensure you have the following installed:
- Node.js 16 or higher
- npm, yarn, or pnpm package manager
- Git (optional, for version control)
System Requirements
Hardware Requirements
- CPU: 2+ cores recommended
- RAM: 4GB minimum, 8GB recommended
- Storage: 1GB free space
Software Requirements
- Operating System: Windows 10+, macOS 10.15+, or Linux
- Browser: Chrome 80+, Firefox 72+, or Safari 13+
- IDE: VS Code, WebStorm, or any modern IDE
Installation Steps
- Create Project Directory
bash
mkdir logistics-integration
cd logistics-integration
- Initialize Package Manager
bash
# Using npm
npm init -y
# Using yarn
yarn init -y
# Using pnpm
pnpm init
- Install Required Dependencies
bash
# Using npm
npm install @logistics/client-sdk crypto-js axios
# Using yarn
yarn add @logistics/client-sdk crypto-js axios
# Using pnpm
pnpm add @logistics/client-sdk crypto-js axios
- Install Development Dependencies
bash
# Using npm
npm install --save-dev typescript @types/node @types/crypto-js
# Using yarn
yarn add -D typescript @types/node @types/crypto-js
# Using pnpm
pnpm add -D typescript @types/node @types/crypto-js
- Configure TypeScript (if using TypeScript)
Create tsconfig.json
:
json
{
"compilerOptions": {
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "node",
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true,
"outDir": "./dist"
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
}
Environment Setup
- Create Environment Variables
Create .env
file:
env
PARTNER_API_KEY=your_api_key_here
PARTNER_API_SECRET=your_api_secret_here
API_BASE_URL=https://partner-services.logistics.com/api/v1
- Add Environment Variables Support
bash
# Using npm
npm install dotenv
# Using yarn
yarn add dotenv
# Using pnpm
pnpm add dotenv
Verify Installation
Create a test file src/test.js
:
javascript
require("dotenv").config();
const { LogisticsClient } = require("@logistics/client-sdk");
const client = new LogisticsClient({
apiKey: process.env.PARTNER_API_KEY,
apiSecret: process.env.PARTNER_API_SECRET,
baseUrl: process.env.API_BASE_URL,
});
async function testConnection() {
try {
const response = await client.health.check();
console.log("Connection successful:", response);
} catch (error) {
console.error("Connection failed:", error);
}
}
testConnection();
Run the test:
bash
node src/test.js
Next Steps
After successful installation:
Troubleshooting
Common Issues
Node.js Version Mismatch
bash# Check Node.js version node --version # Update Node.js using nvm nvm install 16 nvm use 16
Package Installation Errors
bash# Clear package manager cache npm cache clean --force # or yarn cache clean # or pnpm store prune
API Connection Issues
- Verify API key and secret
- Check network connectivity
- Ensure correct base URL
Getting Help
If you encounter issues:
- Check our API Reference
- Review Common Issues
- Contact support at support@logistics-system.com