Automating Digital Product Sales with XianYuAssistant
Selling digital keys, access codes, and small used items on marketplaces quickly turns into monotonous routine. The buyer paid for the product at three in the morning, expecting instant delivery, but you're asleep. As a result, the store rating drops and the customer goes to competitors.
The author of the open-source repository XianYuAssistant decided to solve this problem for the Chinese platform Xianyu (Alibaba's secondary marketplace). They created a full-featured self-hosted combo that can pick up incoming messages on the fly, respond to buyers via AI, and automatically deliver promo codes or files from the inventory.

Why developers should look at this
Even if you don't sell anything on Xianyu, the project is interesting for its technical implementation. It's a fresh stack on Java 21 and Spring Boot 3.5.7, where built-in vector search for neural networks, browser automation, and WebSocket work were brought into real production under aggressive antifraud conditions.
The platform website actively defends against bots. To bypass restrictions, the author applied a comprehensive approach:
- QR code login using a Headless browser with Playwright.
- Simulating realistic delays between requests and token refreshes.
- Integrating a local SQLite database with vector storage in a single file.
- Smart auto-responder based on Spring AI and Tongyi Qwen model with knowledge base search (RAG).

Automating Messages and Key Delivery
The main workflow relies on continuous WebSocket channel monitoring. Once a buyer transfers payment for an item, the service instantly detects the "Paid" status and retrieves the matching key from the internal virtual goods inventory.

When buyers ask routine questions like "How do I activate this?" or "Does it work in Russia?", the service doesn't just send templates. You can configure regex-based rules or connect a language model. Each product gets a vector database with descriptions and instructions. The neural network pulls the relevant text fragment and generates a natural response.

Fighting Blocks and Captcha Sliders
The most challenging aspect of these projects is preventing the platform from banning the account for using automation. XianYuAssistant implements an interesting session rotation mechanism:
- Cookies refresh via a background endpoint call every 30 minutes.
- Token
_m_h5_tkresets with a floating interval between 1.5 and 2.5 hours. - WebSocket token changes every 10–14 hours.
- A 2–5 second pause is maintained between actions of multiple accounts.

If the platform triggers a slider captcha, the system logs this event and displays a prompt in the control panel. The user can manually complete the verification through the browser and inject fresh cookies without restarting the bot entirely.
Architecture and Tech Stack
The project consists of a monolithic backend and a Vue 3.5 frontend with Element Plus. Everything runs in a single Docker container, eliminating the need for a separate database—SQLite is embedded within the mount directive.
docker run -d \
--name xianyu-assistant \
-p 12400:12400 \
-v $(pwd)/data/dbdata:/app/dbdata \
-v $(pwd)/data/logs:/app/logs \
--restart unless-stopped \
iamlzy/xianyuassistant:latest
Notable backend components include:
- Playwright Java: used for rendering the login page and scanning QR codes.
- Spring AI 1.1.4: handles integration with LLM and vector storage without third-party services like Pinecone or Qdrant.
- ZXing and MessagePack: used for barcode handling and binary protocol message decoding.
The interface is responsive, so responding to messages or viewing delivery logs is convenient even from a phone.
Is it worth installing
XianYuAssistant is a specialized tool for those trading in the Asian market. However, the repository's source code serves as an excellent tutorial for writing bots in Java 21 with modern Spring Boot and Vue 3.
If you're interested in seeing how to organize RAG search on a local SQLite file, handle binary WebSocket messages, or set up session rotation to avoid blocks, this project definitely deserves a closer look.
Related projects