Just enough DevOps to put DocChat online with a shareable link
| Command | Does |
|---|---|
git init | Start tracking this folder |
git status | What changed / staged |
git add . | Stage all changes |
git commit -m "msg" | Save a snapshot |
git log --oneline | Compact history |
git branch | List branches |
git checkout -b feat/x | Create + switch to branch |
git checkout main | Switch branch |
git push -u origin main | Upload (first push sets upstream) |
git push | Upload later commits |
git pull | Fetch + merge remote changes |
First-time push to GitHub
git init
git add .
git commit -m "Initial commit"
git branch -M main
git remote add origin git@github.com:you/docchat.git
git push -u origin main
Add JWT auth to /login
Fix 500 on empty doc upload
fixed stuff · ✗ updates · ✗ asdf# .gitignore
.venv/
__pycache__/
*.pyc
.env # secrets — NEVER commit
node_modules/
.next/
.DS_Store
# .dockerignore — keep the image small
.venv/
__pycache__/
.git/
.env
node_modules/
*.md
.env in git. If you ever do, the secret is compromised even after deletion — rotate it immediately.# Dockerfile
FROM python:3.13-slim
WORKDIR /app
# Install deps first — layer caching keeps rebuilds fast
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Then copy the app code
COPY . .
EXPOSE 8000
CMD ["fastapi", "run", "main.py", \
"--port", "8000", "--host", "0.0.0.0"]
Build & run locally
docker build -t docchat-api .
docker run -p 8000:8000 --env-file .env docchat-api
# open http://localhost:8000/docs
--host 0.0.0.0 matters. Inside a container, the default 127.0.0.1 is unreachable from the host — bind to all interfaces.| Where | How |
|---|---|
| Local dev | .env file (gitignored) → load with --env-file .env or python-dotenv |
| Production | Set in the host's dashboard (Vercel / Render / Railway) — never in code |
# .env (local only, gitignored)
DATABASE_URL=postgresql+psycopg://user:pass@host/db
ANTHROPIC_API_KEY=sk-ant-...
SECRET_KEY=change-me
# read them in Python
import os
db_url = os.environ["DATABASE_URL"] # required
key = os.getenv("SECRET_KEY", "dev") # with default
pgvector for RAG). Copy the connection string.DATABASE_URL, ANTHROPIC_API_KEY, SECRET_KEY in the host dashboard.NEXT_PUBLIC_API_URL to the backend's public URL.CORSMiddleware so the browser can call your API./docs on the live backend, then run the full flow (upload → ask → answer) from the live frontend.One workflow file makes every push run your checks. Even a minimal "install deps + run tests" job signals professionalism.
# .github/workflows/ci.yml
name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with: { python-version: "3.13" }
- run: pip install -r requirements.txt
- run: pytest # add ruff/mypy here later