Texel Moda is a fashion e-commerce website featuring virtual try-on capabilities built with React, Tailwind CSS, and Framer Motion.
- Modern responsive UI design
- Product browsing and filtering
- Virtual try-on functionality powered by Texel.Moda's Try-On Diffusion API
- Shopping cart functionality
- Smooth animations and transitions using Framer Motion
The platform integrates with the Virtual Try-On Diffusion [VTON-D] technology by Texel.Moda through their RapidAPI service:
- Users can upload their photos and try on different clothing items
- Advanced options include text prompts for avatar, clothing, and background
- Background replacement options
- Image generation with seed control for consistent results
- Users upload their avatar photo or use a text prompt to generate an avatar
- Users select clothing items or provide text descriptions
- Optional background customization
- The API generates a realistic composite image showing the clothing on the user
/src: React source files/components: Reusable UI components/layout: Layout components (Header, Footer)/product: Product-related components/try-on: Try-on related components
/pages: Application pages/api: API service functions for external services/utils: Utility functions
- Node.js 14+ and npm
# Clone the repository
git clone [repository-url]
# Navigate to project directory
cd texel-moda
# Install dependencies
npm install
# Start development server
npm run devThis project ships a tiny Express server used to create Stripe Checkout sessions.
- Copy
.env.exampleto.envand fillSTRIPE_SECRET_KEYandREACT_APP_STRIPE_PUBLISHABLE_KEY. - Install dependencies (if not already):
npm install- Start the server in a separate terminal:
npm run start:server- Start the frontend as usual:
npm run devThe frontend will POST to /api/stripe/create-checkout-session on the same host. If you run the server on a different port, set CLIENT_URL in .env and edit the fetch URL in src/components/ecommerce/CheckoutButton.jsx accordingly.
REACT_APP_API_URL: The base URL for the Try-On APIREACT_APP_API_KEY: API key for the Try-On Diffusion service
This project includes a minimal Express endpoint that creates Stripe Checkout sessions so you can complete purchases using Stripe's hosted Checkout page.
Setup
-
Copy
.env.exampleto.envand set the following values:STRIPE_SECRET_KEY— your Stripe secret key (use test key for local testing)REACT_APP_STRIPE_PUBLISHABLE_KEY— your Stripe publishable key (optional for hosted Checkout flow)CLIENT_URL— the frontend URL, e.g.http://localhost:5173
-
Install dependencies:
npm install- Start the Express server (separate terminal):
npm run start:server- Start the frontend:
npm run devBy default the backend listens on port 4242. The frontend CheckoutButton will POST to /api/stripe/create-checkout-session and redirect to the Stripe Checkout URL returned by the server.
Testing the endpoint
With the server running and your STRIPE_SECRET_KEY set to a test key you can POST a payload like this to create a test session:
{
"items": [
{ "name": "Blue Shirt", "price": 29.99, "quantity": 1, "image": "https://example.com/blue.png", "currency": "usd" }
]
}Example curl (replace host if needed):
curl -X POST http://localhost:4242/api/stripe/create-checkout-session \
-H "Content-Type: application/json" \
-d '{"items":[{"name":"Blue Shirt","price":29.99,"quantity":1}]}'If successful, the endpoint returns JSON containing a url you can open in the browser to view Stripe Checkout.
Webhooks & production notes
- For production use you should implement a webhook endpoint to receive
checkout.session.completedevents from Stripe and mark orders as paid on your server. Use the Stripe CLI or Dashboard to test webhooks locally. - Never commit
STRIPE_SECRET_KEYto source control. Use environment variables and set the production secret in a secure place (CI/CD secrets, hosting environment variables, etc.). - Consider using pre-created Stripe Prices (and sending
priceIDs to the Checkout session) for stable product pricing instead of creatingprice_dataon the fly.
Security & troubleshooting
- Add
.envto.gitignoreto ensure secrets are not committed. - If the frontend and server run on different origins, either enable CORS appropriately or configure a Vite proxy (see Vite docs) so the frontend can call the backend without CORS issues.
- If you see errors when creating a session, check that
STRIPE_SECRET_KEYis valid and that the server can reach Stripe's API.
- Try-On Diffusion API by Texel.Moda
- UI components built with Tailwind CSS
- Animations powered by Framer Motion
- Dilan