{"library":"streamby-core","title":"StreamBy Core Middleware","type":"library","description":"@streamby/core is a robust, plug-and-play middleware framework designed for integrating storage-agnostic media management capabilities into existing Express.js (or compatible) applications. Currently at version `0.26.10`, the package provides functionality for file uploads, listings, and multi-project access across various storage providers like AWS S3, with planned support for Google Cloud Storage, Cloudflare R2, and local servers. It aims for a rapid, minor version release cadence, indicating active development and feature enhancements. A key differentiator is its architectural approach: it operates as a library within your existing API, eliminating the need to deploy and manage a separate backend service for media handling. This design promotes tight integration and simplifies deployment, offering a flexible solution for developers building scalable media-centric applications who require fine-grained control over their backend stack and data.","language":"javascript","status":"active","last_verified":"Thu Apr 23","install":{"commands":["npm install streamby-core"],"cli":null},"imports":["import { createStreamByRouter } from '@streamby/core';","import { setupStreambyPg } from '@streamby/core/pg/setup';","import { setupStreambyMongo } from '@streamby/core/mongo/setup';"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":null,"github":"https://github.com/GwerhDev/StreamBy-Package","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/streamby-core","openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"import http from 'http';\nimport express from 'express';\nimport { WebSocketServer } from 'ws';\nimport { createStreamByRouter } from '@streamby/core';\n\nconst app = express();\nconst server = http.createServer(app);\nconst wss = new WebSocketServer({ server, path: '/streamby/ws' });\n\napp.use('/streamby', express.json(), createStreamByRouter({\n  authProvider: async (req) => {\n    // In a real application, validate token/session and return user info\n    return { userId: 'user-id-123', username: 'demo-user', role: 'admin' };\n  },\n  databases: [\n    { id: 'mongo', type: 'nosql', connectionString: process.env.MONGO_URI ?? 'mongodb://localhost:27017/streamby_test' },\n    { id: 'postgres', type: 'sql', connectionString: process.env.POSTGRES_URI ?? 'postgresql://user:password@localhost:5432/streamby_test', main: true }\n  ],\n  storageProviders: [\n    {\n      type: 's3',\n      config: {\n        bucket: process.env.AWS_BUCKET ?? 'your-s3-bucket-name',\n        region: process.env.AWS_REGION ?? 'us-east-1',\n        accessKeyId: process.env.AWS_ACCESS_KEY ?? 'YOUR_AWS_ACCESS_KEY_ID',\n        secretAccessKey: process.env.AWS_SECRET_KEY ?? 'YOUR_AWS_SECRET_ACCESS_KEY'\n      }\n    }\n  ],\n  encrypt: process.env.STREAMBY_ENCRYPTION_KEY ?? 'a_32_character_encryption_key_for_streamby',\n  websocket: { server: wss }\n}));\n\nserver.listen(3000, () => {\n  console.log('StreamBy Core example server listening on port 3000');\n});","lang":"typescript","description":"Demonstrates setting up an Express server with StreamBy core middleware, integrating an S3 storage provider, dummy authentication, and a WebSocket server for real-time capabilities. Requires `ws` and `@types/ws`.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}