# ======================================== # CREATE .env FILE WITH THESE SETTINGS # ======================================== # Save this as .env in your backend directory NODE_ENV=production PORT=3000 DB_HOST=localhost DB_USER=root DB_PASSWORD=your_mysql_password_here DB_NAME=faceml_db DB_PORT=3306 JWT_SECRET=change-this-to-a-secure-random-string-minimum-32-characters-long SUPER_ADMIN_EMAIL=admin@faceml.com SUPER_ADMIN_PASSWORD=Admin@123 # ======================================== # HOW TO CREATE .env FILE ON SERVER # ======================================== # Method 1: Using nano cd /path/to/backend nano .env # Then copy-paste the above configuration and update values # Method 2: Using echo cat > .env << 'EOF' NODE_ENV=production PORT=3000 DB_HOST=localhost DB_USER=root DB_PASSWORD=your_mysql_password_here DB_NAME=faceml_db DB_PORT=3306 JWT_SECRET=change-this-to-a-secure-random-string SUPER_ADMIN_EMAIL=admin@faceml.com SUPER_ADMIN_PASSWORD=Admin@123 EOF # ======================================== # GENERATE SECURE JWT_SECRET # ======================================== # Run this command to generate a secure random string: node -e "console.log(require('crypto').randomBytes(32).toString('hex'))" # Copy the output and replace JWT_SECRET value # ======================================== # EXAMPLE .env FILE (FILLED OUT) # ======================================== NODE_ENV=production PORT=3000 DB_HOST=localhost DB_USER=faceml_user DB_PASSWORD=MySecureP@ssw0rd123 DB_NAME=faceml_db DB_PORT=3306 JWT_SECRET=a7f8d9e6c5b4a3927f8e9d0c1b2a3f4e5d6c7b8a9f0e1d2c3b4a5f6e7d8c9b0 SUPER_ADMIN_EMAIL=admin@faceml.com SUPER_ADMIN_PASSWORD=Admin@123 # ======================================== # SECURITY NOTES # ======================================== 1. NEVER commit .env file to git 2. Change JWT_SECRET to output from crypto command above 3. Change SUPER_ADMIN_PASSWORD after first login 4. Use strong database password 5. For production, consider using environment variables instead of .env file # ======================================== # VERIFY .env FILE IS WORKING # ======================================== # Start server and check if it connects to database node server.js # You should see: # ✓ Database connected successfully # 🚀 FaceML Backend API Server # Server running on: http://localhost:3000