-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·86 lines (68 loc) · 2.02 KB
/
setup.sh
File metadata and controls
executable file
·86 lines (68 loc) · 2.02 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
# Product Data Explorer - Quick Start Script
# This script helps you quickly set up and run the application
set -e
echo "🚀 Product Data Explorer - Quick Start"
echo "======================================"
echo ""
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
# Check if Node.js is installed
if ! command -v node &> /dev/null; then
echo -e "${RED}❌ Node.js is not installed. Please install Node.js 18+ first.${NC}"
exit 1
fi
echo -e "${GREEN}✅ Node.js version: $(node --version)${NC}"
# Check if npm is installed
if ! command -v npm &> /dev/null; then
echo -e "${RED}❌ npm is not installed.${NC}"
exit 1
fi
echo -e "${GREEN}✅ npm version: $(npm --version)${NC}"
echo ""
# Backend setup
echo -e "${YELLOW}📦 Setting up Backend...${NC}"
cd backend
if [ ! -d "node_modules" ]; then
echo "Installing backend dependencies..."
npm install
fi
if [ ! -f ".env" ]; then
echo "Creating .env file from .env.example..."
cp .env.example .env
echo -e "${YELLOW}⚠️ Please update DATABASE_URL in backend/.env before continuing${NC}"
echo "Press Enter after updating the .env file..."
read
fi
echo "Generating Prisma Client..."
npx prisma generate
echo "Running database migrations..."
npx prisma migrate dev --name init || true
echo -e "${GREEN}✅ Backend setup complete!${NC}"
echo ""
# Frontend setup
echo -e "${YELLOW}📦 Setting up Frontend...${NC}"
cd ../frontend
if [ ! -d "node_modules" ]; then
echo "Installing frontend dependencies..."
npm install
fi
echo -e "${GREEN}✅ Frontend setup complete!${NC}"
echo ""
# Start servers
echo -e "${GREEN}🎉 Setup Complete!${NC}"
echo ""
echo "To start the application:"
echo ""
echo "1. Start Backend (in one terminal):"
echo -e " ${YELLOW}cd backend && npm run start:dev${NC}"
echo ""
echo "2. Start Frontend (in another terminal):"
echo -e " ${YELLOW}cd frontend && npm run dev${NC}"
echo ""
echo "Then visit: http://localhost:3001"
echo ""
echo "Happy exploring! 🚀"