SDK Overview
ArchiCore provides official SDKs for JavaScript/TypeScript and Python to integrate architecture analysis into your applications and workflows.
Available SDKs
| SDK | Package | Version | Installation |
|---|---|---|---|
| JavaScript/TypeScript | @archicore/sdk | 0.1.x | npm install @archicore/sdk |
| Python | archicore | 0.1.x | pip install archicore |
Quick Start
JavaScript/TypeScript
import { ArchiCore } from '@archicore/sdk';
const client = new ArchiCore({ apiKey: 'your-api-key' });
// List projects
const projects = await client.projects.list();
// Search code
const results = await client.projects.search('project-id', {
query: 'authentication middleware'
});
// Ask AI
const answer = await client.projects.ask('project-id', {
question: 'How does the auth system work?'
});
Python
from archicore import ArchiCore
client = ArchiCore(api_key="your-api-key")
# List projects
projects = client.projects.list()
# Search code
results = client.projects.search("project-id", query="authentication")
# Ask AI
answer = client.projects.ask("project-id", question="How does auth work?")
print(answer["response"])
Features
Both SDKs provide:
- Project Management - List, create, delete projects
- Indexing - Trigger and monitor indexing
- Semantic Search - Find code by meaning
- AI Assistant - Ask questions about your codebase
- Code Metrics - Get complexity and maintainability scores
- Security Scanning - Find vulnerabilities
- Impact Analysis - Understand change effects
- Enterprise Analysis - Handle large projects (50K+ files)
- Webhooks - Set up event notifications
Authentication
All SDKs use API key authentication. Get your API key from the Developer Dashboard.
// JavaScript
const client = new ArchiCore({ apiKey: process.env.ARCHICORE_API_KEY });
# Python
import os
client = ArchiCore(api_key=os.environ["ARCHICORE_API_KEY"])
Error Handling
SDKs provide typed exceptions for common errors:
JavaScript
import {
ArchiCore,
AuthenticationError,
RateLimitError,
NotFoundError
} from '@archicore/sdk';
try {
await client.projects.get('invalid-id');
} catch (error) {
if (error instanceof AuthenticationError) {
console.log('Invalid API key');
} else if (error instanceof RateLimitError) {
console.log(`Rate limited. Retry after ${error.retryAfter}s`);
} else if (error instanceof NotFoundError) {
console.log('Project not found');
}
}
Python
from archicore import ArchiCore
from archicore.exceptions import (
AuthenticationError,
RateLimitError,
NotFoundError
)
try:
client.projects.get("invalid-id")
except AuthenticationError:
print("Invalid API key")
except RateLimitError as e:
print(f"Rate limited. Retry after {e.retry_after}s")
except NotFoundError:
print("Project not found")
Rate Limits
SDKs respect rate limits automatically. Rate limit info is available in exceptions:
try {
await client.projects.search(projectId, { query });
} catch (error) {
if (error instanceof RateLimitError) {
console.log(`Limit: ${error.limit}`);
console.log(`Remaining: ${error.remaining}`);
console.log(`Retry after: ${error.retryAfter}s`);
}
}
Configuration
Custom Base URL
For self-hosted instances:
// JavaScript
const client = new ArchiCore({
apiKey: 'your-api-key',
baseUrl: 'https://your-server.com/api/v1'
});
# Python
client = ArchiCore(
api_key="your-api-key",
base_url="https://your-server.com/api/v1"
)
Timeout
// JavaScript - 60 second timeout
const client = new ArchiCore({
apiKey: 'your-api-key',
timeout: 60000
});
# Python - 60 second timeout
client = ArchiCore(
api_key="your-api-key",
timeout=60
)