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:
56
main.py
56
main.py
@@ -1,56 +0,0 @@
|
||||
import subprocess
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import webbrowser
|
||||
|
||||
|
||||
def install_missing_packages():
|
||||
packages = ["uvicorn", "fastapi", "sentence-transformers"]
|
||||
for package in packages:
|
||||
try:
|
||||
__import__(package.replace("-", "_"))
|
||||
except ImportError:
|
||||
print(f"[*] Instalowanie brakującej biblioteki: {package}...")
|
||||
subprocess.check_call([sys.executable, "-m", "pip", "install", package])
|
||||
|
||||
|
||||
def run_archivium():
|
||||
install_missing_packages()
|
||||
base_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
backend_script = os.path.join(base_dir, "Database", "database.py")
|
||||
frontend_dir = os.path.join(base_dir, "TextEditor")
|
||||
|
||||
print("\n--- URUCHAMIANIE SYSTEMU ARCHIVIUM ---")
|
||||
|
||||
print(f"[*] Startuję bazę danych...")
|
||||
backend_process = subprocess.Popen(
|
||||
[sys.executable, backend_script],
|
||||
cwd=os.path.join(base_dir, "Database")
|
||||
)
|
||||
|
||||
print(f"[*] Startuję edytor...")
|
||||
frontend_process = subprocess.Popen(
|
||||
"npm start",
|
||||
shell=True,
|
||||
cwd=frontend_dir,
|
||||
creationflags=subprocess.CREATE_NEW_CONSOLE
|
||||
)
|
||||
|
||||
print("[*] Oczekiwanie na gotowość...")
|
||||
time.sleep(5)
|
||||
|
||||
webbrowser.open("http://localhost:3000")
|
||||
|
||||
try:
|
||||
backend_process.wait()
|
||||
frontend_process.wait()
|
||||
except KeyboardInterrupt:
|
||||
print("\n[*] Zamykanie systemu...")
|
||||
backend_process.terminate()
|
||||
frontend_process.terminate()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_archivium()
|
||||
Reference in New Issue
Block a user