0
# Platform Integration
1
2
Authentication and project management for Prisma Platform services including workspace management, environment operations, and service integrations for Pulse and Accelerate.
3
4
## Capabilities
5
6
### Platform Command Group
7
8
Access Prisma Platform services and management capabilities through the platform command interface.
9
10
```bash { .api }
11
/**
12
* Access Prisma Platform services
13
* Manage authentication, projects, environments, and service integrations
14
*/
15
prisma platform <command> [options]
16
17
Commands:
18
auth Authentication management (login, logout, show)
19
workspace Workspace operations (show)
20
environment Environment management (create, delete, show)
21
project Project operations (create, delete, show)
22
serviceToken Service token management (create, delete, show)
23
pulse Pulse real-time events (enable, disable)
24
accelerate Accelerate connection pooling (enable, disable)
25
26
Global Options:
27
--early-access Enable early access features
28
--help/-h Show platform command help
29
```
30
31
### Authentication Management
32
33
Manage Prisma Platform authentication with browser-based login and credential management.
34
35
```bash { .api }
36
/**
37
* Authentication operations for Prisma Platform
38
* Supports GitHub and Google OAuth authentication
39
*/
40
prisma platform auth <command> [options]
41
42
Commands:
43
login Authenticate via browser (GitHub/Google OAuth)
44
logout Sign out and clear stored credentials
45
show Display current authenticated user information
46
```
47
48
**Authentication Examples:**
49
50
```bash
51
# Login via browser OAuth
52
prisma platform auth login
53
54
# Check current authentication status
55
prisma platform auth show
56
57
# Sign out and clear credentials
58
prisma platform auth logout
59
```
60
61
**Authentication Output Example:**
62
63
```
64
$ prisma platform auth show
65
✓ Authenticated as john@example.com
66
Provider: GitHub
67
Workspace: acme-corp
68
Expires: 2024-02-01T12:00:00Z
69
```
70
71
### Workspace Management
72
73
Display and manage workspace information for Prisma Platform organization.
74
75
```bash { .api }
76
/**
77
* Workspace operations for Prisma Platform
78
* View workspace details and member information
79
*/
80
prisma platform workspace <command> [options]
81
82
Commands:
83
show Display current workspace information
84
```
85
86
**Workspace Examples:**
87
88
```bash
89
# Display workspace information
90
prisma platform workspace show
91
```
92
93
### Environment Management
94
95
Create, manage, and configure environments within Prisma Platform projects.
96
97
```bash { .api }
98
/**
99
* Environment management operations
100
* Create and manage project environments for different deployment stages
101
*/
102
prisma platform environment <command> [options]
103
104
Commands:
105
create Create new environment
106
delete Delete existing environment
107
show List environments or show specific environment details
108
109
Create Options:
110
--name <name> Environment name
111
--description <text> Environment description
112
--region <region> Deployment region
113
114
Delete Options:
115
--name <name> Environment name to delete
116
--force Delete without confirmation
117
118
Show Options:
119
--name <name> Show specific environment (optional)
120
```
121
122
**Environment Examples:**
123
124
```bash
125
# List all environments
126
prisma platform environment show
127
128
# Show specific environment
129
prisma platform environment show --name production
130
131
# Create new environment
132
prisma platform environment create --name staging --description "Staging environment"
133
134
# Create environment with region
135
prisma platform environment create --name production --region us-east-1
136
137
# Delete environment
138
prisma platform environment delete --name old-staging
139
140
# Force delete without confirmation
141
prisma platform environment delete --name temp-env --force
142
```
143
144
### Project Management
145
146
Create, configure, and manage projects within Prisma Platform workspaces.
147
148
```bash { .api }
149
/**
150
* Project management operations
151
* Create and manage projects within workspace
152
*/
153
prisma platform project <command> [options]
154
155
Commands:
156
create Create new project
157
delete Delete existing project
158
show List projects or show specific project details
159
160
Create Options:
161
--name <name> Project name
162
--description <text> Project description
163
--region <region> Default region for project resources
164
165
Delete Options:
166
--name <name> Project name to delete
167
--force Delete without confirmation
168
169
Show Options:
170
--name <name> Show specific project (optional)
171
```
172
173
**Project Examples:**
174
175
```bash
176
# List all projects
177
prisma platform project show
178
179
# Show specific project
180
prisma platform project show --name my-app
181
182
# Create new project
183
prisma platform project create --name my-new-app --description "New application"
184
185
# Create project with default region
186
prisma platform project create --name global-app --region eu-west-1
187
188
# Delete project
189
prisma platform project delete --name old-project
190
191
# Force delete without confirmation
192
prisma platform project delete --name temp-project --force
193
```
194
195
### Service Token Management
196
197
Generate, manage, and revoke service tokens for programmatic access to Prisma Platform APIs.
198
199
```bash { .api }
200
/**
201
* Service token management for API access
202
* Generate and manage tokens for CI/CD and programmatic access
203
*/
204
prisma platform serviceToken <command> [options]
205
206
Commands:
207
create Generate new service token
208
delete Revoke existing service token
209
show List service tokens
210
211
Create Options:
212
--name <name> Token name/description
213
--project <project> Project scope for token
214
--environment <env> Environment scope for token
215
--permissions <perms> Token permissions (comma-separated)
216
217
Delete Options:
218
--id <token-id> Token ID to revoke
219
--name <name> Token name to revoke
220
221
Show Options:
222
--project <project> Filter by project (optional)
223
```
224
225
**Service Token Examples:**
226
227
```bash
228
# List all service tokens
229
prisma platform serviceToken show
230
231
# Create service token for project
232
prisma platform serviceToken create --name "CI/CD Token" --project my-app
233
234
# Create token with specific permissions
235
prisma platform serviceToken create \
236
--name "Deploy Token" \
237
--project my-app \
238
--environment production \
239
--permissions "deploy,read"
240
241
# Revoke token by ID
242
prisma platform serviceToken delete --id st-abc123def456
243
244
# Revoke token by name
245
prisma platform serviceToken delete --name "Old CI Token"
246
247
# List tokens for specific project
248
prisma platform serviceToken show --project my-app
249
```
250
251
**Note**: Service tokens are also available via the deprecated `apikey` alias:
252
253
```bash
254
# Deprecated aliases (use serviceToken instead)
255
prisma platform apikey create --name "Legacy Token"
256
prisma platform apikey show
257
prisma platform apikey delete --id st-xyz789
258
```
259
260
### Pulse Integration
261
262
Enable and manage Pulse real-time event streaming for database change notifications.
263
264
```bash { .api }
265
/**
266
* Pulse real-time event streaming management
267
* Enable database change streams and real-time notifications
268
*/
269
prisma platform pulse <command> [options]
270
271
Commands:
272
enable Enable Pulse for project/environment
273
disable Disable Pulse streaming
274
275
Enable Options:
276
--project <project> Project to enable Pulse for
277
--environment <env> Environment to enable Pulse for
278
--region <region> Pulse processing region
279
280
Disable Options:
281
--project <project> Project to disable Pulse for
282
--environment <env> Environment to disable Pulse for
283
```
284
285
**Pulse Examples:**
286
287
```bash
288
# Enable Pulse for project
289
prisma platform pulse enable --project my-app --environment production
290
291
# Enable Pulse with specific region
292
prisma platform pulse enable \
293
--project my-app \
294
--environment production \
295
--region us-east-1
296
297
# Disable Pulse
298
prisma platform pulse disable --project my-app --environment production
299
```
300
301
### Accelerate Integration
302
303
Enable and configure Accelerate connection pooling and caching for improved database performance.
304
305
```bash { .api }
306
/**
307
* Accelerate connection pooling and caching management
308
* Enable database connection pooling and query result caching
309
*/
310
prisma platform accelerate <command> [options]
311
312
Commands:
313
enable Enable Accelerate for project/environment
314
disable Disable Accelerate pooling
315
316
Enable Options:
317
--project <project> Project to enable Accelerate for
318
--environment <env> Environment to enable Accelerate for
319
--region <region> Accelerate processing region
320
--cache-strategy <strategy> Caching strategy configuration
321
322
Disable Options:
323
--project <project> Project to disable Accelerate for
324
--environment <env> Environment to disable Accelerate for
325
```
326
327
**Accelerate Examples:**
328
329
```bash
330
# Enable Accelerate for project
331
prisma platform accelerate enable --project my-app --environment production
332
333
# Enable Accelerate with specific region and caching
334
prisma platform accelerate enable \
335
--project my-app \
336
--environment production \
337
--region us-east-1 \
338
--cache-strategy ttl=300
339
340
# Disable Accelerate
341
prisma platform accelerate disable --project my-app --environment production
342
```
343
344
## Platform Integration Workflows
345
346
### Initial Platform Setup
347
348
```bash
349
# 1. Authenticate with platform
350
prisma platform auth login
351
352
# 2. Create project
353
prisma platform project create --name my-app --description "My application"
354
355
# 3. Create environments
356
prisma platform environment create --name development
357
prisma platform environment create --name staging
358
prisma platform environment create --name production
359
360
# 4. Enable services
361
prisma platform accelerate enable --project my-app --environment production
362
prisma platform pulse enable --project my-app --environment production
363
```
364
365
### CI/CD Integration
366
367
```bash
368
# Generate service token for CI/CD
369
prisma platform serviceToken create \
370
--name "GitHub Actions" \
371
--project my-app \
372
--permissions "deploy,read"
373
374
# Use token in CI/CD (store as secret)
375
export PRISMA_PLATFORM_TOKEN="st-abc123def456"
376
```
377
378
**CI/CD Configuration Example:**
379
380
```yaml
381
# GitHub Actions
382
- name: Deploy to Prisma Platform
383
env:
384
PRISMA_PLATFORM_TOKEN: ${{ secrets.PRISMA_PLATFORM_TOKEN }}
385
run: |
386
prisma platform auth login --token $PRISMA_PLATFORM_TOKEN
387
prisma migrate deploy
388
```
389
390
### Multi-Environment Management
391
392
```bash
393
# Development environment
394
prisma platform environment show --name development
395
396
# Deploy to staging
397
prisma platform project show --name my-app
398
DATABASE_URL=$STAGING_DB_URL prisma migrate deploy
399
400
# Enable Accelerate for production
401
prisma platform accelerate enable \
402
--project my-app \
403
--environment production
404
```
405
406
## Error Handling
407
408
Common platform integration errors:
409
410
- **Authentication Errors**: Invalid credentials or expired tokens
411
- **Permission Errors**: Insufficient permissions for operation
412
- **Network Errors**: Connectivity issues with Prisma Platform
413
- **Resource Conflicts**: Duplicate names or conflicting configurations
414
- **Quota Limits**: Platform usage limits exceeded
415
- **Service Unavailable**: Platform services temporarily unavailable
416
417
## Integration Patterns
418
419
### Local Development with Platform Services
420
421
```bash
422
# Use platform services in local development
423
prisma platform auth login
424
export ACCELERATE_URL=$(prisma platform accelerate show --project my-app --environment development)
425
npm run dev
426
```
427
428
### Platform Service Configuration
429
430
```typescript
431
// Using platform services in application
432
import { PrismaClient } from '@prisma/client'
433
434
const prisma = new PrismaClient({
435
datasourceUrl: process.env.ACCELERATE_URL, // From platform
436
})
437
438
// Pulse event subscription
439
const subscription = await prisma.$subscribe('User', {
440
create: true,
441
update: true,
442
})
443
```
444
445
### Multi-Region Deployment
446
447
```bash
448
# Deploy to multiple regions
449
prisma platform environment create --name production-us --region us-east-1
450
prisma platform environment create --name production-eu --region eu-west-1
451
452
prisma platform accelerate enable --project my-app --environment production-us --region us-east-1
453
prisma platform accelerate enable --project my-app --environment production-eu --region eu-west-1
454
```