[Project] A Complete Smart Shared Bicycle System
A complete shared bike solution covering the user APP, smart bike lock, and management backend, with a comprehensive tech stack and a measured stress resistance of 89.7 requests/second
Project Origin
To participate in the finals of the 2025 National Youth Information Literacy Competition, we completed the basic lock/unlock function according to the given problem requirements, but to make it closer to real life and turn it into a complete and mature product, we developed more branches and innovative features, including but not limited to:GPS positioning, accident detection and alarm, vehicle fault reporting, vehicle data cluster management, backend management dashboard, user-based data management, trip data recording and displayCoveringUser-side APP, embedded smart lock, backend management system, and API service。
This article will provide an in-depth analysis of the technical architecture and implementation highlights of this system.
Team Division of Labor
| Me (XHL) | Server operations and maintenance, frontend and backend development, APP, all software parts, etc. | Personal website |
| The Sandy | 3D structural design and printing of the bike lock, hardware structure construction, assisting with ESP32 program development, etc. | Personal website |
Overall Architecture: Layered Design
The project's three-layer architecture:
| Layer | Tech Stack | Function |
|---|---|---|
| Client | Vue + Android + Amap SDK | Map display, scan-to-unlock, trip records, user center |
| Bike-side | MicroPython + ESP32 + GPS/MPU6050 | Positioning reporting, posture detection, unlock execution |
| API Service | Python Flask | Business logic processing, data interfaces |
| Data Layer | MySQL + connection pool | Data storage |
| Infrastructure | Docker + Nginx + Debian | Containerized deployment, load balancing |

Server Highlights: High Performance and High Availability
1 Connection Pool Design
The server side is developed based on Python Flask. For the database, I encapsulated it myself SQL 类
from dbutils.pooled_db import PooledDB
Measured data: The system can withstand approximately 89 requests/second of data requests, and the server never crashed during network attack tests.
2 Logging System
All API requests are recorded to the database through the server_log() function, and log types are divided into:
- USER: User login, registration, query, and other operations
- BIKE: Bike unlock, lock, location update
- ACCI: Accident alarm, anti-theft alarm
- MAIN: Repair request, repair completed
- PANEL: Backend data access
This not only facilitates problem tracing, but also provides a foundation for data analysis and operational decision-making.
3 DingTalk Alert Integration
Accident alarms and anti-theft alarms are pushed in real time via DingTalk bot:



III. Smart Bike Lock: The Combination of Hardware and Algorithms
1 Mechanical Structure Iteration
Modeling design and 3D printing were completed by The Sandy (Personal website)
The enclosure went through five generations of iteration:
| Version | Material | Improvement |
|---|---|---|
| First generation | PLA | Verified basic structural feasibility |
| Second generation | PLA | Optimized lubricant solution |
| Third generation | PLA | Optimized fixation solution |
| Fourth generation | PETG-CF | Significantly improved strength |
| Fourth+ generation | PETG-CF + PETG window | Resolved GPS signal shielding issue |
Technical details: Carbon fiber reinforced PETG shields GPS signals, so the antenna area specifically uses a PETG window design.
2 Attitude Detection and Accident Alarm
Uses the MPU6050 six-axis sensor to detect vehicle attitude in real time. When an abnormal impact is detected (such as a fall), the system will:
- Pop up a prompt via the OLED screen, giving the user 10 seconds to cancel(to prevent false alarms)
- After confirmation, call the
/bike/accidentAPI - The server queries the user's pre-registered emergency contact
- The DingTalk bot automatically pushes the accident location and user information
3 Power Management and Photovoltaic Charging
Solar panel → Charging IC → 7.4V lithium battery
- Photovoltaic charging: 6V 3W solar panel continuously replenishes power
- Low-power strategy: Automatically retries when GPS has no data; after the reed switch is abnormally triggered three times, it retries and then reports a fault
IV. Backend Management System: Data Visualization

The backend adopts Vue3 + ECharts + Amap API Built with, features include:
- Dashboard: Real-time refresh of total bikes, total users, and total requests
- Bike Location Tracking: Real-time display of all vehicle distribution on the map
- User Management: View all user information and operation records
- Riding Records: Order details, trajectory playback
- Maintenance Management: Repair/fix status flow
- Log Audit: Full query of server logs, bike logs, and user logs
V. API Interface Design Specification
Client Interface Examples
| API | Path | Description |
|---|---|---|
| User Login | POST /client/login | Return nickname and status |
| Nearby Bikes | POST /client/nearby | Latitude and longitude range query |
| Unlock Bike | POST /client/unlock | Create riding record |
| Get Records | POST /client/getrecord | Historical orders |
Bike Device Interface
| API | Path | Description |
|---|---|---|
| Status Check | POST /bike/check | Return lock/unlock |
| Location Update | POST /bike/update | Real-time trajectory reporting |
| Accident Alert | POST /bike/accident | Trigger DingTalk push |
Security Design
Backend interfaces uniformly verify Token:
{"token": "AABBCC"}
VI. Deployment and Operations
The project adopts Docker containerizationDeployment, running on cloud servers:
- OpenResty: Port forwarding, load balancing
- MySQL container: Data persistence
- Python Flask container: API service
- Docker Compose: One-click orchestration startup
Project Highlights Summary
- Complete closed loop of tech stack: From hardware (ESP32/MPU6050/GPS) to APP (Vue/Android), from server side (Flask) to database (MySQL), and then to dashboard (Vue3/ECharts), covering the full chain
- Engineering practices in place: Connection pooling, log classification, Docker deployment, with production environment usability
- Security and emergency mechanisms: Accident alarm + 10-second cancellation mechanism, anti-theft alarm, DingTalk real-time push
- Excellent performance: Measured 89.7 concurrent requests per second, server remains stable and does not crash under attack testing
Welcome technical exchange. If you need the complete source code and hardware files, pleasecontact