Skip to main content
RapidDev - Software Development Agency
lovable-integrationsEdge Function Integration

How to Integrate Lovable with AliExpress API

To integrate the AliExpress API with Lovable, create Supabase Edge Functions that authenticate with AliExpress Open Platform using your App Key and App Secret to search product data, fetch product details, and generate affiliate links for dropshipping storefronts. Store credentials in Cloud Secrets. This powers product import workflows in your Lovable dropshipping app.

What you'll learn

  • How to register on AliExpress Open Platform and obtain an App Key and App Secret
  • How to implement AliExpress's HMAC-MD5 signature authentication in a Supabase Edge Function
  • How to search AliExpress products and fetch product details including images and pricing
  • How to generate AliExpress affiliate tracking links for dropshipping commission revenue
  • How to parse and display AliExpress product data in a React dropshipping storefront
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Intermediate13 min read60 minutesE-commerceMarch 2026RapidDev Engineering Team
TL;DR

To integrate the AliExpress API with Lovable, create Supabase Edge Functions that authenticate with AliExpress Open Platform using your App Key and App Secret to search product data, fetch product details, and generate affiliate links for dropshipping storefronts. Store credentials in Cloud Secrets. This powers product import workflows in your Lovable dropshipping app.

Connect Lovable to AliExpress for Dropshipping Product Import

Dropshipping from AliExpress is one of the most accessible ways to start an online business — you build the storefront, customers place orders, and AliExpress suppliers fulfill and ship directly to customers. Building your dropshipping storefront in Lovable gives you a fully custom React experience with the product data, images, and descriptions pulled directly from AliExpress's massive catalog of hundreds of millions of products.

The AliExpress Open Platform provides several APIs useful for dropshipping: the Affiliate API for searching products and generating commission-earning links, the Product Details API for fetching comprehensive product information including all variation images and specifications, and the Order API for managing dropshipping orders placed through your store. The API uses a signature-based authentication system where each request must include an HMAC-MD5 signature computed from your App Secret and the request parameters — this cryptographic signing must happen server-side in your Edge Function, never in the browser.

This guide focuses on the most common dropshipping workflow: search the AliExpress catalog for products, display them on your storefront with real product images and pricing, let customers browse and select items, and generate the purchase or affiliate links. For a full dropshipping operation, you would integrate Stripe (via Lovable's native connector) for customer payment collection and use the AliExpress ordering APIs to place supplier orders after payment.

Integration method

Edge Function Integration

AliExpress Open Platform API integration in Lovable uses Supabase Edge Functions to handle the API's signature-based authentication and proxy product search and detail requests. Your AliExpress App Key and App Secret are stored in Cloud Secrets and accessed via Deno.env.get(). The Edge Function generates the required HMAC-MD5 request signature for each API call and returns product data (images, descriptions, pricing, shipping) to your React storefront.

Prerequisites

  • An AliExpress seller or affiliate account at aliexpress.com
  • Registration as a developer on AliExpress Open Platform at portals.aliexpress.com to get App Key and App Secret
  • AliExpress Affiliate or API program approval (some API features require applying for access)
  • A Lovable project with Lovable Cloud enabled
  • An understanding that AliExpress product data and images are owned by their respective sellers — check AliExpress's terms of service for permitted uses in your region

Step-by-step guide

1

Register on AliExpress Open Platform and get API credentials

Go to portals.aliexpress.com and sign in with your AliExpress account. Navigate to the Developer Portal section and click 'Create Application'. Fill in your application name (e.g., 'My Dropshipping Store'), select the application type (typically 'Web Application' for a Lovable storefront), and enter your application's description and website URL. For the API categories, select 'Affiliate' if you want product search and affiliate link generation, or 'Order Management' if you plan to place orders programmatically for dropshipping. Submit the application for review. AliExpress Open Platform review typically takes 1-3 business days. Once approved, your application dashboard will show your App Key (also called App ID) and App Secret. The App Key is a numeric ID and the App Secret is an alphanumeric string. Copy both values — you will need them to authenticate API requests. AliExpress's API uses a signature-based auth system where each API request must include a sign parameter computed by HMAC-MD5 hashing of your App Secret concatenated with all request parameters in alphabetical order.

Pro tip: The AliExpress Affiliate API does not require approval for basic product search — create your application with Affiliate type for the fastest access. Full Order Management API requires a separate approval process.

Expected result: You have an AliExpress App Key and App Secret from the AliExpress Open Platform developer portal.

2

Add AliExpress credentials to Cloud Secrets

In your Lovable project, open the Cloud tab by clicking '+' next to the Preview panel, then navigate to the Secrets section. Add two secrets: ALIEXPRESS_APP_KEY with your numeric App Key value, and ALIEXPRESS_APP_SECRET with your App Secret string. These are the only credentials needed for HMAC-MD5 signature generation. Never paste these values into a Lovable chat message or any frontend code — the App Secret must remain server-side because it is used to compute request signatures that authenticate every API call. If someone obtains your App Secret, they can make API calls that count against your rate limits or access your account data. Lovable's security infrastructure actively blocks hardcoded keys and encrypts all secrets with enterprise-grade encryption certified under SOC 2 Type II and ISO 27001:2022 standards. The secret is only accessible from your Edge Functions via Deno.env.get() and is never included in any client-side bundle.

Pro tip: Also note your App Key (App ID) is typically a 6-8 digit number while the App Secret is a longer alphanumeric string. Make sure you add them to the correct secret names.

Expected result: ALIEXPRESS_APP_KEY and ALIEXPRESS_APP_SECRET are stored in your Cloud Secrets panel.

3

Create the AliExpress API Edge Function with signature generation

The most critical and technically complex part of AliExpress integration is the request signature. Every AliExpress API call must include a sign parameter that is an HMAC-MD5 hash computed from your App Secret and all request parameters. The signature algorithm is: sort all request parameters alphabetically by key, concatenate them as key+value pairs (no separators), prepend and append the App Secret to the concatenated string, then compute the HMAC-MD5 hash of the result and convert it to uppercase hex. Ask Lovable to create an Edge Function that implements this signature algorithm using Deno's built-in crypto.subtle API (for HMAC-MD5) and proxies requests to the AliExpress API gateway at https://api.taobao.com/router/rest. Required parameters for every request include app_key, method (the API method name), sign_method (set to hmac), timestamp (current UTC time in YYYY-MM-DD HH:MM:SS format), format (json), v (API version, typically 2.0), and sign (the computed signature). For the Affiliate API's product search, the method is aliexpress.affiliate.product.query.

Lovable Prompt

Create a Supabase Edge Function called aliexpress-proxy that generates HMAC-MD5 signatures for AliExpress Open Platform API calls. Read ALIEXPRESS_APP_KEY and ALIEXPRESS_APP_SECRET from Deno.env.get(). Implement the AliExpress signature algorithm: sort all params alphabetically, concatenate as key+value, wrap with App Secret, HMAC-MD5 hash to uppercase hex. Accept a 'method' param for the API method and other query params to forward. Call https://api.taobao.com/router/rest and return the JSON response.

Paste this in Lovable chat

supabase/functions/aliexpress-proxy/index.ts
1import { serve } from "https://deno.land/std@0.168.0/http/server.ts";
2
3const corsHeaders = {
4 "Access-Control-Allow-Origin": "*",
5 "Access-Control-Allow-Headers": "authorization, x-client-info, apikey, content-type",
6};
7
8async function hmacMd5(secret: string, message: string): Promise<string> {
9 const encoder = new TextEncoder();
10 const keyData = encoder.encode(secret);
11 const msgData = encoder.encode(message);
12 const cryptoKey = await crypto.subtle.importKey(
13 "raw", keyData, { name: "HMAC", hash: "MD5" }, false, ["sign"]
14 );
15 const signature = await crypto.subtle.sign("HMAC", cryptoKey, msgData);
16 return Array.from(new Uint8Array(signature))
17 .map(b => b.toString(16).padStart(2, "0"))
18 .join("")
19 .toUpperCase();
20}
21
22serve(async (req) => {
23 if (req.method === "OPTIONS") {
24 return new Response("ok", { headers: corsHeaders });
25 }
26
27 try {
28 const appKey = Deno.env.get("ALIEXPRESS_APP_KEY")!;
29 const appSecret = Deno.env.get("ALIEXPRESS_APP_SECRET")!;
30
31 const url = new URL(req.url);
32 const method = url.searchParams.get("method") || "aliexpress.affiliate.product.query";
33
34 const timestamp = new Date().toISOString()
35 .replace("T", " ").substring(0, 19);
36
37 const params: Record<string, string> = {
38 app_key: appKey,
39 format: "json",
40 method,
41 sign_method: "hmac",
42 timestamp,
43 v: "2.0",
44 };
45
46 url.searchParams.forEach((value, key) => {
47 if (key !== "method") params[key] = value;
48 });
49
50 // Generate signature: sort params, concatenate key+value, wrap with secret
51 const sortedKeys = Object.keys(params).sort();
52 const paramString = sortedKeys.map(k => `${k}${params[k]}`).join("");
53 const signInput = `${appSecret}${paramString}${appSecret}`;
54 params.sign = await hmacMd5(appSecret, signInput);
55
56 const queryString = new URLSearchParams(params).toString();
57 const response = await fetch(
58 `https://api.taobao.com/router/rest?${queryString}`
59 );
60 const data = await response.json();
61
62 return new Response(JSON.stringify(data), {
63 headers: { ...corsHeaders, "Content-Type": "application/json" },
64 });
65 } catch (error) {
66 return new Response(
67 JSON.stringify({ error: error.message }),
68 { status: 500, headers: { ...corsHeaders, "Content-Type": "application/json" } }
69 );
70 }
71});

Pro tip: The HMAC-MD5 algorithm used by AliExpress is somewhat unusual — note the App Secret is both prepended and appended to the parameter string before hashing.

Expected result: The aliexpress-proxy Edge Function is deployed. Test it via Cloud → Logs with a product search call.

4

Search AliExpress products and display results

With the Edge Function deployed, ask Lovable to create a React component that searches AliExpress products using the Affiliate API. The aliexpress.affiliate.product.query method accepts keywords for search query, category_ids for category filtering, page_no and page_size for pagination, min_sale_price and max_sale_price for price range filtering, and sort for result ordering (SALE_PRICE_ASC, SALE_PRICE_DESC, LAST_VOLUME_DESC for bestsellers). The response contains a list of AliExpress product items with fields including product_id, product_title, sale_price (the current discounted price), original_price (the full price), product_main_image_url (primary product image), evaluate_rate (seller rating), and commission_rate if you are using the affiliate program. Display products as cards with image, title, sale price (formatted with currency), and shipping information. Add a keyword search input and category selector to let users filter the AliExpress catalog.

Lovable Prompt

Create an AliExpressProductSearch React component that calls my aliexpress-proxy Edge Function with method=aliexpress.affiliate.product.query and a keywords parameter from a search input. Display results as product cards showing product_main_image_url, product_title, sale_price with currency, and evaluate_rate star rating. Add a search input and 'Search' button. Show loading state and handle empty results.

Paste this in Lovable chat

Pro tip: AliExpress product titles are often very long with keyword-stuffed descriptions. Truncate to 60 characters for catalog cards and show the full title on the product detail page.

Expected result: Product search returns AliExpress listings with images, prices, and ratings displayed in a clean React grid.

5

Import products to Supabase and set retail pricing

For a proper dropshipping storefront, you want to import selected AliExpress products into your Supabase database with your own pricing markup rather than displaying AliExpress prices directly to customers. This separates your storefront data from real-time AliExpress availability and lets you control product presentation. When a merchant clicks 'Import' on a product search result, save the product to a Supabase products table with: aliexpress_product_id, title, description, product_images (array of image URLs), aliexpress_cost (the AliExpress sale price), retail_price (your markup — typically 2x-3x cost), shipping_cost, and any relevant variants. Display imported products on your customer-facing storefront using data from Supabase, not from live AliExpress API calls. Only call AliExpress API again when you need to check current pricing before placing a dropshipping order to ensure the cost has not increased. For order fulfillment, collect payment from the customer via Stripe at your retail price, then use the AliExpress Order API (requires separate API approval) to place the dropshipping order at the AliExpress wholesale price.

Lovable Prompt

Add an 'Import Product' button to my AliExpressProductSearch component. When clicked, save the product to a Supabase 'products' table with aliexpress_product_id, title, image_url, aliexpress_cost, and retail_price (set as aliexpress_cost * 2.5 initially). Create an ImportedProducts page that shows all products from the Supabase products table that customers can browse with our retail pricing.

Paste this in Lovable chat

Pro tip: Store AliExpress product IDs in Supabase so you can re-fetch current pricing before placing each dropshipping order — AliExpress prices change frequently.

Expected result: Selected AliExpress products appear in your Supabase products table with retail markup pricing, ready to display on your storefront.

Common use cases

Dropshipping product import and storefront

Search AliExpress for products by keyword or category, import product details into Supabase, and display them on your storefront with custom pricing markup. When a customer orders, use the AliExpress API to place the order with the supplier at the AliExpress price and keep the difference as profit.

Lovable Prompt

Create a product import tool that searches AliExpress for a given keyword via an Edge Function, shows matching products with image, title, AliExpress price, and shipping cost, and has an 'Import' button that saves the product to Supabase with a 2x markup as the retail price. Display imported products on a storefront page.

Copy this prompt to try it in Lovable

AliExpress affiliate link generator

Build a product comparison or recommendation tool that generates AliExpress affiliate tracking links earning commission on purchases. The Affiliate API wraps any AliExpress product URL with your tracking ID, directing affiliate commission to your account when customers buy.

Lovable Prompt

Build a product recommendation page that fetches trending AliExpress products in a chosen category using the Affiliate Products API, displays them with images and prices, and wraps each product link with my affiliate tracking code. Show a 'Shop on AliExpress' button that opens the affiliate link.

Copy this prompt to try it in Lovable

Product detail page with variant comparison

Display a detailed product page showing all AliExpress product variations (color, size, material) with individual pricing, availability, and shipping time for each variant. Customer selects their variant before being directed to AliExpress or your dropshipping checkout.

Lovable Prompt

Create a product detail page that fetches full product information from AliExpress using the product ID via an Edge Function. Display all variants with their images, prices, and stock status. Show shipping options and estimated delivery times. For each variant, generate an affiliate link or dropshipping order button.

Copy this prompt to try it in Lovable

Troubleshooting

AliExpress API returns 'invalid signature' error

Cause: The HMAC-MD5 signature is computed incorrectly. Common causes: App Secret is wrong, parameters are not sorted exactly alphabetically, App Secret is not both prepended and appended to the parameter string, or the timestamp format is incorrect.

Solution: Log the signInput string before hashing to verify: it should be AppSecret + sortedKey1Value1sortedKey2Value2... + AppSecret. Verify the timestamp is in YYYY-MM-DD HH:MM:SS format in UTC. Check that every parameter including app_key, format, method, sign_method, timestamp, and v is included in the signature computation.

typescript
1const signInput = `${appSecret}${paramString}${appSecret}`;
2console.log('Sign input:', signInput); // Verify format before hashing

Product images fail to load or show AliExpress placeholder images

Cause: AliExpress CDN images have referrer restrictions and may block loading when embedded in third-party pages. Some product image URLs in the API response also include query parameters that can cause issues.

Solution: Proxy AliExpress product images through your own Supabase Storage by downloading them when importing a product. Store the images in a public Supabase Storage bucket and serve them from there instead of directly from AliExpress CDN URLs. This also prevents broken images if the AliExpress listing is updated or removed.

aliexpress.affiliate.product.query returns empty results

Cause: Your AliExpress Open Platform application may not have affiliate API access approved, or the keyword search does not match any affiliate-trackable products. Some AliExpress product categories are not available through the Affiliate API.

Solution: Verify your application has Affiliate API access in the AliExpress Open Platform portal under My Applications → API Capabilities. Try broad single-keyword searches (e.g., 'phone' instead of 'waterproof phone case') to confirm the API is responding correctly. Check if your account needs affiliate program approval at portals.aliexpress.com/affiliateportal.

API calls succeed in testing but return 'request timeout' in production

Cause: The AliExpress API gateway at api.taobao.com can be slow to respond from certain geographic regions, especially outside Asia. Supabase Edge Functions deployed in Americas or Europe regions may experience higher latency.

Solution: Add a timeout to your Edge Function's fetch call. If timeout errors persist, consider caching product search results in Supabase for a short period (e.g., 5 minutes) to reduce the frequency of AliExpress API calls. Batch imports during off-peak hours rather than importing products in real time.

typescript
1const controller = new AbortController();
2const timeoutId = setTimeout(() => controller.abort(), 10000);
3const response = await fetch(url, { signal: controller.signal });
4clearTimeout(timeoutId);

Best practices

  • Import AliExpress products to Supabase rather than calling the API on every storefront page load — this decouples your customer experience from AliExpress API availability and rate limits
  • Store product images in Supabase Storage after importing them, rather than linking directly to AliExpress CDN URLs that can change or become restricted
  • Always re-check the current AliExpress price via the API before placing a dropshipping order — prices change frequently and you need to confirm your margin before buying
  • Implement markup rules programmatically (e.g., 2.5x cost for products under $10, 1.8x for products over $50) rather than manually setting retail prices for each imported product
  • Keep your ALIEXPRESS_APP_SECRET exclusively in Cloud Secrets — the HMAC-MD5 signature generation must happen server-side because exposing the App Secret allows anyone to impersonate your application
  • Monitor AliExpress API rate limits in the developer portal — the Affiliate API typically allows several hundred requests per minute but quotas vary by account tier
  • Add a 'price change alert' feature using Supabase that periodically checks imported products' current AliExpress price against your stored cost and notifies you when the price increases enough to erode your margin

Alternatives

Frequently asked questions

Is the AliExpress API free to use?

Registering on AliExpress Open Platform and accessing the Affiliate API for product search is free. AliExpress makes money when your affiliate links drive sales — you earn a commission, they get a buyer. Some advanced API features like the Order Management API may require a paid plan or separate approval. Check portals.aliexpress.com for current access tiers.

What is the difference between the AliExpress Affiliate API and the Dropshipping API?

The Affiliate API gives you access to product search and generates trackable links that earn commission when customers click through and buy. The Dropshipping/Order API lets you programmatically place orders with AliExpress suppliers on behalf of your customers after collecting payment. Most Lovable storefront builders start with the Affiliate API for product data, then apply for Order API access when they are ready to automate fulfillment.

How do I handle shipping times from AliExpress in my Lovable storefront?

The AliExpress product API includes logistics and shipping information for each product listing. The ship_to_days field indicates estimated delivery time from the seller. Display this prominently to customers — AliExpress shipping can range from 7 days (AliExpress Standard Shipping) to 60+ days (cheap untracked mail). Setting customer expectations upfront significantly reduces refund requests.

Can I use this integration to build an automated dropshipping store?

Yes, with the right API access. The full automated dropshipping flow requires: Affiliate API (product search, already covered in this guide), Stripe (payment collection via Lovable's native connector), and AliExpress Order API (automated order placement, requires separate application and approval). The Order API lets you programmatically place AliExpress orders after customer payment, fully automating the dropshipping cycle.

Are there legal or policy restrictions on using AliExpress product images and descriptions?

AliExpress product content is owned by individual sellers who license their images and descriptions on the AliExpress platform. Using this content in your own storefront falls under AliExpress's affiliate and dropshipping program terms. Review AliExpress's Open Platform Terms of Service and, if you are in the EU, be aware of product safety and labeling regulations for goods sold to European consumers regardless of where they ship from.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Need help with your project?

Our experts have built 600+ apps and can accelerate your development. Book a free consultation — no strings attached.

Book a free consultation

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.