New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@omodaka/pinatinodb-adapter-prisma

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@omodaka/pinatinodb-adapter-prisma

Prisma adapter for PinatinoDB - automatic IPFS sync for Prisma

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

@pinatinodb/prisma-adapter

Prisma adapter for PinatinoDB - automatically sync your Prisma data to IPFS!

Installation

pnpm add @pinatinodb/prisma-adapter @pinatinodb/core

Usage

import { PrismaClient } from '@prisma/client';
import { withPinatino } from '@pinatinodb/prisma-adapter';
import { PinatinoDB } from '@pinatinodb/core';

// Create PinatinoDB instance
const pinatino = new PinatinoDB({
  pinata: {
    apiKey: process.env.PINATA_JWT!
  }
});

await pinatino.initialize();

// Wrap Prisma client
const prisma = withPinatino(new PrismaClient(), {
  pinatino,
  strategy: 'write-through', // or 'write-behind', 'read-through', 'none'
  logging: true
});

// Use Prisma normally - data automatically syncs to IPFS!
const user = await prisma.user.create({
  data: {
    name: 'Alice',
    email: 'alice@example.com'
  }
});
// ✅ Data is now in both Prisma DB and IPFS!

Strategies

write-through (default)

  • Writes to both Prisma and IPFS synchronously
  • Ensures data consistency
  • Slower writes, but guaranteed sync

write-behind

  • Writes to Prisma immediately
  • Queues IPFS write asynchronously
  • Faster writes, eventual consistency

read-through

  • Reads from Prisma first
  • Falls back to IPFS if not found
  • Useful for hybrid storage

none

  • No automatic sync
  • Manual control via PinatinoDB API

Selective Sync

// Only sync specific models
const prisma = withPinatino(new PrismaClient(), {
  pinatino,
  models: ['User', 'Post'], // Only sync these models
  logging: true
});

// Or exclude models
const prisma = withPinatino(new PrismaClient(), {
  pinatino,
  excludeModels: ['Log', 'Session'], // Don't sync these
  logging: true
});

Error Handling

const prisma = withPinatino(new PrismaClient(), {
  pinatino,
  onError: (error, operation, model) => {
    console.error(`Failed to sync ${model}.${operation}:`, error);
    // Send to error tracking service, etc.
  }
});

How It Works

The adapter uses Prisma middleware to intercept database operations:

  • Prisma operation executes (your data goes to Prisma DB)
  • Middleware intercepts result
  • PinatinoDB syncs to IPFS via Pinata
  • Result returned to your code

All Prisma operations work normally - the IPFS sync is transparent!

Supported Operations

  • create - Synced to IPFS
  • createMany - Batch synced to IPFS
  • update - Updates in IPFS
  • updateMany - Batch updates
  • delete - Removes from IPFS
  • deleteMany - Batch deletes

Benefits

  • 📦 Automatic IPFS backup of your Prisma data
  • 🌍 Decentralized storage alongside traditional DB
  • ⏱️ Time-travel queries (IPFS immutability)
  • 🔄 Zero code changes to existing Prisma code
  • 🎯 Selective sync - choose what goes to IPFS

License

MIT

Keywords

prisma

FAQs

Package last updated on 12 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts