A simple merchandise shop for SundAI, built with FastAPI backend and vanilla JavaScript/CSS frontend.
- Product Catalog: Browse SundAI merchandise with categories
- Shopping Cart: Add/remove items, adjust quantities
- Stripe Checkout: Secure payments with automatic post-payment fulfillment
- Printful Fulfillment: Orders are created and confirmed with Printful after successful payment
- Responsive Design: Works on desktop and mobile
- Clean UI: Minimalist design inspired by sundai.club
- REST API: Full backend API for products and cart management
- Backend: FastAPI (Python)
- Frontend: Vanilla HTML, CSS, JavaScript
- Styling: Custom CSS with Inter font
- Images: PIL-generated placeholders
Create a .env file (or otherwise export the variables) with the following keys:
PRINTFUL_API_KEY- Printful API token used to load products and create ordersPRINTFUL_STORE_ID- Optional but recommended; restricts product queries to your storeSTRIPE_SECRET_KEY- Stripe secret key used on the server to create checkout sessionsSTRIPE_PUBLISHABLE_KEY- Stripe publishable key used by the client to redirect to CheckoutSESSION_SECRET- Secret used by FastAPI session middleware (defaults to a development value)ESTIMATED_TAX_RATE- Optional override for the fallback tax rate (defaults to 0.085)
- Install dependencies:
pip install -r requirements.txt- Run the application:
python main.py- Open your browser and go to
http://localhost:8000
GET /- Storefront UIGET /api/products- Fetch merchandise catalogGET /api/products/{product_id}- Fetch a single productGET /api/cart- Retrieve the current session cartPOST /api/cart- Add an item to the cart (session-scoped)DELETE /api/cart/{item_id}- Remove an item from the cartPOST /api/calculate-total-cost- Estimate subtotal, shipping, and taxes for the active cartGET /api/stripe-config- Publishable Stripe key for the clientPOST /api/create-checkout-session- Create a Stripe Checkout session for the current cartPOST /api/checkout-success- Finalize successful Stripe payments and trigger Printful fulfillmentGET /api/countries- List Printful-supported destination countries for the checkout form- Printful helper endpoints:
/api/sync-products,/api/store-info,/api/catalog-products,/api/store-products,/api/create-order,/api/confirm-order/{order_id},/api/order-status/{order_id}
shop/
├── main.py # FastAPI application
├── requirements.txt # Python dependencies
├── static/
│ ├── index.html # Frontend HTML
│ ├── css/
│ │ └── style.css # Styles
│ ├── js/
│ │ └── app.js # Frontend JavaScript
│ └── images/
│ ├── tshirt.jpg # Product images
│ ├── hoodie.jpg
│ ├── cap.jpg
│ └── tote.jpg
└── README.md # This file
- Products: Modify the
productslist inmain.pyto add/change products - Styling: Edit
static/css/style.cssto customize the appearance - Images: Replace placeholder images in
static/images/
- Payment processing integration
- User accounts and authentication
- Order history
- Inventory management
- Admin interface for product management