# Complete Setup Instructions ## Current Status ✅ **Completed:** - Dependencies installed (backend & frontend) - Prisma client generated - Environment files created - Prisma schema fixed ⏳ **Remaining (requires PostgreSQL authentication):** ## Step-by-Step Completion ### 1. Configure Database Connection You need to set up PostgreSQL database access. Choose one method: #### Option A: Using Docker (Easiest - No Password Needed) ```bash # Start PostgreSQL container docker-compose up -d postgres # Update backend/.env DATABASE_URL="postgresql://asle:asle_password@localhost:5432/asle?schema=public" ``` #### Option B: Local PostgreSQL (Requires Password) ```bash # Create database (you'll need PostgreSQL admin password) sudo -u postgres psql << EOF CREATE DATABASE asle; CREATE USER asle WITH PASSWORD 'asle_password'; GRANT ALL PRIVILEGES ON DATABASE asle TO asle; EOF # Update backend/.env DATABASE_URL="postgresql://asle:asle_password@localhost:5432/asle?schema=public" ``` #### Option C: Use Existing PostgreSQL If you have PostgreSQL running with different credentials: ```bash # Update backend/.env with your connection string DATABASE_URL="postgresql://your_user:your_password@localhost:5432/asle?schema=public" ``` ### 2. Run Complete Setup After configuring the database: ```bash cd backend # Run migrations npm run prisma:migrate # Initialize database npm run setup:db # Create admin user npm run setup:admin ``` Or use the automated script: ```bash cd backend ./setup-complete.sh ``` ### 3. Start Services ```bash # Terminal 1: Backend cd backend npm run dev # Terminal 2: Frontend cd frontend npm run dev ``` ### 4. Access Application - Frontend: http://localhost:3000 - Backend API: http://localhost:4000/api - GraphQL: http://localhost:4000/graphql - Admin: http://localhost:3000/admin ## Troubleshooting ### Database Connection Issues 1. **Verify PostgreSQL is running:** ```bash pg_isready -h localhost -p 5432 ``` 2. **Test connection:** ```bash psql $DATABASE_URL -c "SELECT version();" ``` 3. **Check .env file:** ```bash cat backend/.env | grep DATABASE_URL ``` ### Migration Issues If migrations fail: ```bash cd backend npm run prisma:generate npm run prisma:migrate ``` ### Admin User Creation If admin setup fails, you can create manually: ```bash cd backend npm run setup:admin # Follow prompts to create admin user ``` ## Quick Reference **Database Setup:** - Docker: `docker-compose up -d postgres` - Local: Requires PostgreSQL admin access - See: `DATABASE_SETUP.md` for details **Complete Setup:** ```bash cd backend npm run prisma:migrate npm run setup:db npm run setup:admin ``` **Start Development:** ```bash # Backend cd backend && npm run dev # Frontend cd frontend && npm run dev ```