Follow these steps to set up the project on a new laptop.
- Node.js: Install version 18.x or higher.
- MySQL: Install MySQL 8.0+.
- Git: Ensure Git is installed for cloning (or copy the folder directly).
You need to create the database and run the schema scripts.
-
Create Database:
CREATE DATABASE criminal_detection_db;
-
Import Schemas: Run these files from the
server/extrasfolder in your MySQL client:schema.sql(Main system schema)complaints_schema.sql(Complaints specific schema)Notification.sql(Notifications schema)
-
Run Migration Scripts (Optional/Correction): If you need to migrate historical data or normalize area names:
cd server node scripts/migrate_complaints.js node src/scripts/migrate_areas.js
Create a .env file in the server directory with the following content:
PORT=5000
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=your_mysql_password
DB_NAME=criminal_detection_db
JWT_SECRET=your_secret_key_hereThe project uses face-api.js, but the model files are often large and might be missing if they weren't part of the git repo.
-
Download the following models from here:
ssd_mobilenetv1_model-weights_manifest.jsonssd_mobilenetv1_model-shard1ssd_mobilenetv1_model-shard2face_landmark_68_model-weights_manifest.jsonface_landmark_68_model-shard1face_recognition_model-weights_manifest.jsonface_recognition_model-shard1face_recognition_model-shard2
-
Place these files in:
client/public/models/(create the directory if it doesn't exist).
- Install Dependencies:
# In /server npm install # In /client (or root if using Vite/React) npm install
- Start Backend:
cd server npm run dev - Start Frontend:
cd client npm run dev
- If the migration script fails, check if the
server/extrasfolder exists and contains the.sqlfiles. - Ensure your MySQL user has permission to create and update tables.