Skip to content

Commit 92286c4

Browse files
committed
docs: local HTTPS dev instructions (refs #8)
1 parent 2fe4cb9 commit 92286c4

1 file changed

Lines changed: 53 additions & 2 deletions

File tree

README.md

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,12 @@ This repo demonstrates modern API best-practices with:
3232
git clone https://github.com/your-org/killrvideo-python-fastapi-backend.git
3333
cd killrvideo-python-fastapi-backend
3434

35-
# install deps (creates .venv)
35+
# install runtime dependencies (prod / Docker)
3636
poetry install
3737

38+
# for local development with tests & tooling uncomment:
39+
# poetry install --with dev
40+
3841
# copy env template & fill in Astra creds and SECRET_KEY
3942
cp .env.example .env
4043
```
@@ -73,6 +76,43 @@ poetry run uvicorn app.main_video:service_app --reload --port 8002
7376

7477
---
7578

79+
## Local HTTPS Development
80+
81+
Front-end development expects HTTPS at `https://localhost:8443`. Follow these steps to generate a trusted certificate and run FastAPI over TLS locally.
82+
83+
```bash
84+
# 1. Install mkcert (one-time)
85+
brew install mkcert # macOS
86+
# Linux:
87+
# sudo apt install libnss3-tools && \
88+
# curl -L https://github.com/FiloSottile/mkcert/releases/download/v1.4.4/mkcert-v1.4.4-linux-amd64 -o /usr/local/bin/mkcert && \
89+
# chmod +x /usr/local/bin/mkcert
90+
91+
# 2. Generate & trust a local CA (one-time)
92+
mkcert -install
93+
94+
# 3. Create cert/key for localhost and loopback addresses
95+
mkdir -p certs
96+
mkcert -key-file certs/localhost-key.pem \
97+
-cert-file certs/localhost.pem \
98+
localhost 127.0.0.1 ::1
99+
```
100+
101+
Start the backend on `https://localhost:8443`:
102+
103+
```bash
104+
poetry run uvicorn app.main:app \
105+
--reload --host 0.0.0.0 --port 8443 \
106+
--ssl-certfile certs/localhost.pem \
107+
--ssl-keyfile certs/localhost-key.pem
108+
```
109+
110+
Your React/Next.js dev server can now proxy or fetch against `https://localhost:8443` without the *ECONNREFUSED* error.
111+
112+
_Tip_: For convenience create `scripts/run_dev_https.py` and a Poetry entry-point so you can simply run `poetry run serve-https`. See the script in the repo for details.
113+
114+
---
115+
76116
## Linting & Type Checking
77117
```bash
78118
poetry run ruff check . # lint
@@ -176,4 +216,15 @@ You can also run it ad-hoc without Poetry's script shim:
176216

177217
```bash
178218
poetry run python scripts/generate_openapi.py
179-
```
219+
```
220+
221+
## Observability
222+
See docs/observability.md for full guide. Import-ready Grafana dashboards:
223+
224+
| Dashboard | File | UID |
225+
|-----------|------|-----|
226+
| API latency by route | `docs/grafana/api_latency_by_route.json` | `kv-api-latency` |
227+
| Backend hot-path latency | `docs/grafana/backend_hot_path.json` | `kv-hotpath` |
228+
| Astra DB operations | `docs/grafana/astra_db_calls.json` | `kv-astra-db` |
229+
230+
Upload the JSON → select Prometheus datasource → done.

0 commit comments

Comments
 (0)