A WeChat Mini Program for creating WiFi access entries, generating mini program QR codes, and letting users scan to connect to store WiFi with a simple guided flow.
This project combines:
- A user-facing WiFi connection page
- A creator/admin flow for generating WiFi QR codes
- Cloud functions for secure WiFi info lookup and mini program code generation
- Poster export and record management tools for store operators
The app is designed for shops, cafes, offices, or venues that want customers to connect to WiFi by scanning a mini program code instead of manually entering credentials.
Typical flow:
- An operator creates a WiFi record with
shopName,SSID, andpassword. - The app stores that record in the cloud database and generates a mini program code.
- A customer scans the code and opens the mini program landing page.
- The app fetches the WiFi credentials through a cloud function.
- After the guided step or ad step, the mini program attempts to connect the device to WiFi.
- The success page shows the connected WiFi name and useful follow-up info.
- Create WiFi records in cloud database
- Generate permanent mini program codes for each WiFi entry
- Scan-to-connect WiFi experience
- Optional ad-gated connection flow
- WiFi record list with search
- WiFi detail management page
- Export QR poster to photo album
- Cloud function based secure data query
miniprogram-1/
|-- app.js # Mini program entry, cloud init, scan parameter parsing
|-- app.json # Global routes, window config, permissions
|-- app.wxss # Global styles
|-- sitemap.json # WeChat sitemap config
|-- project.config.json # WeChat DevTools project config
|-- project.private.config.json # Local private DevTools config
|
|-- pages/
| |-- list/ # WiFi record list, search, delete, navigate to manage/create
| |-- create/ # Create WiFi entry and generate mini program code
| |-- index/ # Scan landing page and WiFi connection flow
| |-- success/ # Connection success page
| |-- manage/ # Manage one WiFi record, preview/save QR poster, delete
| `-- logs/ # Reserved example page
|
|-- components/
| `-- navigation-bar/ # Reusable custom navigation bar component
|
|-- utils/
| |-- wifi.js # WiFi init, permission handling, connect helper
| `-- ad.js # Rewarded video ad helper, currently optional
|
|-- cloudfunctions/
| |-- getWifiInfo/ # Query WiFi info by shopId
| `-- getWxacode/ # Generate and upload mini program code image
|
`-- minitest/
`-- test.config.json # Mini program test config
The main management entry for existing WiFi records.
- Loads records from
wifi_list - Supports keyword search by shop name or SSID
- Opens create page
- Opens manage page
- Deletes records
Used by operators to create a new WiFi configuration.
- Input shop name
- Input SSID
- Input password
- Save record to cloud database
- Call cloud function to generate mini program code
- Save QR image to local album
The customer-facing landing page after scanning a mini program code.
- Reads
shopIdfrom scan params - Calls
getWifiInfo - Displays WiFi/shop info
- Starts WiFi connection
- Supports optional ad display before connection
Displayed after a successful connection.
- Shows connected SSID
- Displays password for manual backup if needed
- Copies password to clipboard
- Reads local IP address
Management page for a single WiFi record.
- Loads QR code detail
- Switches poster themes
- Previews QR code
- Exports a poster image to album
- Deletes the record and related cloud file
Looks up a WiFi record by shopId and returns only the fields needed by the client:
ssidpasswordshopName
This keeps the query logic on the cloud side instead of directly exposing all database details in the client.
Generates a WeChat mini program unlimited code and uploads it to cloud storage.
Used after a WiFi record is created so the operator can share or print the code.
Current collection used by the project:
Suggested fields based on the current code:
| Field | Type | Description |
|---|---|---|
shopId |
string | Unique short identifier used in QR scan scene |
shopName |
string | Store or location name |
ssid |
string | WiFi network name |
password |
string | WiFi password |
createTime |
date | Record creation time |
connectCount |
number | Reserved counter field |
qrcodeFileID |
string | Cloud storage file ID for generated code |
- WeChat Mini Program native framework
- WeChat Cloud Development
- Cloud Database
- Cloud Storage
- Cloud Functions
wx-server-sdk
- WeChat DevTools
- A valid WeChat Mini Program AppID
- Cloud Development enabled in your WeChat project
- Open the project in WeChat DevTools.
- Confirm
project.config.jsonpoints to the correctappid. - Enable Cloud Development for the project.
- Create or verify the cloud environment used in
app.js. - Create the
wifi_listcollection in the cloud database. - Upload and deploy the cloud functions:
cloudfunctions/getWifiInfocloudfunctions/getWxacode
- Test the create flow first, then scan the generated code to test the connection flow.
- Android WiFi connection requires location permission.
- The app requests
scope.userLocationbefore connecting to WiFi when needed. - Saving posters or QR images requires album permission.
- WiFi connection behavior in WeChat DevTools is mocked by
utils/wifi.js.
Before production release, you may want to check:
- Cloud database permissions for
wifi_list - Privacy authorization flow
- Mini program code generation permissions
- Ad unit configuration in
utils/ad.jsif you enable rewarded ads - Branding, store naming, and poster style customization
- Add admin authentication and role separation
- Add usage analytics for connect count
- Add shop grouping and multi-location support
- Add edit/update flow for existing WiFi records
- Add expiration or disable status for codes
- Replace placeholder ad config with live ad management
This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License (CC BY-NC 4.0).
You are free to:
- Share — copy and redistribute the material in any medium or format
- Adapt — remix, transform, and build upon the material
Under the following terms:
- Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made.
- NonCommercial — You may not use the material for commercial purposes.
For any commercial use, please contact the author for a separate licensing agreement.



