Blitz is pivoting to framework agnostic toolkit. Click to learn more.
🚀Announcing Flightcontrol - Easily Deploy Blitz.js and Next.js to AWS 🚀
Back to Documentation Menu

blitz console

Alias: blitz c

Starts a Node.js REPL with your database and all your queries and mutations preloaded.

This makes it very simple to read or write to your database and run one-off commands using your queries or mutations. It's also great for testing and rapid prototype exploration.

Options

OptionShorthandDescriptionDefault
--env-eSet app environment name. Read more.None

Examples

> blitz console

You have entered the Blitz console
Tips: - Exit by typing .exit or pressing Ctrl-D
      - Use your db like this: await db.project.findMany()
      - Use your queries/mutations like this: await getProjects()
✔ Loading your code

⚡ > await db.question.findMany()
[
  {
    id: 1,
    createdAt: 2020-06-15T15:06:14.959Z,
    updatedAt: 2020-06-15T15:06:14.959Z,
    text: "What's up?"
  }
]

Idea for improving this page? Edit it on GitHub.