This project uses the node v20.16.0 (LTS) and npm 10.8.1.
First, we'll need to install frontend, backend dependencies and root dependencies.
npm i
cd client
npm i
cd ../server
npm i
This project uses Prettier and ESLint for automatic formatting and fixing.
Make sure to configure your editor to allow Prettier/ESLint on save.
- On VSCode install the Prettier - Code formatter extension and ESLint extention. Once installed and enabled, you may need to restart VSCode.
- Set the Prettier: Config Path
- Open Settings using shortcut
Ctrl / Cmd + ,
- Right click on
.prettierrc
and click Copy Path, Set Prettier: Config Path to that path, e.g./home/user/ai-fashion-mirror/.prettierrc
- Open Settings using shortcut
- Integrate with editor:
- File > Preferences > Settings
- Search for 'formatter'
- Set Default Formatter to Prettier - Code formatter
- Check Editor: Format On Save
This project uses an .env
file to store environment variables along with dotenv package to load these variables.
The .env
file is placed at the root. It is configured on the server in server.ts
and configured on the client in next.config.js
.
Currently, you will have the run with frontend and backend in two different terminals.
Note: if you notice that there is 1 high vulnerability after installing dependencies on the the client side, it's because we needed to downgrade to Next v13 as Next v14 is not working on the raspberry pi
# for prototype 2, run client with HTTPS
# in one terminal start the client
cd client
npm run dev -- --experimental-https -H <ip_address>
# in another terminal start the server
cd server
npm run dev
Running with Docker:
Make sure you have Docker Desktop installed, to install Docker Desktop use the following link.
From the root repository run:
Note: The server does not build due to node-webcam (future todo!)
# rebuilds the images for all services (client and server) in the compose.yaml
docker-compose up --build
A forked version of the pi-camera-connect package is used to connect the server with the Raspberry Pi Camera Module.
The forked version supports rpicam-still
and rpicam-vid
. See here for more info on the RPi Camera Module.
The node-wecam package is used to connect the server to your local device's camera, if you're not on the Raspberry Pi.
Installation steps can be found on the link above.
-
Install Visual Studio with C/C++ support in order to run the Makefile. Make sure to select the workload, Desktop development with C++
-
Install Cygwin. Follow the steps here for a detailed installation guide. Once the installer prompts you to Select Pacakges, select the make package.
-
Run the vcvarsall.bat file with your specified architecutre. This file is found in your Program Files, e.g.,
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build
# cd into the directory that the .bat file is located, and run with your architecutre .\vcvarsall.bat amd64
-
Open the Cygwin terminal
# verify that make has been installed make --version # navigate to your device's root directory cd /cygdrive/c # cd to the repo containing node-webcam, e.g. cd ai-fashion-mirror/server/node_modules/node-webcam/src/bindings/CommandCam # run make make