From a33b777acaf0df9665f9b6ba10ae51077673c261 Mon Sep 17 00:00:00 2001 From: "n.siegfried" Date: Mon, 15 Jun 2026 10:58:52 -0700 Subject: [PATCH] Add Python/FastAPI + PostgreSQL backend (Phase 1) - server/: FastAPI app with SQLAlchemy models for sops, work_packages, comments - Endpoints for SOP/WP upsert+list+get+delete and comment create+list; /api/feedback kept as an alias so the existing client keeps working - Portable across engines (PostgreSQL prod, SQLite dev fallback) - requirements.txt, .env.example, and server/README.md (Postgres + systemd) - NGINX now proxies /api/ to the API (replaces the Power Automate hop; comments persist to SQL) - Rewrite DEPLOYMENT.md for the API + database architecture - Add .gitignore for venv/.env/sqlite Phase 2 (wire the client apps to the API) is next. Co-Authored-By: Claude Opus 4.8 (1M context) --- .gitignore | 13 +++ DEPLOYMENT.md | 187 +++++++++----------------------- nginx-wp-suite.conf | 36 +++---- server/.env.example | 12 +++ server/README.md | 93 ++++++++++++++++ server/__init__.py | 0 server/app.py | 231 ++++++++++++++++++++++++++++++++++++++++ server/db.py | 41 +++++++ server/models.py | 98 +++++++++++++++++ server/requirements.txt | 7 ++ 10 files changed, 563 insertions(+), 155 deletions(-) create mode 100644 .gitignore create mode 100644 server/.env.example create mode 100644 server/README.md create mode 100644 server/__init__.py create mode 100644 server/app.py create mode 100644 server/db.py create mode 100644 server/models.py create mode 100644 server/requirements.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8be8a9d --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +# Python +__pycache__/ +*.py[cod] +.venv/ +venv/ +*.egg-info/ + +# Local env / secrets +.env + +# Local SQLite dev database +*.db +wpsuite.db diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md index a13c522..3ac9464 100644 --- a/DEPLOYMENT.md +++ b/DEPLOYMENT.md @@ -1,153 +1,57 @@ -# Deployment & Feedback Collection +# Deployment -The Work Package Suite is a **static client-side app** — plain HTML, CSS, and -JavaScript. There is no build step and no database. +The Work Package Suite has two parts: -## Hosting it behind the firewall +- a **static front end** (plain HTML/CSS/JS — no build step), and +- a **Python API** (FastAPI) backed by **PostgreSQL**, which stores the project + SOPs, Work Packages, and comments so they are shared across users instead of + living in each person's browser. -Copy the whole folder to any internal web server and serve it over HTTP(S): - -- **IIS / Apache / nginx** — drop the files in the site root. `index.html` is the - entry point. -- **SharePoint / network share** — works too, as long as the files are served - over `http(s)://` (not opened as `file://...`). Serving over HTTP makes - `localStorage` and the embedded Work Package Creator (an `