Home / File/ seed.ts — ui Source File

seed.ts — ui Source File

Architecture documentation for seed.ts, a typescript file in the ui codebase. 2 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  60ea95b8_f38e_d12c_a806_9528e4953e29["seed.ts"]
  0e9e6e0c_89c3_710e_bf21_50ad9d751025["client"]
  60ea95b8_f38e_d12c_a806_9528e4953e29 --> 0e9e6e0c_89c3_710e_bf21_50ad9d751025
  8c2ad8d1_012f_3c36_7837_7267d34cd794["bcryptjs"]
  60ea95b8_f38e_d12c_a806_9528e4953e29 --> 8c2ad8d1_012f_3c36_7837_7267d34cd794
  style 60ea95b8_f38e_d12c_a806_9528e4953e29 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { PrismaClient } from "@prisma/client";
import bcrypt from "bcryptjs";

const prisma = new PrismaClient();

async function seed() {
  const email = "rachel@remix.run";

  // cleanup the existing database
  await prisma.user.delete({ where: { email } }).catch(() => {
    // no worries if it doesn't exist yet
  });

  const hashedPassword = await bcrypt.hash("racheliscool", 10);

  const user = await prisma.user.create({
    data: {
      email,
      password: {
        create: {
          hash: hashedPassword,
        },
      },
    },
  });

  await prisma.note.create({
    data: {
      title: "My first note",
      body: "Hello, world!",
      userId: user.id,
    },
  });

  await prisma.note.create({
    data: {
      title: "My second note",
      body: "Hello, world!",
      userId: user.id,
    },
  });

  console.log(`Database has been seeded. 🌱`);
}

seed()
  .catch((e) => {
    console.error(e);
    process.exit(1);
  })
  .finally(async () => {
    await prisma.$disconnect();
  });

Subdomains

Functions

Dependencies

  • bcryptjs
  • client

Frequently Asked Questions

What does seed.ts do?
seed.ts is a source file in the ui codebase, written in typescript. It belongs to the FrameworkTooling domain, SchemaValidation subdomain.
What functions are defined in seed.ts?
seed.ts defines 1 function(s): seed.
What does seed.ts depend on?
seed.ts imports 2 module(s): bcryptjs, client.
Where is seed.ts in the architecture?
seed.ts is located at packages/shadcn/test/fixtures/frameworks/remix-indie-stack/prisma/seed.ts (domain: FrameworkTooling, subdomain: SchemaValidation, directory: packages/shadcn/test/fixtures/frameworks/remix-indie-stack/prisma).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free