4.0 KiB
4.0 KiB
SolaceNet Quick Reference
Quick reference guide for the SolaceNet Capability Platform.
Core Concepts
Capability States
disabled- No execution, gateway blockspilot- Allowlist onlyenabled- Active for entitled scopessuspended- Execution blocked, reads alloweddrain- No new requests, allow in-flight settlement
Scoping Levels
- Tenant
- Program (product line)
- Region (jurisdiction)
- Channel (API/UI/mobile)
- Customer segment (optional)
API Quick Reference
Capability Registry
# List capabilities
GET /api/v1/solacenet/capabilities
# Get capability
GET /api/v1/solacenet/capabilities/{id}
# Create capability
POST /api/v1/solacenet/capabilities
{
"capabilityId": "payment-gateway",
"name": "Payment Gateway",
"version": "1.0.0",
"defaultState": "disabled"
}
Entitlements
# Get entitlements
GET /api/v1/solacenet/tenants/{tenantId}/programs/{programId}/entitlements
# Create entitlement
POST /api/v1/solacenet/entitlements
{
"tenantId": "tenant-123",
"capabilityId": "payment-gateway",
"stateOverride": "enabled"
}
Policy Decisions
# Make decision
POST /api/v1/solacenet/policy/decide
{
"tenantId": "tenant-123",
"capabilityId": "payment-gateway",
"region": "US",
"channel": "API"
}
# Activate kill switch
POST /api/v1/solacenet/policy/kill-switch/{capabilityId}
{
"reason": "Emergency shutdown"
}
Risk Assessment
# Assess risk
POST /api/v1/risk/assess
{
"userId": "user-123",
"amount": "1000.00",
"currencyCode": "USD",
"deviceFingerprint": "abc123",
"velocityData": {
"count24h": 5
}
}
Service SDK Usage
import { requireCapability } from '@/shared/solacenet/sdk';
async function processPayment(...) {
// Check capability before proceeding
await requireCapability('payment-gateway', {
tenantId: 'tenant-123',
programId: 'program-456',
region: 'US',
channel: 'API'
});
// Proceed with payment processing
// ...
}
Common Patterns
Registering a New Capability
- Create capability:
await capabilityRegistryService.createCapability({
capabilityId: 'my-capability',
name: 'My Capability',
version: '1.0.0',
defaultState: 'disabled',
dependencies: ['payment-gateway']
});
- Create entitlement:
await entitlementsService.createEntitlement({
tenantId: 'tenant-123',
capabilityId: 'my-capability',
stateOverride: 'enabled'
});
- Use in service:
await requireCapability('my-capability', { tenantId: 'tenant-123' });
Creating Policy Rules
await policyEngineService.createPolicyRule({
ruleId: 'high-risk-block',
capabilityId: 'payment-gateway',
scope: 'global',
condition: {
and: [
{ gt: { risk_score: 80 } },
{ gt: { amount: 10000 } }
]
},
decision: 'deny',
priority: 10
});
Risk Rules
await riskRulesEngine.createRule({
ruleId: 'velocity-check',
name: 'High Velocity Detection',
ruleType: 'velocity',
condition: {
gt: { count24h: 20 }
},
action: 'block',
riskScore: 80,
priority: 50,
status: 'active'
});
Deployment
Docker Compose
docker-compose -f docker-compose.solacenet.yml up -d
Environment Variables
DATABASE_URL=postgresql://...
REDIS_URL=redis://localhost:6379
SOLACENET_GATEWAY_PORT=8080
JWT_SECRET=your-secret
Troubleshooting
Capability Not Available
- Check entitlement exists
- Verify capability state
- Check policy rules
- Review audit logs
Policy Decision Caching
- Cache TTL: 120 seconds (configurable)
- Kill switch invalidates cache immediately
- Redis required for caching
Gateway Issues
- Verify Redis connection
- Check backend URL configuration
- Review gateway logs
File Locations
- Services:
src/core/solacenet/ - Shared SDK:
src/shared/solacenet/ - Gateway:
gateway/go/ - Console:
frontend/solacenet-console/ - Schema:
prisma/schema.prisma