- 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
195 lines
4.8 KiB
Markdown
195 lines
4.8 KiB
Markdown
# SDI SaaS Platform
|
|
|
|
A production-grade Software-Defined Interconnection (SDI) platform for provisioning and managing private connectivity services across AWS, Azure, and other cloud providers.
|
|
|
|
## Architecture
|
|
|
|
This is a TypeScript-first monorepo implementing:
|
|
|
|
- **Multi-tenant SaaS control plane** with customer and admin portals
|
|
- **Orchestration engine** for asynchronous service provisioning
|
|
- **Provider adapters** for AWS Direct Connect, Azure ExpressRoute, and carriers
|
|
- **Billing subsystem** with usage metering and invoicing
|
|
- **Standards-aligned APIs** following MEF LSO principles
|
|
|
|
## Tech Stack
|
|
|
|
- **Frontend**: Vue 3, Nuxt 3, Tailwind CSS
|
|
- **Backend**: NestJS, TypeScript
|
|
- **Database**: PostgreSQL with Prisma ORM
|
|
- **Queue/Jobs**: Redis + BullMQ
|
|
- **Infrastructure**: Docker, Kubernetes
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
apps/
|
|
api/ # NestJS REST API
|
|
worker/ # BullMQ orchestration worker
|
|
customer-portal/ # Vue 3 customer portal (TODO)
|
|
admin-portal/ # Vue 3 admin portal (TODO)
|
|
|
|
packages/
|
|
database/ # Prisma schema and client
|
|
shared-types/ # Shared TypeScript types
|
|
```
|
|
|
|
## Getting Started
|
|
|
|
### Prerequisites
|
|
|
|
- Node.js 20+
|
|
- pnpm 8+
|
|
- Docker & Docker Compose
|
|
- PostgreSQL 16
|
|
- Redis 7
|
|
|
|
### Installation
|
|
|
|
```bash
|
|
# Install dependencies
|
|
pnpm install
|
|
|
|
# Generate Prisma client
|
|
pnpm db:generate
|
|
|
|
# Start infrastructure
|
|
docker-compose up -d postgres redis
|
|
|
|
# Run database migrations
|
|
pnpm db:migrate
|
|
|
|
# Start development servers
|
|
pnpm dev
|
|
```
|
|
|
|
### Development
|
|
|
|
```bash
|
|
# Start API server
|
|
pnpm --filter @sdi/api dev
|
|
|
|
# Start worker
|
|
pnpm --filter @sdi/worker dev
|
|
|
|
# Run database studio
|
|
pnpm db:studio
|
|
```
|
|
|
|
## Core Entities
|
|
|
|
- **Tenant**: Multi-tenant organization
|
|
- **User**: Tenant users with RBAC
|
|
- **Provider**: AWS, Azure, carriers, exchanges
|
|
- **Endpoint**: Connectivity endpoints (regions, datacenters)
|
|
- **ProductOffering**: Service catalog items
|
|
- **Quote**: Pricing quotes for services
|
|
- **ServiceOrder**: Customer orders with lifecycle states
|
|
- **Service**: Active connectivity services
|
|
- **ProvisioningTask**: Orchestration workflow tasks
|
|
|
|
## API Endpoints
|
|
|
|
### Orders
|
|
- `POST /api/v1/orders` - Create service order
|
|
- `GET /api/v1/orders` - List orders
|
|
- `GET /api/v1/orders/:id` - Get order details
|
|
- `DELETE /api/v1/orders/:id` - Cancel order
|
|
|
|
### Services
|
|
- `GET /api/v1/services` - List active services
|
|
- `GET /api/v1/services/:id` - Get service details
|
|
- `POST /api/v1/services/:id/suspend` - Suspend service
|
|
- `POST /api/v1/services/:id/terminate` - Terminate service
|
|
|
|
### Quotes
|
|
- `POST /api/v1/quotes` - Generate quote
|
|
- `GET /api/v1/quotes/:id` - Get quote details
|
|
|
|
### Providers & Endpoints
|
|
- `GET /api/v1/providers` - List providers
|
|
- `GET /api/v1/endpoints` - List connectivity endpoints
|
|
|
|
## Orchestration Flow
|
|
|
|
1. Customer submits order via portal or API
|
|
2. Order validated and persisted to PostgreSQL
|
|
3. Event emitted to BullMQ provisioning queue
|
|
4. Worker picks up job and selects provider adapter
|
|
5. Adapter provisions service via cloud APIs
|
|
6. Status updates streamed to customer portal
|
|
7. Service activated and billing metering starts
|
|
|
|
## Provider Adapters
|
|
|
|
### AWS Direct Connect Adapter
|
|
- Location validation
|
|
- Connection provisioning
|
|
- Virtual interface configuration
|
|
- BGP peering setup
|
|
|
|
### Azure ExpressRoute Adapter
|
|
- Circuit creation
|
|
- Peering configuration
|
|
- Route filter management
|
|
- SKU and bandwidth validation
|
|
|
|
## Environment Variables
|
|
|
|
```bash
|
|
# API
|
|
PORT=3000
|
|
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/sdi_saas
|
|
REDIS_URL=redis://localhost:6379
|
|
JWT_SECRET=your-secret-key
|
|
|
|
# Worker
|
|
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/sdi_saas
|
|
REDIS_URL=redis://localhost:6379
|
|
```
|
|
|
|
## Database Schema
|
|
|
|
See [packages/database/prisma/schema.prisma](packages/database/prisma/schema.prisma) for the complete schema.
|
|
|
|
Key tables:
|
|
- `tenants` - Multi-tenant organizations
|
|
- `service_orders` - Order lifecycle management
|
|
- `services` - Active connectivity services
|
|
- `provisioning_tasks` - Workflow orchestration
|
|
- `audit_events` - Complete audit trail
|
|
|
|
## Roadmap
|
|
|
|
### Phase 1: MVP (Current)
|
|
- [x] Core domain model and database schema
|
|
- [x] NestJS API with CRUD operations
|
|
- [x] BullMQ orchestration worker
|
|
- [x] AWS and Azure adapter skeletons
|
|
- [ ] Customer portal (Vue 3)
|
|
- [ ] Authentication and RBAC
|
|
- [ ] Basic billing engine
|
|
|
|
### Phase 2: Production Ready
|
|
- [ ] Complete AWS/Azure adapter implementations
|
|
- [ ] Real-time status updates (SSE)
|
|
- [ ] Webhook delivery system
|
|
- [ ] Admin portal and NOC tooling
|
|
- [ ] Enhanced billing and invoicing
|
|
- [ ] Kubernetes deployment
|
|
|
|
### Phase 3: Federation
|
|
- [ ] MEF LSO-aligned partner APIs
|
|
- [ ] Multi-provider orchestration
|
|
- [ ] Incident management
|
|
- [ ] SLA monitoring
|
|
|
|
## Documentation
|
|
|
|
- [Architecture Blueprint](sdi-saas-architecture-blueprint.md)
|
|
- API Documentation: http://localhost:3000/api/docs (when running)
|
|
|
|
## License
|
|
|
|
Proprietary
|