Repository navigation
Expand file tree
/
Copy pathsetup-m1.sh
More file actions
executable file
·70 lines (60 loc) · 1.99 KB
/
Copy pathsetup-m1.sh
File metadata and controls
executable file
·70 lines (60 loc) · 1.99 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
#!/bin/bash
echo "🚀 Setting up Sync M1 - Auth + Couples"
echo "======================================"
# Check if Node.js is installed
if ! command -v node &> /dev/null; then
echo "❌ Node.js is not installed. Please install Node.js 18+ first."
exit 1
fi
# Check Node.js version
NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1)
if [ "$NODE_VERSION" -lt 18 ]; then
echo "❌ Node.js version 18+ is required. Current version: $(node -v)"
exit 1
fi
echo "✅ Node.js version: $(node -v)"
# Install dependencies
echo "📦 Installing dependencies..."
npm install
# Check if PostgreSQL is running
if ! command -v psql &> /dev/null; then
echo "⚠️ PostgreSQL is not installed. Please install PostgreSQL first."
echo " On macOS: brew install postgresql"
echo " On Ubuntu: sudo apt-get install postgresql"
exit 1
fi
echo "✅ PostgreSQL is installed"
# Create environment file if it doesn't exist
if [ ! -f .env ]; then
echo "📝 Creating .env file from template..."
cp infra/env.example .env
echo "✅ .env file created"
echo "⚠️ Please edit .env file and add your configuration:"
echo " - DATABASE_URL: PostgreSQL connection string"
echo " - JWT_SECRET: Random secret key"
echo " - ENCRYPTION_KEY: 32-character encryption key"
echo " - OPENAI_API_KEY: Your OpenAI API key"
else
echo "✅ .env file already exists"
fi
# Build packages
echo "🔨 Building packages..."
npm run build
echo ""
echo "🎉 Setup complete!"
echo ""
echo "📋 Next steps:"
echo "1. Edit .env file with your configuration"
echo "2. Set up PostgreSQL database:"
echo " createdb sync_db"
echo "3. Run database migrations:"
echo " npm run db:migrate"
echo "4. Start the API server:"
echo " cd services/api && npm run dev"
echo "5. Test the API:"
echo " node test-api-client.js"
echo ""
echo "📚 API documentation will be available at:"
echo " http://localhost:3001/docs"
echo ""
echo "🔑 Don't forget to add your OpenAI API key to the .env file!"