Prism: a complete ORM for node.js and typescript

Front end full stack developer 2021-06-18 22:23:46
prism complete orm node.js node


original text :https://www.prisma.io/blog/prisma-the-complete-orm-inw24qjeawmb

Prisma yes Node.js and TypeScript The next generation of ORM. After more than two years of development , We're happy to share all Prisma The tools are ready for production !

Catalog


  • A new paradigm of object relational mapping

    • Databases are hard

    • Prisma-Node.js and TypeScript Integrity ORM

  • Prisma Suitable for any technology stack

  • Prepare for the production of mission critical applications

    • from GraphQL To the database

    • We care about developers

    • The company uses Prisma

    • From prototyping to development to production

    • The next generation Web Based on the framework of Prisma structure

  • Open source and others


A new paradigm of object relational mapping

Prisma Is applicable to Node.js and TypeScript The next generation of open source ORM. It contains the following tools :

  • Prisma Client—— Automatically generated and type safe database client
  • Prisma Migrate—— Declarative data modeling and customizable migration
  • Prisma Studio—— Modern user interface , You can view and edit data

These tools can be used in any Node.js or TypeScript Used together or separately in a project .Prisma The current support PostgreSQL,MySQL,SQLite,SQL Server( preview ).MongoDB The connector for is under development , Please register here Early Access Program .

Databases are hard

Using databases is one of the most challenging areas in application development . Data modeling , Schema migration and writing database queries are common tasks that application developers deal with every day .

stay Prisma, We found that Node.js Although ecosystems are becoming more and more popular in building database supported applications , But there is no modern tool for application developers to handle these tasks .

Application developers should care about data , instead of SQL

As tools become more specialized , Application developers should be able to focus on adding value to the organization , Instead of spending time writing glue code to traverse the layers of the application .

Prisma-Node.js and TypeScript Integrity ORM

Even though Prisma It solves the problem with tradition ORM Similar questions , But its approach to these problems is fundamentally different .

Prisma Data modeling in patterns

Use Prisma when , You can go to Prisma Define the data model in the schema . Here are Prisma Examples of models :

model Post {
id Int @id @default(autoincrement())
title String
content String?
published Boolean @default(false)
author User? @relation(fields: [authorId], references: [id])
authorId Int?
}

model User {
id Int @id @default(autoincrement())
email String @unique
name String?
posts Post[]
}

Each of these models maps to a table in the underlying database , And act as Prisma Client Provide generated data access API The basis of .Prisma Of VS Code Extensions provide syntax highlighting , Automatic completion , Quick fix and many other features , Make data modeling a magical and enjoyable experience .

Use Prisma Migrate Database migration

Prisma Migrate take Prisma The pattern is converted to the desired SQL, To create and change tables in the database . Can pass Prisma CLI Provided prisma migration Command to use it .

PostgreSQL:

CREATE TABLE "Post" (
"id" SERIAL NOT NULL,
"title" TEXT NOT NULL,
"content" TEXT,
"published" BOOLEAN NOT NULL DEFAULT false,
"authorId" INTEGER,

PRIMARY KEY ("id")
);

CREATE TABLE "User" (
"id" SERIAL NOT NULL,
"email" TEXT NOT NULL,
"name" TEXT,

PRIMARY KEY ("id")
);

CREATE UNIQUE INDEX "User.email_unique" ON "User"("email");

ALTER TABLE "Post" ADD FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;

Based on Prisma Patterns are generated automatically SQL At the same time , You can easily customize it according to your specific needs . In this way ,Prisma Migrate There's a good balance between productivity and control .

Use Prisma Client Intuitive and type safe database access

And Prisma Client The main benefit of using them together is , It allows developers to think in objects , So it provides a familiar and natural way to infer its data .

Prisma Client There is no concept of model instances . contrary , It helps to develop a always return to pure JavaScript Object database query . Thanks to the type of generation , You also get automatic completion for these queries .

in addition , As a pair of TypeScript A reward for developers .Prisma Client All results of the query are fully typed . in fact ,Prisma Provides any TypeScript ORM The most powerful type security guarantee in ( You can read and TypeORM Type security comparison of ).

Prisma Studio Modern management interface

Prisma It also provides a modern management interface for your database -- think about it phpMyAdmin, But in 2021 year .

Prisma Suitable for any technology stack

Prisma It's not about the application you're building , And will be a good complement to your technology stack , Whatever technology you like . You can find more about Prisma Information on how to work with your favorite framework or library .

Prepare for the production of mission critical applications

Prisma There has been a lot of development in the past three years , We are very happy to share the results with the developer community .

from GraphQL To the database

Since we started building developer tools , As a company , In the last few years , We have gone through many major product iterations and development processes :

Prisma It's us from being GraphQL The lessons learned by early innovators of ecosystems and the results of insights we have gained from data layers of all sizes, from small start-ups to large businesses .

Since it was first released three years ago ,Prisma It has been used by thousands of companies ,Prisma After the actual test , And ready for mission critical applications .

We care about developers

Prisma It's open development . Our product and engineering teams are monitoring GitHub The problem of , Usually after the question is opened 24 Respond within hours .

The new version is released every two weeks , Contains new features 、bug Repair and a lot of improvement . After every release , We'll all be there Youtube New features on live , And get feedback from the community .

We'll also try to do it through dedicated community support teams , Before the developers put forward about Prisma Any question about , Whether in the Slack,GitHub The forum is still Stackoverflow On , Can help them .

This is the number of our communities :

The company uses Prisma

We are glad to see Prisma How to help companies of all sizes increase productivity and deliver products faster .

In our journey , Adidas 、HyreCar、Agora Systems、Labelbox And other companies provide us with valuable advice on how to develop our products . We are fortunate to work with some of the most innovative and original technology leaders .

If you want to know Prisma How to help these companies increase productivity , Please check out the following resources :

  • Rapha

    • blog——Prisma How to help Rapha Manage their mobile application data
    • Talk——Prisma stay Rapha
  • iopool

    • blog——iopool How to use Prisma In less than 6 Refactoring its applications in six months
    • Talk——Prisma stay ipool

From prototyping to development to production

The best developer tools are the ones that go out of the ordinary , And can easily adapt to the increasing complexity of the project . This is exactly what we designed Prisma The way .

Prisma There's a built-in workflow , Applicable to all phases of the development life cycle , From prototyping to development , To deploy , To CI/CD, To testing and so on .

The next generation Web Based on the framework of Prisma structure

We feel particularly humble , Many framework and library authors choose Prisma As the default of its tools ORM. Here are some uses Prisma The choice of high-level framework :

  • RedwoodJS—— be based on React and GraphQL The whole stack framework of
  • Blitz—— be based on Next.js The whole stack framework of
  • KeystoneJS—— Headless CMS
  • Wasp—— Used based on React Develop full stack Web Application's DSL
  • Amplication—— Used based on React and NestJS Build a toolset of full stack applications

Open source and others

We are a family of VC Funded companies , Its team is keen to improve the lives of application developers . When we start our journey by building open source tools , We are right. Prisma The long-term vision of is far more than building “ only ” ORM Bigger .

In our recent business activities and Prisma At the party , We started to share that vision , We call it Application data platform .

Prisma Our vision is to make Facebook、Twitter and Airbnb And so on , And make it applicable to development teams and organizations of all sizes .

This idea is mainly influenced by Facebook、Twitter and Airbnb And so on , These companies have built custom data access layers based on their databases and other data sources , Make it easier for application developers to access the data they need in a secure and efficient way .

Prisma The goal is to democratize the idea of this custom data access layer , And make it available to development teams and organizations of any size .


Recent articles

Fan benefits

Video tutorial 《 I'll teach you how to play with mobile photography , Take a good picture 》7 Days in effect , Fast access required ! For resources, please reply to the key in the official account dialog box : JK06, All keywords are capitalized ! For more welfare information, please check the official account menu .

版权声明
本文为[Front end full stack developer]所创,转载请带上原文链接,感谢
https://qdmana.com/2021/06/20210604125429018m.html

  1. HTML + CSS + JavaScript to achieve cool Fireworks (cloud like particle text 3D opening)
  2. HTML + CSS + JavaScript realizes 520 advertising love tree (including music), which is necessary for programmers to express themselves
  3. Solve the problem of Web front-end deployment server (it can be deployed online without a server)
  4. HTML + CSS + JS make wedding countdown web page template (520 / Tanabata Valentine's Day / programmer advertisement)
  5. What else can driverless minibus do besides "Park connection"?
  6. Cloud native leads the era of all cloud development
  7. NRM mirror source management tool
  8. Bring it to you, flex Jiugong
  9. Lolstyle UI component development practice (II) -- button group component
  10. Deconstruction assignment in ES6
  11. Luo 2 peerless Tang clan was officially launched. The official gave a key point, and the broadcast time was implied
  12. 20初识前端HTML(1)
  13. 当新零售遇上 Serverless
  14. 20 initial knowledge of front-end HTML (1)
  15. When new retail meets serverless
  16. [golang] - go into go language lesson 5 type conversion
  17. [golang] - go into go language lesson 6 conditional expression
  18. HTML5(八)——SVG 之 path 详解
  19. HTML5 (8) -- detailed explanation of SVG path
  20. 需要开通VIP以后页面内容才能复制怎么办?控制台禁用javascript即可
  21. Web前端|CSS入门教程(超详细的CSS使用讲解,适合前端初学者)
  22. 实践积累 —— 用Vue3简单写一个单行横向滚动组件
  23. Serverless 全能选手,再下一城
  24. What if you need to open a VIP to copy the page content? Just disable JavaScript on the console
  25. Web front end | CSS introductory tutorial (super detailed CSS explanation, suitable for front-end beginners)
  26. Practice accumulation - write a single line horizontal scroll component simply with vue3
  27. Dili Reba is thin again. She looks elegant and high in a strapless hollow skirt, and her "palm waist" is beautiful to a new height
  28. Serverless all-round player, next city
  29. The difference between MySQL semi synchronous replication and lossless semi synchronous replication
  30. Vue表单设计器的终极解决方案
  31. The ultimate solution for Vue form designer
  32. Nginx从理论到实践超详细笔记
  33. Yu Shuxin's red backless swimsuit is split to the waist and tail, with a concave convex figure and excessive color matching, and his face is white to dazzling
  34. Nginx ultra detailed notes from theory to practice
  35. 【动画消消乐|CSS】086.炫酷水波浪Loading过渡动画
  36. typecho全站启用https
  37. CCTV has another popular employee. The off-site interpretation is very professional, and the appearance ability is no less than that of Wang Bingbing
  38. [animation Xiaole | CSS] 086. Cool water wave loading transition animation
  39. Enable HTTPS in Typecho
  40. 50天用JavaScript完成50个web项目,我学到了什么?
  41. 根据JavaScript中原生的XMLHttpRequest实现jQuery的Ajax
  42. What have I learned from completing 50 web projects with JavaScript in 50 days?
  43. "My neighbor doesn't grow up" has hit the whole network. There are countless horse music circles, and actor Zhou Xiaochuan has successfully made a circle
  44. 根据JavaScript中原生的XMLHttpRequest实现jQuery的Ajax
  45. Implement the Ajax of jQuery according to the native XMLHttpRequest in JavaScript
  46. Implement the Ajax of jQuery according to the native XMLHttpRequest in JavaScript
  47. 30 + women still wear less T-shirts and jeans. If they wear them like stars, they will lose weight
  48. 数栈技术分享前端篇:TS,看你哪里逃~
  49. Several stack technology sharing front end: TS, see where you escape~
  50. 舍弃Kong和Nginx,Apache APISIX 在趣链科技 BaaS 平台的落地实践
  51. Abandon the landing practice of Kong and nginx, Apache apisik on the baas platform of fun chain technology
  52. 浪迹天涯king教你用elementui做复杂的表格,去处理报表数据(合并表头,合并表体行和列)
  53. 前端HTML两万字图文大总结,快来看看你会多少!【️熬夜整理&建议收藏️】
  54. Wandering around the world king teaches you to use elementui to make complex tables and process report data (merge header, merge table body rows and columns)
  55. 路由刷新数据丢失 - vuex数据读取的问题
  56. Front end HTML 20000 word graphic summary, come and see how much you can【 Stay up late to sort out & suggestions]
  57. Route refresh data loss - vuex data reading problem
  58. Systemctl系统启动Nginx服务脚本
  59. Systemctl system startup nginx service script
  60. sleepless