Skip to content

πŸ‹πŸ₯ Fruits API: This time by extracting the Prisma client into its own package

Notifications You must be signed in to change notification settings

cedric25/fruits-api-yarn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

try-yarn-workspaces

This is a rewrite of https://github.com/cedric25/try-ts-fastify-prisma

My goal here was to give Prisma Client its own separate package, in order for it to be used in more than just one backend.

packages/prisma: Prisma schema, migration scripts, Prisma client creation

packages/server: fastify server for the Fruits API, using the above Prisma client

Startup

Be sure you're running the latest Yarn version:
$ yarn set version berry
(3.2.0 at the time of writing)

$ yarn install

Build 'prisma' package and generate Prisma client (the actual Prisma client + its types)
$ yarn workspace @fruits/prisma run build

Start TypeScript watch: $ yarn workspace @fruits/server watch

Open a new terminal and run server:
$ yarn workspace @fruits/server dev

ℹ️ Note in .yarnrc.yml that we are not using Yarn PnP mode: nodeLinker: node-modules (Which is not yet compatible with Prisma?)

ℹ️ Note in .gitignore that we are not using Yarn "Zero Install" mode: #!.yarn/cache

To improve

  • Find a better way to handle _moduleAliases config (Not nice to keep it in the root package.json)

To do

  • Work on CI / CD

Useful resources

About

πŸ‹πŸ₯ Fruits API: This time by extracting the Prisma client into its own package

Resources

Stars

Watchers

Forks