This project uses a set of technologies to facilitate the development of web applications and APIs. The goal of this README is to provide a guide for new project members to integrate more easily and start contributing as soon as possible.
Before running the project, make sure you have Docker Desktop installed. Once you have Docker Desktop installed and running, follow the steps below:
-
cd into the back folder if you haven't already:
cd back
-
Install the required dependencies:
npm i
-
Start the project in docker:
npm run up
-
cd into the back folder if you haven't already:
cd back
-
Install the required dependencies:
npm i
-
Allow npm to use bash commands:
npm config set script-shell "C:\\Program Files\\git\\bin\\bash.exe"
-
Start the project in docker:
npm run up
-
Reset your database and apply all migrations:
npm run prisma:migrate:reset
The above command will start the application and run the migrations using Prisma.
Here are some of the useful scripts you can use:
"dev"
: starts a development server usingnodemon
, which watches for file changes and automatically restarts the server. It runs thesrc/server.ts
file usingts-node/esm
loader with experimental specifier resolution and ignores any changes tonode_modules
."build"
: compiles the TypeScript code into JavaScript code using thetsc
compiler."bundle"
: creates a single-file bundle of the application usingncc
, which includes all the dependencies in the bundle."start"
: starts the server by running thedist/index.js
file generated by thebuild
script."lint"
: lints the TypeScript code in thesrc
folder usingeslint
."lint:fix"
: fixes the linting errors in the TypeScript code in thesrc
folder usingeslint
."prisma:generate"
: generates the Prisma client code based on the schema defined inprisma/schema.prisma
."prisma:studio"
: starts the Prisma Studio web interface to manage the database."prisma:migrate"
: creates a new migration for the database usingprisma migrate dev
with the nameinit
."prisma:migrate:reset"
: resets the database to the initial state by dropping all tables usingprisma migrate reset
."test"
: runs the tests using thevitest
test runner."up"
: changes directory to thescripts
folder and runs theup.sh
script, which starts the database server and other dependencies. Then, it changes directory back to theback
folder and runs theprisma:migrate
script.
- All code contributions must pass the CI/CD pipeline, which includes running linters, tests, and other checks. Please do not try to make pull requests that do not pass these validations.
- Code must follow the project's ESLint configuration. Make sure your editor is configured to use the project's
.eslintrc
file (It should be automatically detected by ESLint if you are using Visual Studio Code). - All code contributions must have accompanying tests.
Here are some useful links to official documentation for the technologies used in this project:
If you are new to TypeScript or Prisma ORM, you may want to watch the following tutorial before diving into the project: REST API with TypeScript and Prisma ORM. This tutorial covers the basics of TypeScript and how it can be used with Node.js to create web applications.