Integration Services for WorkStudio Platform
npm install @workstudio/integrationsIntegration utilities and provider wrappers used by Workstudio to connect with common third-party services โ including Firebase, Stripe, n8n, and Supabase.
This package provides lightweight TypeScript classes that wrap common operations for each provider, so you can integrate faster and focus on your product.
---
* src/index.ts โ package entry (re-exports providers)
* src/providers/firebase.provider.ts โ Firebase full integration (Firestore, Auth, Storage, Realtime DB, Messaging)
* src/providers/stripe.provider.ts โ Stripe helper (payment link generation)
* src/providers/n8n.provider.ts โ n8n provider (stub)
* src/providers/supabase.provider.ts โ Supabase provider (stub)
---
| Provider | Status | Features |
| -------------------- | -------------- | ------------------------------------------------ |
| FirebaseProvider | Implemented | Firestore, Auth, Storage, Realtime DB, Messaging |
| StripeProvider | Implemented | Payment link generation |
| n8nProvider | Placeholder | Constructor only |
| SupabaseProvider | Placeholder | None yet |
> Prefer using the implemented providers (Firebase, Stripe) for production use.
> The others are ready for community contribution or future development.
---
From the package root (the folder containing package.json):
``bash`
cd packages/integrations/node
pnpm install
Available scripts (see package.json):
`bash`
pnpm run dev # Run with ts-node + nodemon for development
pnpm run build # Compile TypeScript to dist/
pnpm start # Run built code (node dist/index.js)
---
You can import provider classes directly from src/providers during development.dist/
Example imports below assume local development โ adjust paths when using the compiled package.
---
`ts
import FirebaseProvider from './src/providers/firebase.provider';
const fb = new FirebaseProvider({
projectId: process.env.FIREBASE_PROJECT_ID!,
apiKey: process.env.FIREBASE_API_KEY!,
storageBucket: process.env.FIREBASE_STORAGE_BUCKET,
messagingSenderId: process.env.FIREBASE_MESSAGING_SENDER_ID,
});
// Firestore
await fb.addDocument('products', { name: 'Chair', price: 49.99 });
const product = await fb.getDocument('products', 'docId');
// Auth
const user = await fb.createUser('alice@example.com', 'secret-password', 'Alice');
const signedIn = await fb.loginUser('alice@example.com', 'secret-password');
// Storage
await fb.uploadFile('uploads/hello.txt', new Blob(['hello']));
// Realtime DB
await fb.setRealtimeData('/flags/feature-x', { enabled: true });
// Messaging (optional)
try {
const token = await fb.getMessagingToken(process.env.FIREBASE_VAPID_KEY);
fb.onMessage(payload => console.log('Push payload', payload));
} catch {
console.warn('Messaging not available in this runtime');
}
`
---
#### Constructor
`ts`
new FirebaseProvider(options: FirebaseIntegrationOptions)
Options:
projectId (string, required)*
apiKey (string, required)*
* storageBucket?messagingSenderId?
* clientEmail?
* privateKey?
* requiredConfig?
(Array<{ key: string; dataType: string }>)*
#### Firestore
* addDocument(collectionName, data)getDocument(collectionName, docId)
* updateDocument(collectionName, docId, data)
* deleteDocument(collectionName, docId)
* listDocuments(collectionName)
*
#### Auth
* createUser(email, password, displayName?)loginUser(email, password)
* deleteUserAccount()
*
#### Storage
* uploadFile(filePath, fileContent)getFileUrl(filePath)
* deleteFile(filePath)
*
#### Realtime Database
* setRealtimeData(path, data)getRealtimeData(path)
* deleteRealtimeData(path)
*
#### Messaging
* getMessagingToken(vapidKey?)onMessage(callback)
*
> โ ๏ธ Note: Firebase Messaging may not be available in non-browser runtimes.
> The provider automatically warns if initialization fails.
---
`ts
import StripeProvider from './src/providers/stripe.provider';
const stripe = new StripeProvider(process.env.STRIPE_SECRET_KEY!);
const url = await stripe.generatePaymentLink({
lineItems: [{ price: 'price_abc123', quantity: 1 }],
allowPromotionCodes: true,
afterCompletion: {
type: 'redirect',
redirect: { url: 'https://your-site.com/thanks' }
}
});
console.log('Payment link:', url);
`
#### StripeProvider API Summary
* Constructor: new StripeProvider(apiKey: string)
* Methods:
* generatePaymentLink(options: PaymentLinkOptions) => Promise
Options:
* lineItems: Array<{ price: string; quantity: number }>allowPromotionCodes?
* : booleanafterCompletion?
* : { type: 'redirect' | 'hosted_confirmation', redirect?: { url: string } }
---
Currently stubs with constructor shells only.
You can extend them with:
* Workflow triggers and executions for n8n
* Database, auth, or storage wrappers for Supabase
---
* TypeScript compilation:
`bash`
pnpm run build
Compiles to dist/ using tsc -p tsconfig.json.
* Development:
`bash`
pnpm run dev
Runs src/index.ts with ts-node and nodemon.
1. Fork the repo and create a feature branch.
2. Add or update providers under src/providers/.pnpm run build
3. Add tests and update this README.
4. Run and submit a PR.
---
MIT License โ see package.json` for details.
---
Questions or issues?
Open one here โ https://github.com/workstudiohq/integrations/issues