first commit

This commit is contained in:
2026-03-11 16:28:04 +08:00
commit c0f9ddabbf
101 changed files with 11601 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: fundtracer
POSTGRES_PASSWORD: fundtracer_dev
POSTGRES_DB: fundtracer
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U fundtracer"]
interval: 5s
timeout: 3s
retries: 5
redis:
image: redis:7-alpine
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
volumes:
pgdata:

45
infra/scripts/start-dev.sh Executable file
View File

@@ -0,0 +1,45 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
echo "==> Starting infrastructure (PostgreSQL + Redis)..."
cd "$PROJECT_ROOT/infra/docker"
docker compose up -d
echo " Waiting for services to be healthy..."
sleep 3
echo "==> Installing backend dependencies..."
cd "$PROJECT_ROOT/backend"
pip install -e ".[dev]" -q
echo "==> Running database migrations..."
cd "$PROJECT_ROOT/backend"
alembic upgrade head 2>/dev/null || echo " (run 'alembic revision --autogenerate' first if no migrations exist)"
echo "==> Seeding demo data..."
cd "$PROJECT_ROOT/backend"
python -m scripts.seed 2>/dev/null || echo " (seed may fail if data already exists)"
echo "==> Starting backend (uvicorn)..."
cd "$PROJECT_ROOT/backend"
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000 &
BACKEND_PID=$!
echo "==> Starting frontend (vite)..."
cd "$PROJECT_ROOT/frontend"
npm run dev &
FRONTEND_PID=$!
echo ""
echo "======================================"
echo " Backend: http://localhost:8000"
echo " Frontend: http://localhost:5173"
echo " API Docs: http://localhost:8000/docs"
echo "======================================"
echo ""
echo "Press Ctrl+C to stop all services."
trap "kill $BACKEND_PID $FRONTEND_PID 2>/dev/null; docker compose -f $PROJECT_ROOT/infra/docker/docker-compose.yml down" EXIT
wait