open-notebook/dev-init.sh
Luis Novo 22f06af0bc fix: invalidate sourcesInfinite query key on source creation (#526)
useCreateSource and useFileUpload only invalidated QUERY_KEYS.sources()
which doesn't match the infinite scroll query key used by the notebook
page (QUERY_KEYS.sourcesInfinite()). Added sourcesInfinite invalidation
to both hooks so the source list auto-refreshes after adding sources.
2026-04-06 07:05:02 -03:00

43 lines
1.2 KiB
Bash
Executable file

#!/bin/bash
# Development environment startup for Open Notebook
# Assumes SurrealDB is already running externally (per .env config)
set -e
echo "=== Open Notebook Dev Startup ==="
# Check SurrealDB connectivity
SURREAL_PORT=${SURREAL_PORT:-8018}
echo "Checking SurrealDB on port $SURREAL_PORT..."
if ! nc -z localhost "$SURREAL_PORT" 2>/dev/null; then
echo "❌ SurrealDB not reachable on port $SURREAL_PORT. Please start it first."
exit 1
fi
echo "✅ SurrealDB is running"
# Install dependencies if needed
echo "Syncing Python dependencies..."
uv sync
echo "Syncing frontend dependencies..."
cd frontend && npm install && cd ..
# Start API backend in background
echo "Starting API backend (port 5055)..."
uv run --env-file .env run_api.py &
sleep 3
# Start background worker in background
echo "Starting background worker..."
uv run --env-file .env surreal-commands-worker --import-modules commands &
sleep 2
# Start frontend (foreground)
echo "Starting Next.js frontend (port 3000)..."
echo ""
echo "✅ All services starting!"
echo " Frontend: http://localhost:3000"
echo " API: http://localhost:5055"
echo " API Docs: http://localhost:5055/docs"
echo ""
cd frontend && npm run dev