-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
Β·51 lines (43 loc) Β· 1.38 KB
/
setup.sh
File metadata and controls
executable file
Β·51 lines (43 loc) Β· 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
echo "π Setting up MERN Chat Application..."
# Check if Node.js is installed
if ! command -v node &> /dev/null; then
echo "β Node.js is not installed. Please install Node.js first."
exit 1
fi
# Check if MongoDB is running
if ! pgrep -x "mongod" > /dev/null; then
echo "β οΈ MongoDB is not running. Please start MongoDB first."
echo " You can start it with: sudo systemctl start mongod"
echo " Or run: mongod"
fi
# Install backend dependencies
echo "π¦ Installing backend dependencies..."
cd backend
npm install
# Install frontend dependencies
echo "π¦ Installing frontend dependencies..."
cd ../frontend
npm install
# Create uploads directory
echo "π Creating uploads directory..."
cd ../backend
mkdir -p uploads
# Create .env file if it doesn't exist
if [ ! -f .env ]; then
echo "π§ Creating .env file..."
cat > .env << EOF
JWT_SECRET=your_super_secret_jwt_key_here_change_this_in_production
MONGO_URI=mongodb://127.0.0.1:27017/chat-app
PORT=3000
FRONTEND_URL=http://localhost:5173
EOF
echo "β
.env file created. Please update JWT_SECRET with a secure value."
fi
echo "β
Setup complete!"
echo ""
echo "To start the application:"
echo "1. Start MongoDB: sudo systemctl start mongod"
echo "2. Start backend: cd backend && npm run dev"
echo "3. Start frontend: cd frontend && npm run dev"
echo "4. Open http://localhost:5173 in your browser"