Blobs is a lightweight backend service that provides applications with a simple API to store binary data (BLOBs) using optimistic concurrency control via versioning. Each BLOB has a version number that increments with every update. Clients can safely update data by specifying the version they are modifying, preventing accidental overwrites — similar to the ETag pattern in web APIs or versioning in MongoDB. All changes are broadcast in real-time to connected clients via Socket.IO. Server-side storage uses plain JSON files for simplicity and transparency.
Core Concept:
- Version-Based Consistency: Every BLOB has a monotonic version counter.
- Safe Updates: Client provides exact current version to avoid collisions.
- Real-Time Sync: All connected clients receive instant notifications on changes via Socket.IO.
- Transparent Storage: Data is stored as readable JSON files — no database setup required.
- Node.js (version 24 or higher)
- npm or yarn
Blobs requires a TOKEN_SECRET environment variable for signing and verifying API authorization tokens. The easiest way is to create a .env file in the project root:
cp .env.example .envThen edit .env and set your secure secret:
TOKEN_SECRET=your_secure_random_secret_hereBlobs organizes data into buckets (isolated namespaces for different applications or environments). To access a bucket, you need a dedicated token.
Generate a token for your bucket:
npm run token your-bucket-name
# or
yarn token your-bucket-nameThe command will output a JWT token like:
Token for bucket: your-bucket-name
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Copy this token and include it in your client application's requests as an auth header:
// Example in JavaScript
const socket = io('https://your-blobs-server', {
transports: ['websocket'],
auth: { token: 'YOUR_GENERATED_TOKEN_HERE' }
})Note: Each token is scoped to a specific bucket and cannot access data from other buckets.
- Set
TOKEN_SECRETin.env - Generate a bucket-specific token with
npm run token <bucket-name> - Use the token in your client's auth header
- Start the server with
npm start
Distributed under the GNU General Public License v3.0. See the LICENSE file for more details.