This guide will help you set up Spatial-RAG from scratch.
Before pushing to GitHub, ensure:
-
.envfile is NOT committed (it's in.gitignore) -
.env.examplecontains no sensitive data (no API keys) - All sensitive credentials are removed from code
- Docker images build successfully
- README.md is up to date
- LICENSE file is present
git clone https://github.com/yourusername/Spatial-RAG.git
cd Spatial-RAG# Copy example environment file
cp .env.example .env
# Edit .env and add your credentials
# IMPORTANT: Never commit .env to git!
nano .env # or use your preferred editorRequired for LLM synthesis:
- Add your
OPENAI_API_KEYto.env(optional - system works without it using mock responses)
Database credentials (defaults work with Docker):
DATABASE_HOST=db(uselocalhostif running DB locally)DATABASE_PASSWORD=postgres(change in production!)
# Build and start all services
docker-compose up -d --build
# Check logs
docker-compose logs -f# Check database
docker exec -it spatial_rag_db psql -U postgres -d spatial_rag -c "SELECT PostGIS_version();"
# Check API
curl http://localhost:8080/health
# Check frontend (should return HTML)
curl http://localhost:3000 | head -20# Generate and insert 500 synthetic documents
docker exec -it spatial_rag_api python /app/seed.py 500- Frontend: http://localhost:3000
- API Docs: http://localhost:8080/docs
- Health: http://localhost:8080/health
If ports 3000, 8080, or 5432 are already in use:
- Edit
docker-compose.ymlto change port mappings - Or stop the conflicting service
# Check logs
docker-compose logs db
# Remove old volume and restart
docker-compose down -v
docker-compose up -d db# Check API logs
docker-compose logs api
# Restart API
docker-compose restart api
# Rebuild if needed
docker-compose up -d --build api# Clear cache and rebuild
cd frontend
rm -rf .next node_modules
npm install
npm run devFor production deployment:
- Change default passwords in
.env - Use environment-specific configs (
.env.production) - Enable SSL/TLS for API and frontend
- Set up proper database backups
- Configure CORS appropriately in
api/app/main.py - Use production Docker images (not
:latesttags) - Set up monitoring and logging
- Configure rate limiting for API endpoints
- Read README.md for detailed usage
- Check CONTRIBUTING.md if you want to contribute
- Explore the API at http://localhost:8080/docs
- Try different queries in the frontend