railyard/apps/ritgram/scripts/setup-oauth.sh
caelum0x f80b04ae0f feat(ritgram): move GitGram app into railyard as Ritgram, next to Rithub
Moved later/gitgram-ai/gitgram/ to apps/ritgram/ (fresh history; full history stays in caelum0x/gitgram).
AITimeMachine stays separate in later/gitgram-ai per the Rithub master plan.
Logs, pid files and env files are ignored; GPL-3.0 mobile/proximity noted in THIRD_PARTY_NOTICES.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-13 04:18:46 +03:00

157 lines
3.8 KiB
Bash
Executable File

#!/bin/bash
echo "๐Ÿš€ Gitgram OAuth Setup Script"
echo "=============================="
echo ""
# Colors
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
# Check if running from project root
if [ ! -f "package.json" ]; then
echo -e "${RED}โŒ Please run this script from the project root directory${NC}"
exit 1
fi
echo "๐Ÿ“‹ Checking prerequisites..."
echo ""
# Check Node.js
if ! command -v node &> /dev/null; then
echo -e "${RED}โŒ Node.js is not installed${NC}"
exit 1
fi
echo -e "${GREEN}โœ“${NC} Node.js $(node -v)"
# Check npm
if ! command -v npm &> /dev/null; then
echo -e "${RED}โŒ npm is not installed${NC}"
exit 1
fi
echo -e "${GREEN}โœ“${NC} npm $(npm -v)"
# Check PostgreSQL
if ! command -v psql &> /dev/null; then
echo -e "${YELLOW}โš ${NC} PostgreSQL CLI not found (optional)"
else
echo -e "${GREEN}โœ“${NC} PostgreSQL installed"
fi
echo ""
echo "๐Ÿ“ฆ Installing dependencies..."
echo ""
# Install backend dependencies
echo "Installing backend dependencies..."
cd backend
npm install
cd ..
echo -e "${GREEN}โœ“${NC} Backend dependencies installed"
# Install web dependencies
echo "Installing web dependencies..."
cd web
npm install
cd ..
echo -e "${GREEN}โœ“${NC} Web dependencies installed"
echo ""
echo "โš™๏ธ Setting up environment files..."
echo ""
# Backend .env
if [ ! -f "backend/.env" ]; then
cp backend/.env.example backend/.env
echo -e "${YELLOW}โš ${NC} Created backend/.env - Please configure it"
else
echo -e "${GREEN}โœ“${NC} backend/.env exists"
fi
# Web .env.local
if [ ! -f "web/.env.local" ]; then
cp web/.env.example web/.env.local
echo -e "${YELLOW}โš ${NC} Created web/.env.local - Please configure it"
else
echo -e "${GREEN}โœ“${NC} web/.env.local exists"
fi
echo ""
echo "๐Ÿ”‘ OAuth Configuration Needed:"
echo ""
echo "1. GitHub OAuth App:"
echo " โ†’ https://github.com/settings/developers"
echo " โ†’ Callback URL: http://localhost:3000/auth/github/callback"
echo ""
echo "2. Google OAuth Credentials:"
echo " โ†’ https://console.cloud.google.com/apis/credentials"
echo " โ†’ Callback URL: http://localhost:3000/auth/google/callback"
echo ""
echo "3. Update backend/.env with:"
echo " - GITHUB_CLIENT_ID"
echo " - GITHUB_CLIENT_SECRET"
echo " - GOOGLE_CLIENT_ID"
echo " - GOOGLE_CLIENT_SECRET"
echo " - DATABASE_URL"
echo " - JWT_SECRET"
echo ""
echo "4. Update web/.env.local with:"
echo " - NEXT_PUBLIC_GITHUB_CLIENT_ID"
echo " - NEXT_PUBLIC_GOOGLE_CLIENT_ID"
echo ""
read -p "Have you configured the OAuth credentials? (y/n) " -n 1 -r
echo ""
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo -e "${YELLOW}โš ${NC} Please configure OAuth credentials and run this script again"
exit 0
fi
echo ""
echo "๐Ÿ—„๏ธ Setting up database..."
echo ""
cd backend
# Generate Prisma client
echo "Generating Prisma client..."
npx prisma generate
echo -e "${GREEN}โœ“${NC} Prisma client generated"
# Run migrations
echo "Running database migrations..."
if npx prisma migrate deploy 2>/dev/null; then
echo -e "${GREEN}โœ“${NC} Database migrations applied"
else
echo -e "${YELLOW}โš ${NC} Migration failed - you may need to run 'npx prisma migrate dev' manually"
fi
cd ..
echo ""
echo "โœ… Setup Complete!"
echo ""
echo "๐Ÿš€ To start the application:"
echo ""
echo "Terminal 1 (Backend):"
echo " cd backend && npm run dev"
echo ""
echo "Terminal 2 (Frontend):"
echo " cd web && npm run dev"
echo ""
echo "Or use the root command:"
echo " npm run dev"
echo ""
echo "๐Ÿ“ Access the application:"
echo " Frontend: http://localhost:3000"
echo " Backend: http://localhost:4000"
echo ""
echo "๐Ÿ“š Next steps:"
echo " 1. Test GitHub login at http://localhost:3000/login"
echo " 2. Test Google login at http://localhost:3000/login"
echo " 3. Claim account at http://localhost:3000/claim"
echo " 4. Sync projects at http://localhost:3000/projects"
echo ""