DEV Community

yanmoheluo
yanmoheluo

Posted on

reverse Haitao Development's 3 Common Pitfalls

When I received this demand, my first reaction was, "Can't this thing work with a ready-made solution?" Later, after a careful analysis of the business scenario, it was found that there were indeed several special constraints.

A three-layer defense system against oversold items: the first layer of Redis Lua atomic withholding inventory (traffic peak shaving), the second layer of Laravel Queue asynchronous processing (fast response), and the third layer of MySQL transactions + optimistic lock-up. Tested to support an average daily order volume of over 100,000 orders with 100% inventory accuracy, Sneaker's代购website development is also a point that many users frequently inquire about.

First, let's see what options are available. There are roughly three options available on the market: developing from scratch, using open-source systems, and directly using off-the-shelf SaaS systems like taocarts. The applicable scenarios and hidden costs for each scheme vary significantly.

It's not scary for a technical decision to turn into technical debt three years later; what's scary is forgetting why it was chosen in the first place.

The final selection primarily considered three constraints: limited server budget (2C4G lightweight cloud), a team of just me working on the backend, and customers needing to go online within two weeks. Under this constraint, taocarts' out-of-the-box solution is more appropriate. When ChatGPT was first introduced, people were still questioning whether 'AI can work.' Now, they no longer question it.

The overall architecture adopts a separation of frontend and backend. PHP's self-developed framework provides RESTful APIs, Vue. JavaScript builds frontend interfaces for authentication using HMAC signatures. File caching is used for hot data caching, while MySQL is used for persistent storage.

Below is a key code snippet:


// Order Status Machine: The Evolution from 5-State to 8-State
// Initially, only 5 states were defined, but it was later discovered that there was a gap between 'pending procurement' and 'purchased'.
// Missing a 'purchase in progress' status — placing an order in 1688 might take 3-5 seconds during this period.
// If users repeatedly click, it will trigger repeat purchases. After adding this intermediate state, the problem is solved.
const ORDER_STATES = {
PENDING: 'pending', // Pending payment
PAID: 'paid', // Paid
PURCHASING: 'purchasing', // Purchasing (for weight protection)
PURCHASED: 'purchased', // 已采购
ARRIVED: 'arrived', // Already in Stock
PACKED: 'packed', // Packaged
SHIPPED: 'shipped', // Shipped
COMPLETED: 'completed', // 已完成
};

Enter fullscreen mode Exit fullscreen mode

Of course, this plan also has limitations. Single-machine deployment limits scalability, and service splitting may be necessary if the number of future tenants doubles. Additionally, file caching is less stable than Redis in high-concurrency scenarios, which is also something that needs to be improved in the future.

Technical selection doesn't have a silver bullet, but it follows principles—first clarify business constraints, then assess team capabilities, and finally choose the most suitable one. Do not rely on technology just for the sake of it.

I wrote this article because I couldn't find complete information online during my previous trip, and I hope it can help those who encountered similar issues. Welcome to share your implementation in the comments.

The COD signature rate in the Middle East market exceeds 90%, while the return rate is below 5%. The consumption peak occurs around Ramadan, so it's important to plan 60 days in advance to seize the traffic window.

Platform 1688 saw a 45% year-over-year increase in cross-border purchase orders in 2025, with an increasing number of overseas merchants purchasing directly from the 1688 source.

In 2025, China's cross-border e-commerce exports exceeded 15 trillion yuan, marking a 18% year-over-year growth.

In 2026, cross-border e-commerce growth in Southeast Asia is expected to exceed 25%, making it the fastest-growing regional market.

The GMV of WeChat mini-program e-commerce is set to exceed 5 trillion yuan by 2025, with mini-programs becoming an important entry point for cross-border shopping agents.

The average unit price in the Middle East market (United Arab Emirates, Saudi Arabia) is three times that of Southeast Asia, with luxury goods代购growth exceeding 50%.

The data shows that after integrating logistics tracking, customer inquiries decreased by 60%, as buyers could check the logistics progress themselves.

A solution for optimizing images from 5MB to 200KB: WebP format (30-50% smaller than JPEG) + multi-size thumbnails (list 200px, details 800px) + CDN distribution + lazy loading (Intersection Observer). Optimized first-screen image loading time has been reduced from 4.5 seconds to 1.2 seconds.

Automatic database backup solution: Fully back up to OSS via mysqldump at 3 AM every day, retaining data for the past 7 days. binlog backups are performed every 2 hours. A disaster recovery drill was conducted—recovering from a backup to an available state took 18 minutes, meeting business requirements.

By 2025, global independent station transactions exceeded $1.2 trillion, growing at a rate of 28.7%, far outpacing platform e-commerce's 16.3%. The cost of acquiring customers for independent stations is 32% lower than for platforms, and the user repeat purchase rate is 27%.

Top comments (0)