Skip to content

natapokie/ai-fashion-mirror

Repository files navigation

ai-fashion-mirror

Getting started

This project uses the node v20.16.0 (LTS) and npm 10.8.1.

Installing Dependencies

First, we'll need to install frontend, backend dependencies and root dependencies.

npm i
cd client
npm i
cd ../server
npm i

Setting up IDE

This project uses Prettier and ESLint for automatic formatting and fixing.

Make sure to configure your editor to allow Prettier/ESLint on save.

  1. On VSCode install the Prettier - Code formatter extension and ESLint extention. Once installed and enabled, you may need to restart VSCode.
  2. Set the Prettier: Config Path
    1. Open Settings using shortcut Ctrl / Cmd + ,
    2. Right click on .prettierrc and click Copy Path, Set Prettier: Config Path to that path, e.g. /home/user/ai-fashion-mirror/.prettierrc
  3. Integrate with editor:
    1. File > Preferences > Settings
    2. Search for 'formatter'
    3. Set Default Formatter to Prettier - Code formatter
    4. Check Editor: Format On Save

Environment Variables

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.

Running the Code

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

Camera

Testing with the RPi Camera Module

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.

Testing without 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.

More Detailed Steps for Windows

  1. Install Visual Studio with C/C++ support in order to run the Makefile. Make sure to select the workload, Desktop development with C++

  2. Install Cygwin. Follow the steps here for a detailed installation guide. Once the installer prompts you to Select Pacakges, select the make package.

  3. 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
  4. 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •