Java + UniApp in Practice: Full-Stack Development of a Stray Pet Rescue Mini Program

A C2C stray pet rescue and adoption system built with WeChat Mini Program and Spring Boot
This article introduces a stray pet rescue system built with a UniApp + Spring Boot frontend-backend separation architecture. The system adopts a C2C model where users can publish stray pet information and apply for adoption. It features a review mechanism, a state machine-driven adoption process, and WebSocket real-time chat functionality, making it ideal as a graduation project or full-stack development learning case.
Project Overview
Stray pet rescue is a socially meaningful application scenario, and digitizing it into a complete online system not only improves rescue efficiency but also serves as an excellent hands-on project for learning full-stack development. The stray pet rescue system introduced today uses a WeChat Mini Program as the frontend carrier, with a backend built on the Spring Boot framework, following a fully decoupled frontend-backend separation architecture.
Frontend-backend separation is the mainstream architectural pattern in modern web development. Its core philosophy is to completely decouple the user interface (frontend) from business logic and data processing (backend). The frontend calls RESTful APIs provided by the backend via HTTP requests to fetch data, while the backend is solely responsible for data processing and business logic without rendering pages. The advantages of this architecture include: independent development, deployment, and scaling of frontend and backend; frontend developers focus on user experience while backend developers focus on performance and security. In team collaboration, both sides can develop in parallel as long as the API documentation is agreed upon, significantly improving development efficiency.

The core design philosophy of this system is the C2C model — similar to the approach of platforms like Xianyu (Idle Fish). Individual users can both publish stray pet information and apply to adopt pets posted by other users. C2C (Consumer to Consumer) is a classic model in e-commerce where individual users directly conduct transactions or exchange information, with the platform only providing matchmaking services and infrastructure. Typical examples include eBay, Xianyu, and Zhuanzhuan. Compared to B2C (Business to Consumer) models, C2C platforms are characterized by: user-generated content (UGC), requiring the platform to establish trust mechanisms and review systems to ensure content quality; equal status between both parties, with the platform not intervening in specific transaction decisions. Adopting the C2C model in the pet rescue scenario means the platform doesn't hold pets or act as an intermediary — instead, it lets rescuers and adopters connect directly. This reduces platform operating costs and better aligns with the charitable nature of the service. This decentralized design makes the platform more vibrant and closer to real-world pet rescue scenarios.
Technical Architecture Analysis
Technology Stack Selection
| Layer | Technology | Description |
|---|---|---|
| Frontend | UniApp | Cross-platform mini program development framework |
| Backend | Spring Boot | Mainstream Java microservice framework |
| Communication | WebSocket | Real-time chat functionality |
| Architecture | Frontend-Backend Separation | RESTful API interaction |
Choosing UniApp for WeChat Mini Program development is a pragmatic decision — it not only supports WeChat Mini Programs but can also compile a single codebase to multiple platforms. UniApp is a cross-platform development framework based on Vue.js, released by DCloud. Its core value lies in "develop once, publish everywhere." Developers write code using Vue syntax, and the compiler can generate applications for WeChat Mini Programs, Alipay Mini Programs, H5 web pages, iOS Apps, Android Apps, and more. Compared to native WeChat Mini Program development (using WXML+WXSS+JS), UniApp's advantages include: reusing the rich component libraries in the Vue ecosystem and lowering the learning curve; meanwhile, its conditional compilation mechanism allows writing platform-specific differential code, balancing cross-platform convenience with native platform requirements.
Spring Boot as the backend framework provides rapid development, auto-configuration, and other conveniences, making it ideal for quick delivery of small to medium-sized projects. Spring Boot is a rapid development scaffold based on the Spring framework, released by the Pivotal team in 2014. Through its "convention over configuration" philosophy, it greatly simplifies the initial setup and development of Spring applications. Core features include: Auto-Configuration that automatically completes Bean configuration based on imported dependencies; embedded Tomcat/Jetty servers eliminating the need to deploy WAR packages; the Starter dependency mechanism that bundles common technology stacks into a single dependency; and Actuator providing application monitoring endpoints. For small to medium-sized projects, Spring Boot enables developers to set up a running web service within minutes, focusing their energy on business logic rather than framework configuration.
Role and Permission Design
The system defines two roles:
- Regular User: Publish pets, apply for adoption, manage their own pets and adoption records
- Administrator: Review pet information, manage articles and news, handle online consultations
This concise role division meets business requirements while reducing system complexity.
Core Feature Modules Explained
Pet Publishing and Review Mechanism
When users publish a pet, they need to fill in the following information:
- Pet category (categories and icons configurable in the backend)
- Pet name, gender, age
- Pet photos
- Brief description
After submission, the pet is not immediately displayed on the frontend — instead, it enters a review process. Administrators must review pet information in the backend, and only approved pets will be displayed in the mini program.
One of the core challenges facing UGC (User Generated Content) platforms is content governance. Since content is independently published by massive numbers of users, platforms must establish review mechanisms to filter out non-compliant, false, or low-quality content. Common review models include: pre-publication review (content displayed only after approval), post-publication review (content displayed first, then taken down asynchronously if violations are found), and machine review + manual re-review (AI initial screening + human final review). This project adopts the "pre-publication review" model. Although it has slightly lower timeliness, for pet rescue scenarios involving animal welfare, strict pre-publication review effectively prevents the spread of false and fraudulent information, protecting platform users' interests. This design effectively prevents the spread of harmful information and ensures platform content quality.
C2C Adoption Process Design
The adoption process is the most critical business logic of the entire system. The complete flow is as follows:
- User A publishes a pet → Administrator approves → Pet goes live
- User B browses pets → Clicks "Apply to Adopt" → Fills in applicant name, contact information, and reason for adoption
- User A receives the application → Views it in "Adoption Requests Received" → Chooses to approve or ignore
- Adoption completed → Status updated for both parties
The highlight of this process is that the adoption decision is given to the pet publisher (original caretaker), not the platform administrator. This better reflects real-world pet rescue logic — the rescuer has the right to choose a suitable adopter.
From a technical perspective, this adoption process is essentially an implementation of a State Machine. A state machine is a classic design pattern in software engineering for describing an object's lifecycle. An entity goes through multiple states during its lifecycle, with transitions between states triggered by specific events. In this project, the pet entity's state flow is: Pending Review → Approved (Listed) / Rejected → Applied For (Locked) → Adoption Completed. The value of state machine design lies in: clearly defining allowed operations in each state (e.g., an already-adopted pet cannot be applied for again), preventing illegal state transitions; and providing clear logical basis for frontend display (showing different action buttons for different states). In actual development, frameworks like Spring StateMachine can be used to implement complex state transition logic.
WebSocket Online Consultation Feature
The system integrates a real-time chat feature based on WebSocket, allowing users to directly consult with backend administrators online. WebSocket is a protocol for full-duplex communication over a single TCP connection, standardized by IETF as RFC 6455 in 2011. Unlike the traditional HTTP request-response model, once a WebSocket connection is established, the server can proactively push data to the client without client polling. The workflow is: the client first initiates a special "upgrade" request via HTTP (Upgrade: websocket), and after the server agrees, the connection switches from HTTP to WebSocket protocol, after which both parties can send messages at any time. In instant messaging scenarios, WebSocket can reduce over 90% of unnecessary network requests compared to HTTP polling, reducing latency from seconds to milliseconds, making it ideal for chat, real-time notifications, and similar scenarios. The introduction of WebSocket enables real-time message pushing without users manually refreshing, providing a smoother experience.
Project Highlights and Learning Value
Architecture Level
- Frontend-Backend Separation: Frontend UniApp interacts with the backend via APIs, with clear responsibilities and easy team collaboration
- Modular Design: Pet management, user management, review management, and other modules are independent and easy to extend
- Real-time Communication: WebSocket application demonstrates communication methods beyond HTTP
Business Level
- Review Mechanism: Reflects the essential content governance mindset for UGC platforms
- State Transitions: Complete state machine design from pet publication → review → listing → application → adoption completion
- Multi-role Interaction: Multi-dimensional interactions between users, and between users and administrators
Target Audience
This project is particularly suitable for the following learners:
- Computer science students looking for graduation project topics
- Junior to intermediate developers wanting to learn full-stack mini program development
- Product managers seeking to understand C2C platform business logic design
Potential Optimization Directions
Although the project already has complete core functionality, there are several areas for further optimization:
-
Introduce AI Image Recognition: Automatically identify pet breeds to assist information entry. The current mainstream approach uses Convolutional Neural Network (CNN) models such as ResNet and EfficientNet, which can achieve high-accuracy breed recognition after training on large pet image datasets. Developers can directly call animal recognition APIs provided by platforms like Baidu AI or Tencent Cloud without training models themselves.
-
Geolocation Services: Recommend nearby stray pets based on LBS. LBS (Location Based Service) is one of the core technologies of the mobile internet era. Its principle involves obtaining user geographic coordinates through GPS, cell tower positioning, WiFi positioning, etc., then performing distance calculations and range queries based on coordinates. Common technical implementations include: using MySQL's Spatial Index or MongoDB's geospatial queries at the database level; using the GeoHash algorithm at the application level to encode two-dimensional coordinates into one-dimensional strings for quick retrieval of nearby points. WeChat Mini Programs natively provide the wx.getLocation interface to obtain user location, which combined with the Tencent Maps SDK can implement distance calculation and map display functionality.
-
Credit Evaluation System: Score adopters on creditworthiness to improve adoption success rates
-
Post-Adoption Follow-up Mechanism: Periodically remind adopters to upload recent photos of the pet
-
Message Push Optimization: Notify users via WeChat template messages when adoption status changes
These optimization directions not only enhance the system's practicality but also provide learners with more opportunities for technical practice.
Key Takeaways
- The system adopts a Spring Boot + UniApp frontend-backend separation architecture, supporting WeChat Mini Program operations
- The core business is a C2C pet adoption process where users can both publish and apply to adopt pets
- Includes a complete review mechanism — pets are only displayed on the frontend after administrator approval
- Integrates WebSocket real-time chat functionality supporting online consultation between users and administrators
- The project is suitable as a graduation project or hands-on case study for full-stack development learning
Related articles
TutorialsCursor + Codex Dual-IDE Collaboration: A Practical Methodology for Open-Source Project Customization
A complete methodology for open-source project customization based on real-world experience, detailing the Cursor+Codex dual-IDE workflow, seven-stage process, MVP validation, and AI source code reading techniques.
TutorialsCursor Multi-Agent in Practice: Building a Full-Stack Next.js Blog in 50 Minutes
Build a full-stack blog in 50 minutes using Cursor IDE's multi-Agent mode with Next.js, Clerk auth, and Supabase. Learn the 4-phase AI Agent workflow and key integration pitfalls.
TutorialsBuilding an AI Software Factory from Scratch: A Cursor Engineer's Hands-On Experience with Multi-Agent Collaboration
Cursor engineer Eric shares practical insights on building an AI software factory: automation levels, guardrail design, parallel Agent management, and scaling to 1000+ Agents for 24/7 development.