Initialize a new project with the default package.json
:
yarn init -y
Install runtime dependencies for your project:
yarn add express dotenv cors express-validator @prisma/client
Install TypeScript and type definitions for Node.js, Express, dotenv, and cors:
yarn add -D typescript @types/node @types/express @types/dotenv @types/cors
Install development dependencies, including Prisma, esbuild-register, and nodemon:
yarn add -D prisma esbuild-register nodemon
Initialize Prisma with SQLite as the data source provider:
yarn prisma init --datasource-provider sqlite
Push the Prisma schema to the database:
yarn prisma db push
Seed the database with initial data using Prisma:
yarn prisma db seed
Generate the Prisma Client based on your schema:
yarn prisma generate
Install ESLint, Prettier, and related configurations and plugins for code linting and formatting:
yarn add -D eslint prettier eslint-plugin-prettier eslint-config-prettier eslint-config-airbnb-base eslint-plugin-node eslint-config-node
Initialize ESLint configuration:
yarn eslint --init
These yarn
commands provide the equivalent functionality to the provided npm
commands, helping you manage your Node.js project, set up Prisma, and maintain code quality with ESLint and Prettier.
Install the dependencies
yarn add swagger-autogen swagger-ui-express
Install the types
yarn add --dev @types/swagger-ui-express
Install the dependencies
yarn add express-validator