Monorepo Integration: Unified Backend, Frontend & Documentation
- Reorganize project into monorepo structure - backend/app/ - New FastAPI backend (modular with src/) - backend/legacy/ - Legacy database modules (relational & vector) - frontend/ - React text editor application - Add launcher.py for easy full-stack startup - Complete documentation in README.md - Quick start guide - API endpoints reference - Development setup - Troubleshooting - Refactor main.py to 35 lines (app configuration only) - Update .gitignore for full-stack project - Add CHANGELOG.md with version history (v0.1.0-v0.1.1) Structure is now clean and ready for team collaboration.
This commit is contained in:
83
launcher.py
Normal file
83
launcher.py
Normal file
@@ -0,0 +1,83 @@
|
||||
"""Archivium Launcher - Uruchamia całą aplikację"""
|
||||
import subprocess
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import webbrowser
|
||||
|
||||
|
||||
def install_missing_packages():
|
||||
"""Instaluj brakujące pakiety"""
|
||||
packages = ["uvicorn", "fastapi", "sqlalchemy", "passlib[argon2]"]
|
||||
for package in packages:
|
||||
try:
|
||||
__import__(package.split("[")[0].replace("-", "_"))
|
||||
except ImportError:
|
||||
print(f"[*] Instalowanie: {package}...")
|
||||
subprocess.check_call([sys.executable, "-m", "pip", "install", package])
|
||||
|
||||
|
||||
def run_archivium():
|
||||
"""Uruchom całą aplikację Archivium"""
|
||||
install_missing_packages()
|
||||
|
||||
base_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
backend_dir = os.path.join(base_dir, "backend", "app")
|
||||
frontend_dir = os.path.join(base_dir, "frontend")
|
||||
|
||||
print("\n" + "="*50)
|
||||
print(" ARCHIVIUM - System Zarządzania Archiwum")
|
||||
print("="*50 + "\n")
|
||||
|
||||
print("[1/3] Startuje backend (Port 8000)...")
|
||||
backend_process = subprocess.Popen(
|
||||
[sys.executable, "main.py"],
|
||||
cwd=backend_dir
|
||||
)
|
||||
|
||||
print("[2/3] Startuje frontend (Port 3000)...")
|
||||
try:
|
||||
frontend_process = subprocess.Popen(
|
||||
"npm start",
|
||||
shell=True,
|
||||
cwd=frontend_dir,
|
||||
)
|
||||
except Exception as e:
|
||||
print(f"[!] Uwaga: Nie udało się uruchomić frontendu: {e}")
|
||||
print("[*] Frontend może wymagać: npm install && npm start")
|
||||
frontend_process = None
|
||||
|
||||
print("[3/3] Otwieranie przeglądarki...")
|
||||
time.sleep(3)
|
||||
|
||||
try:
|
||||
webbrowser.open("http://localhost:3000")
|
||||
except Exception as e:
|
||||
print(f"[!] Nie udało się otworzyć przeglądarki: {e}")
|
||||
print("[*] Otwórz ręcznie: http://localhost:3000")
|
||||
|
||||
print("\n" + "="*50)
|
||||
print("✓ Aplikacja uruchomiona!")
|
||||
print(" Backend: http://localhost:8000")
|
||||
print(" Frontend: http://localhost:3000")
|
||||
print(" Docs: http://localhost:8000/docs")
|
||||
print("="*50)
|
||||
print("\nAby zatrzymać: Ctrl+C\n")
|
||||
|
||||
try:
|
||||
backend_process.wait()
|
||||
if frontend_process:
|
||||
frontend_process.wait()
|
||||
except KeyboardInterrupt:
|
||||
print("\n[*] Zatrzymywanie systemu...")
|
||||
backend_process.terminate()
|
||||
if frontend_process:
|
||||
frontend_process.terminate()
|
||||
backend_process.wait()
|
||||
if frontend_process:
|
||||
frontend_process.wait()
|
||||
print("[✓] System zatrzymany")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_archivium()
|
||||
Reference in New Issue
Block a user