{"slug": "building-an-ai-powered-storefront-with-python-a-complete-guide", "title": "Building an AI-Powered Storefront with Python: A Complete Guide", "summary": "A developer built a fully autonomous digital product storefront using Python, Bitcoin payments, and AI-powered content generation. The stack uses Bottle web framework, Blockstream API for zero-fee Bitcoin verification, and a local LLM for generating product descriptions and blog posts. The entire system runs behind a Cloudflare Tunnel for free HTTPS, with a total cost of $0 per month and revenue of $10 and counting.", "body_md": "I built a fully autonomous digital product storefront using Python, Bitcoin payments, and AI-powered content generation. Here's the complete guide.\n\nThe stack is minimal but powerful:\n\n``` python\nfrom bottle import Bottle, run, template, request\nimport json, os\n\napp = Bottle()\nPRODUCTS_DIR = \"products\"\n\n@app.route(\"/\")\ndef index():\n    products = load_products()\n    return template(\"index\", products=products)\n\n@app.route(\"/product/<filename>\")\ndef product_page(filename):\n    product = load_product(filename)\n    track_visit(filename, request)\n    return template(\"product_detail\", product=product)\n\n@app.route(\"/verify/<txid>\")\ndef verify_payment(txid):\n    \"\"Verify a Bitcoin transaction via Blockstream API.\"\"\"\n    resp = requests.get(f\"https://blockstream.info/api/tx/{txid}\")\n    if resp.status_code == 200:\n        tx = resp.json()\n        confirmed = tx.get(\"status\", {}).get(\"confirmed\", False)\n        return {\"confirmed\": confirmed, \"txid\": txid}\n    return {\"error\": \"Transaction not found\"}, 404\n\ndef load_products():\n    products = []\n    for f in os.listdir(PRODUCTS_DIR):\n        if f.endswith(\".json\"):\n            with open(os.path.join(PRODUCTS_DIR, f)) as fh:\n                products.append(json.load(fh))\n    return products\n\nrun(app, host=\"127.0.0.1\", port=8080)\n```\n\nZero-fee payments using the Blockstream API:\n\n``` python\nimport requests\nfrom datetime import datetime, timedelta\n\nclass PaymentVerifier:\n    BASE_URL = \"https://blockstream.info/api\"\n\n    def verify_address_payment(self, address, expected_sats):\n        \"\"Check if an address received the expected amount.\"\"\"\n        utxos = requests.get(\n            f\"{self.BASE_URL}/address/{address}/utxo\",\n            timeout=10\n        ).json()\n\n        total = sum(u[\"value\"] for u in utxos)\n        return total >= expected_sats, total\n\n    def get_payment_qr(self, address, amount_btc, label=\"\"):\n        \"\"Generate a BIP21 Bitcoin URI.\"\"\"\n        uri = f\"bitcoin:{address}?amount={amount_btc}\"\n        if label:\n            uri += f\"&label={label}\"\n        return uri\n```\n\nThe storefront generates SEO-friendly pages automatically:\n\n``` python\n@app.route(\"/sitemap.xml\")\ndef sitemap():\n    products = load_products()\n    urls = ['<url><loc>https://anna-lilith.com/</loc><changefreq>daily</changefreq></url>']\n\n    for p in products:\n        urls.append(\n            f'<url><loc>https://anna-lilith.com/product/{p[\"slug\"]}</loc>'\n            f'<changefreq>weekly</changefreq></url>'\n        )\n\n    xml = f'<?xml version=\"1.0\"?><urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">{chr(10).join(urls)}</urlset>'\n    return xml, {\"Content-Type\": \"application/xml\"}\n```\n\nAI generates product descriptions and blog posts:\n\n``` python\ndef generate_product_description(product):\n    prompt = f\"Write a compelling description for '{product['name']}'. Category: {product['category']}. Price: ${product['price']}. 100-200 words.\"\n\n    resp = requests.post(\"http://localhost:11434/api/generate\", json={\n        \"model\": \"qwen2.5:1.5b\",\n        \"prompt\": prompt,\n        \"stream\": False,\n    })\n\n    return resp.json()[\"response\"]\n```\n\nThe entire stack runs behind a Cloudflare Tunnel for free HTTPS:\n\n```\n# Start the app\npython3 storefront.py &\n\n# Expose via Cloudflare Tunnel (free, no port forwarding)\ncloudflared tunnel --url http://localhost:8080\n```\n\nTotal cost: $0/month. Revenue: $10 and counting.", "url": "https://wpnews.pro/news/building-an-ai-powered-storefront-with-python-a-complete-guide", "canonical_source": "https://dev.to/annalilith/building-an-ai-powered-storefront-with-python-a-complete-guide-569c", "published_at": "2026-06-24 02:37:18+00:00", "updated_at": "2026-06-24 02:43:18.935310+00:00", "lang": "en", "topics": ["developer-tools", "artificial-intelligence", "generative-ai", "ai-products"], "entities": ["Python", "Bottle", "Blockstream", "Cloudflare", "Qwen2.5", "Bitcoin"], "alternates": {"html": "https://wpnews.pro/news/building-an-ai-powered-storefront-with-python-a-complete-guide", "markdown": "https://wpnews.pro/news/building-an-ai-powered-storefront-with-python-a-complete-guide.md", "text": "https://wpnews.pro/news/building-an-ai-powered-storefront-with-python-a-complete-guide.txt", "jsonld": "https://wpnews.pro/news/building-an-ai-powered-storefront-with-python-a-complete-guide.jsonld"}}