Initial commit: SDI SaaS Platform foundation

- Complete monorepo structure with pnpm workspaces
- Prisma database schema with 20+ entities
- NestJS API with 9 core modules
- BullMQ orchestration worker
- AWS and Azure provider adapters
- Docker Compose infrastructure
- Complete documentation
This commit is contained in:
austindebest
2026-04-20 00:00:59 +01:00
commit d62468adf9
69 changed files with 10136 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
import { ProviderAdapter } from '@sdi/shared-types';
import { AwsAdapter } from './aws-adapter';
import { AzureAdapter } from './azure-adapter';
export class AdapterRegistry {
private adapters: Map<string, ProviderAdapter> = new Map();
constructor() {
this.adapters.set('aws', new AwsAdapter());
this.adapters.set('azure', new AzureAdapter());
}
get(providerType: string): ProviderAdapter {
const adapter = this.adapters.get(providerType);
if (!adapter) {
throw new Error(`No adapter found for provider type: ${providerType}`);
}
return adapter;
}
register(providerType: string, adapter: ProviderAdapter) {
this.adapters.set(providerType, adapter);
}
}

View File

@@ -0,0 +1,96 @@
import {
ProviderAdapter,
ServiceIntent,
ValidationResult,
QuoteResult,
ProvisionRequest,
ProvisionResponse,
ModifyRequest,
ModifyResponse,
ActionResult,
ServiceStatus,
} from '@sdi/shared-types';
export class AwsAdapter implements ProviderAdapter {
async validate(payload: ServiceIntent): Promise<ValidationResult> {
// TODO: Implement AWS Direct Connect validation
// - Check if source/target endpoints are valid
// - Verify bandwidth is supported
// - Check location availability
console.log('AWS: Validating service intent', payload);
// Mock validation
return {
ok: true,
warnings: ['AWS adapter is in mock mode'],
};
}
async quote(payload: ServiceIntent): Promise<QuoteResult> {
// TODO: Implement AWS pricing calculation
// - Get Direct Connect pricing for bandwidth
// - Calculate port hours
// - Add data transfer costs
console.log('AWS: Generating quote', payload);
return {
monthlyRecurring: payload.bandwidthMbps * 0.05,
setupFee: 500,
currency: 'USD',
validUntil: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000),
};
}
async provision(payload: ProvisionRequest): Promise<ProvisionResponse> {
// TODO: Implement AWS Direct Connect provisioning
// - Create connection via AWS SDK
// - Configure virtual interface
// - Set up BGP peering
console.log('AWS: Provisioning service', payload);
// Mock provisioning
const externalServiceId = `dx-${Date.now()}`;
return {
success: true,
externalServiceId,
metadata: {
connectionId: externalServiceId,
vlan: 100,
bgpAsn: 65000,
},
};
}
async getStatus(externalId: string): Promise<ServiceStatus> {
// TODO: Implement status check via AWS SDK
console.log('AWS: Getting status for', externalId);
return 'active';
}
async modify(payload: ModifyRequest): Promise<ModifyResponse> {
// TODO: Implement bandwidth modification
console.log('AWS: Modifying service', payload);
return { success: true };
}
async suspend(externalId: string): Promise<ActionResult> {
// TODO: Implement service suspension
console.log('AWS: Suspending service', externalId);
return { success: true };
}
async terminate(externalId: string): Promise<ActionResult> {
// TODO: Implement connection deletion via AWS SDK
console.log('AWS: Terminating service', externalId);
return { success: true };
}
async syncInventory(): Promise<void> {
// TODO: Sync AWS Direct Connect inventory
console.log('AWS: Syncing inventory');
}
}

View File

@@ -0,0 +1,94 @@
import {
ProviderAdapter,
ServiceIntent,
ValidationResult,
QuoteResult,
ProvisionRequest,
ProvisionResponse,
ModifyRequest,
ModifyResponse,
ActionResult,
ServiceStatus,
} from '@sdi/shared-types';
export class AzureAdapter implements ProviderAdapter {
async validate(payload: ServiceIntent): Promise<ValidationResult> {
// TODO: Implement Azure ExpressRoute validation
// - Check peering location availability
// - Verify SKU and bandwidth tier
// - Validate circuit configuration
console.log('Azure: Validating service intent', payload);
return {
ok: true,
warnings: ['Azure adapter is in mock mode'],
};
}
async quote(payload: ServiceIntent): Promise<QuoteResult> {
// TODO: Implement Azure ExpressRoute pricing
// - Get circuit pricing by SKU
// - Calculate metered vs unlimited data
// - Add premium add-on costs if needed
console.log('Azure: Generating quote', payload);
return {
monthlyRecurring: payload.bandwidthMbps * 0.06,
setupFee: 600,
currency: 'USD',
validUntil: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000),
};
}
async provision(payload: ProvisionRequest): Promise<ProvisionResponse> {
// TODO: Implement Azure ExpressRoute provisioning
// - Create ExpressRoute circuit
// - Configure peering (private/Microsoft)
// - Set up route filters
console.log('Azure: Provisioning service', payload);
const externalServiceId = `er-${Date.now()}`;
return {
success: true,
externalServiceId,
metadata: {
circuitId: externalServiceId,
serviceKey: `sk-${Date.now()}`,
peeringLocation: 'mock-location',
},
};
}
async getStatus(externalId: string): Promise<ServiceStatus> {
// TODO: Check circuit provisioning state via Azure SDK
console.log('Azure: Getting status for', externalId);
return 'active';
}
async modify(payload: ModifyRequest): Promise<ModifyResponse> {
// TODO: Implement circuit modification
console.log('Azure: Modifying service', payload);
return { success: true };
}
async suspend(externalId: string): Promise<ActionResult> {
// TODO: Implement circuit suspension
console.log('Azure: Suspending service', externalId);
return { success: true };
}
async terminate(externalId: string): Promise<ActionResult> {
// TODO: Delete ExpressRoute circuit via Azure SDK
console.log('Azure: Terminating service', externalId);
return { success: true };
}
async syncInventory(): Promise<void> {
// TODO: Sync Azure ExpressRoute inventory
console.log('Azure: Syncing inventory');
}
}