Your AI Parking System backend is trying to connect to PostgreSQL database, but PostgreSQL is not running. This causes the ECONNREFUSED ::1:5432 error.
# Run this command in your project root directory:
docker-compose -f docker-compose.dev.yml up -d# Wait 10-15 seconds for PostgreSQL to start, then check:
docker psYou should see ai-parking-postgres-dev container running.
- Stop your current backend (Ctrl+C)
- Start it again:
cd backend
npm run dev# Windows
setup-database.bat
# The script will:
# 1. Check if Docker is installed
# 2. Start PostgreSQL and Redis containers
# 3. Wait for them to be readyIf you don't want to use Docker:
- Download PostgreSQL: https://www.postgresql.org/download/
- Install and start the service
- Create database:
CREATE DATABASE ai_parking_system;
- Run the schema:
psql -U postgres -d ai_parking_system -f database/init.sql
# Windows
start-system.bat
# This will:
# 1. Check all dependencies
# 2. Install npm packages if needed
# 3. Start database
# 4. Start backend and frontendAfter starting the database, you should see:
β
Database initialized successfully!
π AI Parking System Backend running on port 3000
Instead of the connection errors.
# Check Docker containers
docker ps
# Should show ai-parking-postgres-dev running on port 5432# Connect to database
docker exec -it ai-parking-postgres-dev psql -U postgres -d ai_parking_system
# You should see a PostgreSQL prompt
# Type \q to exitMake sure you have a .env file in your project root with:
DB_HOST=localhost
DB_PORT=5432
DB_NAME=ai_parking_system
DB_USER=postgres
DB_PASSWORD=password
After fixing the database connection, you should see:
π Attempting database connection (attempt 1/5)...
β
Database initialized successfully!
π Sample data inserted successfully
π AI Parking System Backend running on port 3000
π Environment: development
π Frontend URL: http://localhost:5173
Check the full TROUBLESHOOTING.md file for detailed solutions to other common issues.
TL;DR: Run docker-compose -f docker-compose.dev.yml up -d to start PostgreSQL, then restart your backend server.