DEV Community

Michael Willian Santos
Michael Willian Santos

Posted on


Prisma - Backup System

// start

Hi everyone!
GitHub of the Project

Use this module to create a backup measure for your project that uses Prisma. You can either backup the information, or use them to migrate to another database, or just to reset the database.
Example: Let's say that you need to change a unique key (email) to another like (code). You can backup first,
then change the schema.prisma, and use this module to inject the old information.

// How To Use

Basic example using the Prisma, let's imagine that we have two models, User & Post. And the Post model is related to the User model.

import { PrismaClient } from '@prisma/client';
import { backup } from '@vorlefan/prisma-backup';

const prisma = new PrismaClient();

void (async function () {
    const [user, post] = await prisma.$transaction([prisma.user.findMany({}),{})]);

    // w/out encrypt

    await backup({
        models: {

    // encrypting the models

    await backup({
        models: {
        encrypt: true,
        password: 'pwd123',
        backupFolderName: 'encrypted'
Enter fullscreen mode Exit fullscreen mode

// End

There a lot of feature that I'm planning for this module, then if you want to, please contribute or follow up the news xD

Top comments (0)

An Animated Guide to Node.js Event Loop

Node.js doesn’t stop from running other operations because of Libuv, a C++ library responsible for the event loop and asynchronously handling tasks such as network requests, DNS resolution, file system operations, data encryption, etc.

What happens under the hood when Node.js works on tasks such as database queries? We will explore it by following this piece of code step by step.