Skip to main content

Installation

Installation Scripts

Once you've completed the aforementioned steps, you can execute the following commands in the terminal/command prompt from the project's root directory.The following commands will help you run the project in development mode.

CommandDescription
pnpm installThis process will install all the necessary dependencies into the node_modules folder.
docker-compose up -dWhen the command exits, all containers are stopped. Running docker compose up -d starts the containers in the background and leaves them running.
pnpm db:push && pnpm db:seedIt pushes database schemas and populate some important table like permission and Roles .
pnpm devIt launches the project locally, initiates the development server, and monitors any changes in your code. You can access the development server at http://localhost:3000
pnpm stripe:listenThe stripe:listen runs and monitors stripe webhook process on the project locally

Resolve Canvas Installation Error In MacOS

You may encounter an error running pnpm install command due to canvas package if you are setting up your environment in MacOs.The error can look like as following:

 node_modules/.pnpm/canvas@2.11.2/node_modules/canvas: Running install script, failed in 2.3s
│ node-pre-gyp ERR! build error
│ node-pre-gyp ERR! stack Error: Failed to execute '/Users/user/.nvm/versions/node/v20.9.0/bin/node /Users/user/Library/pnpm/global/5/.pnpm/pnpm@9.1.2/node_modules/pnpm/dist/node_modules/node-gyp/bin…
│ node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/Users/user/Downloads/filekit 2/node_modules/.pnpm/@mapbox+node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
│ node-pre-gyp ERR! stack at ChildProcess.emit (node:events:514:28)
...............
...............
...............
...............
│ node-pre-gyp ERR! node -v v20.9.0
│ node-pre-gyp ERR! node-pre-gyp -v v1.0.11
│ node-pre-gyp ERR! not ok
│ Failed to execute '/Users/user/.nvm/versions/node/v20.9.0/bin/node /Users/user/Library/pnpm/global/5/.pnpm/pnpm@9.1.2/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js configure --fallba…
└─ Failed in 2.3s at /Users/user/Downloads/filekit 2/node_modules/.pnpm/canvas@2.11.2/node_modules/canvas
 ELIFECYCLE  Command failed with exit code 1.

For Resolving this issue you will need to install some dependencies in your macOs environment manually .Please follow the instructions bellow :

  • Install Dependencies:Install the required dependencies using Homebrew. Open a terminal and run the following commands:

    brew install pkg-config cairo pango libpng jpeg giflib

  • Set PKG_CONFIG_PATH: Export PKG_CONFIG_PATH to include the directory containing pixman-1.pc. Add the following line to your shell profile file (e.g., ~/.zshrc or ~/.bashrc):

    export PKG_CONFIG_PATH="/opt/homebrew/opt/pixman/lib/pkgconfig"

    .

  • Reinstall Node Modules: Remove the node_modules directory and package-lock.json file from your project and then reinstall the dependencies:

    rm -rf node_modules
    pnpm install

You can additionally follow the canvas installation guide canvas. You can also follow this stackoverflow thread for the solution.

Avaiable Scripts

Check your package.json file for avaiable scripts:

"scripts": {
"dev": "next dev",
"build": "pnpm db:migrate && pnpm db:seed && next build",
"start": "next start",
"lint": "next lint",
"format": "prettier --write .",
"dev:email": "email dev --dir src/email-templates --port 3001",
"test:e2e": "playwright test",
"db:ui": "drizzle-kit studio",
"db:push": "drizzle-kit push:pg --config=drizzle.config.ts",
"db:generate": "drizzle-kit generate:pg --config=drizzle.config.ts",
"db:drop": "drizzle-kit drop --config=drizzle.config.ts",
"db:check": "drizzle-kit check:pg --config=drizzle.config.ts",
"db:clean": "node -r @swc-node/register ./src/db/clean.ts",
"db:seed": "node -r @swc-node/register ./src/db/seed.ts",
"db:migrate": "node -r @swc-node/register ./src/db/migrate.ts",
"stripe:listen": "stripe listen --forward-to localhost:3000/api/stripe/webhook"
}

Here are some additional commands that you can use during production build

CommandDescription
pnpm buildThe pnpm build orchestrates the construction of the project, creating any necessary build files and optimizing the application for deployment.
pnpm startThe pnpm start launches the locally built application in production mode, providing a ready-to-deploy version of the project
pnpm db:uiThe command emulates database client for inspecting your database tables in the browser
pnpm db:generateThe command is used for generating database table based on drizzle ORM schema
pnpm db:dropThis command is used for droping your database
pnpm db:cleanThe command cleans all your data from database table
pnpm dev:emailCheck and test your email configuration by using this command
pnpm make:adminThis command is used for updating your application user role