This project builds a clean, responsive web interface with two primary sections:
No Tailwind or React is used. The backend is implemented using FastAPI, and the frontend is built with HTML, CSS, and Vanilla JavaScript.
/api/chat)project/
│
├── backend/
│ ├── main.py # FastAPI app
│ └── data/
│ └── products.json # Mock product data
│
├── static/
│ ├── index.html # UI layout
│ ├── styles.css # Responsive styles
│ └── main.js # DOM logic & API calls
│
└── README.md/api/products)/api/chat)from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse
from fastapi.staticfiles import StaticFiles
import json
app = FastAPI()
# Serve static files (HTML/CSS/JS)
app.mount("/", StaticFiles(directory="static", html=True), name="static")
# Product data endpoint
@app.get("/api/products")
def get_products():
with open("backend/data/products.json") as f:
return json.load(f)
# Chat endpoint (placeholder for OpenAI integration)
@app.post("/api/chat")
async def chat_endpoint(request: Request):
data = await request.json()
message = data.get("message", "")
return {"response": f"You said: {message}"}main.js/api/chat and displays responsestyles.cssproducts.json)[
{
"id": 1,
"category": "Serum",
"name": "The Ordinary Niacinamide 10% + Zinc 1%",
"description": "High-strength vitamin and mineral blemish formula to reduce appearance of blemishes",
"rating": 88,
"benefits": [
{"icon": "✓", "text": "Reduces oil production significantly"},
{"icon": "✓", "text": "Minimizes pore appearance"},
{"icon": "!", "text": "Can be drying for sensitive skin"}
],
"price": "€7.20",
"isTopMatch": false
},
{
"id": 2,
"category": "Moisturizer",
"name": "CeraVe Daily Moisturizing Lotion",
"description": "Lightweight, non-comedogenic moisturizer with ceramides and hyaluronic acid",
"rating": 91,
"benefits": [
{"icon": "✓", "text": "Perfect for normal to dry skin"},
{"icon": "✓", "text": "24-hour hydration"},
{"icon": "✓", "text": "Fragrance-free formula"}
],
"price": "€13.99",
"isTopMatch": true
},
{
"id": 3,
"category": "Sunscreen",
"name": "La Roche-Posay Anthelios Ultra Light SPF 60",
"description": "Broad-spectrum sunscreen with antioxidants for sensitive skin protection",
"rating": 89,
"benefits": [
{"icon": "✓", "text": "Excellent UV protection"},
{"icon": "✓", "text": "Non-greasy finish"},
{"icon": "!", "text": "May leave slight white cast"}
],
"price": "€18.50",
"isTopMatch": false
}
] cd project pip install fastapi uvicorn python-multipart uvicorn backend.main:app --reloadhttp://localhost:8000The frontend files are served statically by FastAPI. No additional setup required.
http://localhost:8000/api/products)/api/chat)This project is open source and available under the MIT License.