Files
office_translator/scripts/run-dev.sh
Sepehr Ramezani 26bd096a06 feat: production deployment - full update with providers, admin, glossaries, pricing, tests
Major changes across backend, frontend, infrastructure:
- Provider system with model selection (Google, DeepL, OpenAI, Ollama, Google Cloud)
- Admin panel: user management, pricing, settings
- Glossary system with CSV import/export
- Subscription and tier quota management
- Security hardening (rate limiting, API key auth, path traversal fixes)
- Docker compose for dev, prod, and IONOS deployment
- Alembic migrations for new tables
- Frontend: dashboard, pricing page, landing page, i18n (en/fr)
- Test suite and verification scripts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-25 15:01:47 +02:00

86 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Lance le backend (FastAPI) et le frontend (Next.js) pour tester l'application.
# Usage: ./scripts/run-dev.sh
# Arrêt: Ctrl+C
set -e
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT"
BACKEND_PID=""
FRONTEND_PID=""
cleanup() {
echo ""
echo "Arrêt en cours..."
[ -n "$BACKEND_PID" ] && kill "$BACKEND_PID" 2>/dev/null || true
[ -n "$FRONTEND_PID" ] && kill "$FRONTEND_PID" 2>/dev/null || true
exit 0
}
trap cleanup SIGINT SIGTERM
# Libère les ports 8000 et 3000 si déjà utilisés (ex: ancienne session)
kill_port() {
local port=$1
local pids
pids=$(lsof -ti ":$port" 2>/dev/null) || true
if [ -n "$pids" ]; then
echo "Libération du port $port (PID: $pids)..."
echo "$pids" | xargs kill -9 2>/dev/null || true
sleep 1
fi
}
kill_port 8000
kill_port 3000
# Dossiers nécessaires
mkdir -p uploads outputs temp
# .env depuis .env.example si absent
if [ ! -f .env ]; then
echo "Création de .env à partir de .env.example"
cp .env.example .env
fi
echo "=============================================="
echo " Office Translator - Backend + Frontend"
echo "=============================================="
echo ""
# Backend avec le venv du projet
if [ -d ".venv" ]; then
source .venv/bin/activate
elif [ -d "venv" ]; then
source venv/bin/activate
fi
echo "Démarrage du backend (FastAPI) sur http://localhost:8000 ..."
python main.py &
BACKEND_PID=$!
# Laisser le backend démarrer
sleep 2
echo "Démarrage du frontend (Next.js) sur http://localhost:3000 ..."
if [ ! -d "frontend/node_modules" ]; then
echo "Installation des dépendances frontend (npm install)..."
(cd frontend && npm install)
fi
(cd frontend && npx next dev --webpack) &
FRONTEND_PID=$!
echo ""
echo "=============================================="
echo " Application prête"
echo "=============================================="
echo " Frontend: http://localhost:3000"
echo " Backend: http://localhost:8000"
echo " API Docs: http://localhost:8000/docs"
echo " Santé: http://localhost:8000/health"
echo "=============================================="
echo " Arrêter: Ctrl+C"
echo ""
wait