惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
Y
Y Combinator Blog
Engineering at Meta
Engineering at Meta
D
Docker
GbyAI
GbyAI
aimingoo的专栏
aimingoo的专栏
大猫的无限游戏
大猫的无限游戏
腾讯CDC
P
Proofpoint News Feed
A
About on SuperTechFans
WordPress大学
WordPress大学
Stack Overflow Blog
Stack Overflow Blog
Google DeepMind News
Google DeepMind News
C
Check Point Blog
Microsoft Security Blog
Microsoft Security Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
L
LangChain Blog
MyScale Blog
MyScale Blog
博客园 - 三生石上(FineUI控件)
Hugging Face - Blog
Hugging Face - Blog
Microsoft Azure Blog
Microsoft Azure Blog
N
Netflix TechBlog - Medium
G
Google Developers Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Building an AI-Powered Storefront with Python: A Complete...
Anna lilith · 2026-06-24 · via DEV Community

Anna lilith

Building an AI-Powered Storefront with Python: A Complete Guide

I built a fully autonomous digital product storefront using Python, Bitcoin payments, and AI-powered content generation. Here's the complete guide.

Architecture Overview

The stack is minimal but powerful:

  • Bottle for the web server (lightweight, single file)
  • Cloudflare Tunnel for free HTTPS
  • Blockstream API for zero-fee Bitcoin payment verification
  • Ollama for local AI content generation

The Web Server

from bottle import Bottle, run, template, request
import json, os

app = Bottle()
PRODUCTS_DIR = "products"

@app.route("/")
def index():
    products = load_products()
    return template("index", products=products)

@app.route("/product/<filename>")
def product_page(filename):
    product = load_product(filename)
    track_visit(filename, request)
    return template("product_detail", product=product)

@app.route("/verify/<txid>")
def verify_payment(txid):
    ""Verify a Bitcoin transaction via Blockstream API."""
    resp = requests.get(f"https://blockstream.info/api/tx/{txid}")
    if resp.status_code == 200:
        tx = resp.json()
        confirmed = tx.get("status", {}).get("confirmed", False)
        return {"confirmed": confirmed, "txid": txid}
    return {"error": "Transaction not found"}, 404

def load_products():
    products = []
    for f in os.listdir(PRODUCTS_DIR):
        if f.endswith(".json"):
            with open(os.path.join(PRODUCTS_DIR, f)) as fh:
                products.append(json.load(fh))
    return products

run(app, host="127.0.0.1", port=8080)

Bitcoin Payment Verification

Zero-fee payments using the Blockstream API:

import requests
from datetime import datetime, timedelta

class PaymentVerifier:
    BASE_URL = "https://blockstream.info/api"

    def verify_address_payment(self, address, expected_sats):
        ""Check if an address received the expected amount."""
        utxos = requests.get(
            f"{self.BASE_URL}/address/{address}/utxo",
            timeout=10
        ).json()

        total = sum(u["value"] for u in utxos)
        return total >= expected_sats, total

    def get_payment_qr(self, address, amount_btc, label=""):
        ""Generate a BIP21 Bitcoin URI."""
        uri = f"bitcoin:{address}?amount={amount_btc}"
        if label:
            uri += f"&label={label}"
        return uri

SEO Optimization

The storefront generates SEO-friendly pages automatically:

@app.route("/sitemap.xml")
def sitemap():
    products = load_products()
    urls = ['<url><loc>https://anna-lilith.com/</loc><changefreq>daily</changefreq></url>']

    for p in products:
        urls.append(
            f'<url><loc>https://anna-lilith.com/product/{p["slug"]}</loc>'
            f'<changefreq>weekly</changefreq></url>'
        )

    xml = f'<?xml version="1.0"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">{chr(10).join(urls)}</urlset>'
    return xml, {"Content-Type": "application/xml"}

Content Generation Pipeline

AI generates product descriptions and blog posts:

def generate_product_description(product):
    prompt = f"Write a compelling description for '{product['name']}'. Category: {product['category']}. Price: ${product['price']}. 100-200 words."

    resp = requests.post("http://localhost:11434/api/generate", json={
        "model": "qwen2.5:1.5b",
        "prompt": prompt,
        "stream": False,
    })

    return resp.json()["response"]

Deployment

The entire stack runs behind a Cloudflare Tunnel for free HTTPS:

# Start the app
python3 storefront.py &

# Expose via Cloudflare Tunnel (free, no port forwarding)
cloudflared tunnel --url http://localhost:8080

Results

  • 193 products auto-generated and validated
  • Free hosting via Cloudflare Tunnel
  • Zero payment fees with Bitcoin
  • SEO-optimized with auto-generated sitemaps
  • AI-powered content generation

Total cost: $0/month. Revenue: $10 and counting.