Create a new project
Prisma works out of the box with Bun. First, create a directory and initialize it with bun init.terminalCopymkdir prisma-app cd prisma-app bun init 2Install Prisma dependencies
Then install the Prisma CLI (prisma), Prisma Client (@prisma/client), and the LibSQL adapter as dependencies.terminalCopybun add -d prisma bun add @prisma/client @prisma/adapter-libsql 3Initialize Prisma with SQLite
We’ll use the Prisma CLI with bunx to initialize our schema and migration directory. For simplicity we’ll be using an in-memory SQLite database.terminalCopybunx --bun prisma init --datasource-provider sqlite This creates a basic schema. We need to update it to use the new Rust-free client with Bun optimization. Open prisma/schema.prisma and modify the generator block, then add a simple User model.prisma/schema.prismaCopy generator client { provider = "prisma-client" output = "./generated" engineType = "client" runtime = "bun" } datasource db { provider = "sqlite" url = env("DATABASE_URL") } model User { id Int @id @default(autoincrement()) email String @unique name String? } 4Create and run database migration
Then generate and run initial migration.This will generate a .sql migration file in prisma/migrations, create a new SQLite instance, and execute the migration against the new instance.terminalCopy bunx --bun prisma migrate dev --name init CopyEnvironment variables loaded from .env Prisma schema loaded from prisma/schema.prisma Datasource "db": SQLite database "dev.db" at "file:./dev.db" SQLite database dev.db created at file:./dev.db Applying migration `20251014141233_init` The following migration(s) have been created and applied from new schema changes: prisma/migrations/ └─ 20251014141233_init/ └─ migration.sql Your database is now in sync with your schema. ✔ Generated Prisma Client (6.17.1) to ./generated in 18ms 5Generate Prisma Client
As indicated in the output, Prisma re-generates our Prisma client whenever we execute a new migration. The client provides a fully typed API for reading and writing from our database. You can manually re-generate the client with the Prisma CLI.terminalCopybunx --bun prisma generate 6Initialize Prisma Client with LibSQL
Now we need to create a Prisma client instance. Create a new file prisma/db.ts to initialize the PrismaClient with the LibSQL adapter.prisma/db.tsCopyimport { PrismaClient } from "./generated/client"; import { PrismaLibSQL } from "@prisma/adapter-libsql"; const adapter = new PrismaLibSQL({ url: process.env.DATABASE_URL || "" }); export const prisma = new PrismaClient({ adapter }); 7Create a test script
Let’s write a simple script to create a new user, then count the number of users in the database.index.tsCopyimport { prisma } from "./prisma/db"; // create a new user await prisma.user.create({ data: { name: "John Dough", email: `john-${Math.random()}@example.com`, }, }); // count the number of users const count = await prisma.user.count(); console.log(`There are ${count} users in the database.`); 8Run and test the application
Let’s run this script with bun run. Each time we run it, a new user is created.terminalCopybun run index.ts CopyCreated john-0.12802932895402364@example.com There are 1 users in the database. terminalCopybun run index.ts CopyCreated john-0.8671308799782803@example.com There are 2 users in the database. terminalCopybun run index.ts CopyCreated john-0.4465968383115295@example.com There are 3 users in the database. That’s it! Now that you’ve set up Prisma using Bun, we recommend referring to the official Prisma docs as you continue to develop your application.Was this page helpful?
YesNoSuggest editsRaise issueRun Bun as a daemon with PM2PreviousUse Prisma Postgres with BunNext⌘IxgithubdiscordyoutubePowered by智能索引记录
-
2026-03-02 10:55:25
综合导航
成功
标题:December started with a flash crash, and BTC’s key support level of $80,000 is in danger. Bee Network
简介:Author Asher ( @Asher_0210 ) The crypto market experien
-
2026-03-02 10:41:46
综合导航
成功
标题:Hotels in the Birkenhead, Wirral (England) district - book cheaply with HRS
简介:Book hotels with HRS and save up to 50%: Enjoy exclusive ben
-
2026-03-02 10:42:20
图片素材
成功
标题:初中散文作文800字 初中800字散文作文大全-作文网
简介:作文网优秀初中散文800字作文大全,包含初中散文800字作文素材,初中散文800字作文题目、美文范文,作文网原创名师点评
-
2026-03-02 13:06:05
图片素材
成功
标题:初一看图作文650字 初一650字看图作文大全-作文网
简介:作文网优秀初一看图650字作文大全,包含初一看图650字作文素材,初一看图650字作文题目、美文范文,作文网原创名师点评
-
2026-03-02 12:30:18
综合导航
成功
标题:Geiles Sommer-angebot!!!! [Archiv] - BW7 Forum
简介:Premiere in Karlsruhe!!!! Santa, 21 J. - absolute Traumfr
-
2026-03-02 11:32:00
图片素材
成功
标题:四年级叙事作文900字 四年级900字叙事作文大全-作文网
简介:作文网优秀四年级叙事900字作文大全,包含四年级叙事900字作文素材,四年级叙事900字作文题目、美文范文,作文网原创名
-
2026-03-02 10:57:06
综合导航
成功
标题:英语单词顺口溜-励志一生
简介:英语单词顺口溜_ 英语单词顺口溜 1、饮料 water 水,别浪费, 牛奶milk真美味。 果汁juice 很
-
2026-03-02 11:48:41
游戏娱乐
成功
标题:天尊传奇官服,天尊传奇礼包,开服表,新服,九职业-03u《天尊传奇》天尊13区11月13日 00:20火爆开启
简介:03游戏天尊传奇,天尊传奇传奇,零三游戏,正版传奇,官方正版授权,绿色服,网页游戏新服礼包,游戏攻略,开服表,网页游戏平
-
2026-03-02 13:05:22
综合导航
成功
标题:Chelsea Flower Show Garden For GOSH Morgan Stanley
简介:Discover the inspiration for Morgan Stanley’s 2016 Chelsea F
-
2026-03-02 12:44:34
教育培训
成功
标题:[精]二年级作文6篇
简介:在现实生活或工作学习中,大家都有写作文的经历,对作文很是熟悉吧,作文是经过人的思想考虑和语言组织,通过文字来表达一个主题
-
2026-03-02 12:29:24
综合导航
成功
标题:Hotel Canada - Book top hotels cheaply with HRS!
简介:Book hotels with HRS and save up to 50%: Enjoy exclusive ben
-
2026-03-02 13:05:58
教育培训
成功
标题:一件有趣的事作文实用【15篇】
简介:在学习、工作、生活中,大家都跟作文打过交道吧,作文是人们以书面形式表情达意的言语活动。一篇什么样的作文才能称之为优秀作文
-
2026-03-02 13:14:21
综合导航
成功
标题:Volvo Concept Estate (2014) Información general - km77.com
简介:El Volvo Concept Estate es un prototipo con carrocería famil
-
2026-03-02 09:57:23
教育培训
成功
标题:2024年FRM5月考试早鸟报名截止日期?-高顿教育
简介:FRM是金融风险管理师的认证考试,一般来说,FRM考试每年都有两个考期,分别在5月和11月,但FRM考期近些年有变化,2
-
2026-03-02 11:55:23
综合导航
成功
标题:åèªçæ¼é³_åèªçææ_åèªçç¹ä½_è¯ç»ç½
简介:è¯ç»ç½åèªé¢é,ä»ç»åèª,åèªçæ¼é³,åèªæ¯
-
2026-03-02 13:31:25
综合导航
成功
标题:Understanding the Certificate of Completion in Construction: Importance, Process, and Benefits
简介:Certificate of Completion in construction. Learn how it ensu
-
2026-03-02 11:44:12
综合导航
成功
标题:舌尖上的初三作文
简介:无论是在学校还是在社会中,大家对作文都不陌生吧,作文是由文字组成,经过人的思想考虑,通过语言组织来表达一个主题意义的文体
-
2026-03-02 14:03:12
教育培训
成功
标题:实用的春节英语作文汇编七篇
简介:在日常学习、工作抑或是生活中,大家都尝试过写作文吧,通过作文可以把我们那些零零散散的思想,聚集在一块。那么你知道一篇好的
-
2026-03-02 12:14:37
图片素材
成功
标题:金桂的作文 描写金桂的作文 关于金桂的作文 素材-作文网
简介:作文网精选关于金桂的作文,包含金桂的作文素材,关于金桂的作文题目,以金桂为话题的作文大全,作文网原创名师点评,欢迎投稿!
-
2026-03-02 12:21:33
综合导航
成功
标题:春节的小学作文(优选4篇)
简介:无论是在学校还是在社会中,大家总少不了接触作文吧,作文要求篇章结构完整,一定要避免无结尾作文的出现。相信许多人会觉得作文
-
2026-03-02 09:57:21
教育培训
成功
标题:有关写人优秀作文集锦十篇
简介:在日常学习、工作抑或是生活中,大家都不可避免地要接触到作文吧,作文根据写作时限的不同可以分为限时作文和非限时作文。那么,
-
2026-03-02 12:16:01
图片素材
成功
标题:大话的作文 描写大话的作文 关于大话的作文 素材-作文网
简介:作文网精选关于大话的作文,包含大话的作文素材,关于大话的作文题目,以大话为话题的作文大全,作文网原创名师点评,欢迎投稿!
-
2026-03-02 08:57:19
综合导航
成功
标题:Platen Assemblies ELE International
简介:Browse our range of Platen Assemblies online. ELE Internatio
-
2026-03-02 10:39:17
综合导航
成功
标题:经典语录:要因为自己的不配错过在乎的人-励志一生
简介:经典语录:要因为自己的不配错过在乎的人_经典语录:要因为自己的不配错过在乎的人 1、总有一天,我也会变成一个充满烦恼的
-
2026-03-02 10:54:24
图片素材
成功
标题:男孩的作文 描写男孩的作文 关于男孩的作文 素材-作文网
简介:作文网精选关于男孩的作文,包含男孩的作文素材,关于男孩的作文题目,以男孩为话题的作文大全,作文网原创名师点评,欢迎投稿!
-
2026-03-02 11:45:22
教育培训
成功
标题:移动公司招聘什么专业?专业要求汇总!-高顿教育
简介:中国移动作为国内领先的通信运营商,业务涵盖通信网络运营、信息技术服务、大数据处理、人工智能研发等多个领域。每年到进行校园
-
2026-03-02 13:27:30
综合导航
成功
标题:How to Prepare for the 2024 Hurricane Season ICF
简介:Prepare for hurricane season by reviewing the patterns, succ
-
2026-03-02 10:03:20
综合导航
成功
标题:乱世女将星_残爱如风_第四十六章 开诚布公_风云中文网
简介:风云中文网提供乱世女将星(残爱如风)第四十六章 开诚布公在线阅读,所有小说均免费阅读,努力打造最干净的阅读环境,24小时
-
2026-03-02 10:30:19
综合导航
成功
标题:Central Limit Theorem Archives - Making Sense of the Infinite
简介:Central Limit Theorem Archives - Making Sense of the Infinit
-
2026-03-02 12:27:52
综合导航
成功
标题:High Court grants interim injunction - 5RB Barristers
简介:High Court grants interim injunction - News