Home / Function/ seed() — ui Function Reference

seed() — ui Function Reference

Architecture documentation for the seed() function in seed.ts from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  1f10280c_c0dc_3e58_7cdc_88c454008cd3["seed()"]
  60ea95b8_f38e_d12c_a806_9528e4953e29["seed.ts"]
  1f10280c_c0dc_3e58_7cdc_88c454008cd3 -->|defined in| 60ea95b8_f38e_d12c_a806_9528e4953e29
  style 1f10280c_c0dc_3e58_7cdc_88c454008cd3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/shadcn/test/fixtures/frameworks/remix-indie-stack/prisma/seed.ts lines 6–44

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. 🌱`);
}

Subdomains

Frequently Asked Questions

What does seed() do?
seed() is a function in the ui codebase, defined in packages/shadcn/test/fixtures/frameworks/remix-indie-stack/prisma/seed.ts.
Where is seed() defined?
seed() is defined in packages/shadcn/test/fixtures/frameworks/remix-indie-stack/prisma/seed.ts at line 6.

Analyze Your Own Codebase

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

Try Supermodel Free