Week 8 of 16

Deploy: Ship the App (Optional)

Put your Prompt Vault on the internet so anyone can use it — or don't. Both are valid choices.

Day 38 60 minutes Deploy

Day 38 of 80

Deploy Is Optional

A tool that runs on your laptop and saves you an hour a week is a real, valuable tool. You do not need to deploy it for it to matter.

Deployment makes sense when:

If none of those apply yet — skip today, move to Day 39, and come back to deployment when the motivation is there. Forced deployment with an unprepared app causes more frustration than learning.

What You Need Before Deploying

Run through this checklist before you open any deployment platform. A missing item now will cause a confusing failure later.

Item What to check Why it matters
requirements.txt Run pip freeze > requirements.txt and verify it includes flask, anthropic, python-dotenv The server installs packages from this file — missing entries mean import errors
.gitignore Contains .env and (optionally) prompts.json Your API key must never be in a public repo
debug=False In app.run(), ensure debug is off or set via environment variable Debug mode in production exposes your code to anyone who triggers an error
Stable file paths prompts.json path is relative or uses Path(__file__).parent Absolute paths from your laptop won't exist on the server

Option 1: PythonAnywhere (Easiest)

PythonAnywhere is the gentlest introduction to deployment. Free tier is sufficient. No credit card required.

PythonAnywhere — step by step Setup
# Step 1: Create a free account at pythonanywhere.com

# Step 2: Upload your project files
# In the PythonAnywhere dashboard: Files tab → Upload
# Upload vault.py, helpers.py, templates/, static/, requirements.txt

# Step 3: Open a Bash console (Consoles tab → Bash)
pip3.10 install --user -r requirements.txt

# Step 4: Set up a Web App
# Web tab → Add a new web app → Manual configuration → Python 3.10
# Set Source code: /home/yourusername/prompt-vault
# Set Working directory: /home/yourusername/prompt-vault

# Step 5: Edit the WSGI config file (link in Web tab)
# Replace the file contents with:
import sys
import os
sys.path.insert(0, '/home/yourusername/prompt-vault')
os.environ['ANTHROPIC_API_KEY'] = 'sk-ant-...'  # See warning below!
from vault import app as application

# Step 6: Reload the web app — click the green Reload button in the Web tab

WSGI (Web Server Gateway Interface) is how the PythonAnywhere server talks to your Flask app. The WSGI file is the handshake between the server and your code.

Limitation of the free tier: Apps go to sleep after inactivity and wake slowly. This is fine for personal tools and demos — not for production traffic.

Option 2: Render.com (More Professional)

Render is closer to how professional deployment works: code lives in GitHub, deploy happens automatically on every push. More setup upfront, but the workflow is cleaner.

Render.com — step by step Setup
# Step 1: Push your project to a GitHub repo
git init
git add vault.py helpers.py templates/ static/ requirements.txt
git commit -m "Initial commit — Prompt Vault"
git remote add origin https://github.com/yourusername/prompt-vault.git
git push -u origin main

# Step 2: Add a start command in a Procfile (create this file)
# Procfile (no extension):
web: gunicorn vault:app

# Step 3: Add gunicorn to requirements.txt
flask
anthropic
python-dotenv
gunicorn

# Step 4: On render.com
# New → Web Service → Connect your GitHub repo
# Build Command: pip install -r requirements.txt
# Start Command: gunicorn vault:app

# Step 5: Add environment variable
# Environment tab → Add Environment Variable
# Key: ANTHROPIC_API_KEY  Value: sk-ant-...

# Step 6: Deploy — Render builds and deploys automatically

Gunicorn is a production-grade WSGI server. Flask's built-in server (app.run()) is fine for development but not designed for real traffic. Gunicorn handles concurrent requests properly.

Auto-deploy on push means that after setup, deploying a change is just a git push. This is the standard workflow at most software companies.

The free tier on Render also has sleep behavior. Paid plans ($7/mo) keep the app always-on.

Never Expose Your API Key

Your Anthropic API key must never appear in a public GitHub repository. Anyone who finds it can run API calls billed to your account.

Protect it two ways:

  1. In your repo: Add .env to your .gitignore file before the first commit. Once a secret is in git history, it's very hard to fully remove.
  2. On the server: Use environment variables, not hardcoded strings. PythonAnywhere's WSGI file is private — but Render's environment variable system is cleaner and the right habit to build.

In your Flask app, read the key like this:

client = anthropic.Anthropic(api_key=os.environ.get("ANTHROPIC_API_KEY"))

Never: api_key="sk-ant-abc123..." directly in source code.

Start Local

Most professional internal tools start as local tools. If it's saving you time and working reliably, the value is already there. Deploy when you have a reason — not because you feel like you "should."

End of Day Checklist

Tomorrow

Day 39 is about stretch goals — optional features you can add to the Prompt Vault now that the core is solid. Prompt tags, favorites, bulk export, an edit flow. Pick one and build it.