@workstudio/integrations
v1.0.3
Published
Integration Services for WorkStudio Platform
Maintainers
Readme
Integrations for Workstudio
Integration 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.
📦 Contents
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)
⚙️ Status
| 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.
🛠️ Installation
From the package root (the folder containing package.json):
cd packages/integrations/node
pnpm installAvailable scripts (see package.json):
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)⚡ Quick Usage
You can import provider classes directly from src/providers during development.
Example imports below assume local development — adjust paths when using the compiled dist/ package.
🔥 FirebaseProvider Example
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('[email protected]', 'secret-password', 'Alice');
const signedIn = await fb.loginUser('[email protected]', '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');
}🧠 FirebaseProvider API Summary
Constructor
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.
💳 StripeProvider Example
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<string>
Options:
lineItems: Array<{ price: string; quantity: number }>allowPromotionCodes?: booleanafterCompletion?:{ type: 'redirect' | 'hosted_confirmation', redirect?: { url: string } }
🔄 n8n & Supabase Providers
Currently stubs with constructor shells only. You can extend them with:
- Workflow triggers and executions for n8n
- Database, auth, or storage wrappers for Supabase
🧪 Testing & Development Notes
TypeScript compilation:
pnpm run buildCompiles to
dist/usingtsc -p tsconfig.json.Development:
pnpm run devRuns
src/index.tswithts-nodeandnodemon.
🤝 Contributing
- Fork the repo and create a feature branch.
- Add or update providers under
src/providers/. - Add tests and update this README.
- Run
pnpm run buildand submit a PR.
📄 License
MIT License — see package.json for details.
📬 Contact
Questions or issues? Open one here → https://github.com/workstudiohq/integrations/issues
