English | 简体中文
Sprout is a native WeChat journal for a baby’s first year. Caregivers share daily records, photo memories, WHO growth charts, postpartum meals and supplies, and can ask a photo-aware assistant about the selected baby’s journal.
A fresh checkout keeps the journal on the device. Configure either a single self-hosted Linux server (deploy/selfhost/) or a Tencent CloudBase environment to sync through PostgreSQL 17 and private media storage and to run the Rust assistant (anxinya-harness). PostgreSQL verifies the caller and family membership. Each family has an eight-character invitation code containing both uppercase letters and digits.
- With Node.js 20 or newer, run
npm cifrom the repository root. Thepreparehook createsminiprogram/config.local.json first install. To open the journal, import the repository root in WeChat DevTools. The public project usestouristappidfor offline development. - On the Daily Care sample banner, choose 录入我的宝宝 (Enter my baby) to set a nickname, birth date, sex, gestational age and delivery mode. Saving clears the selected sample journal and removes untouched sample siblings. Turn off the clear-samples switch to keep the example. The profile list also supports adding a separate baby and confirming profile deletion.
- Once cloud sync is configured, open Family Space at the top left. The badge confirms when WeChat has signed in silently and cloud sync is connected. Open the Mini-Program with the same WeChat account on another device to find your synced families.
- The drawer shows your 8-character Family Code and lets you share an invite card (
?familyCode=XXXXXXXX) with another caregiver. - To join, open an invite or enter the code, check the family preview and choose your role. Add a display name if you like, then tap 确认加入家庭 (Join family). After joining, open Family Space → Edit my identity and preferences to change your settings.
- Family Space keeps journals from earlier custom environments in local archives. Open the family cloud space to use the shared service. Previously linked journals retain their original local scope.
- The drawer shows your 8-character Family Code and lets you share an invite card (
When WeChat asks for privacy consent to use the clipboard, choose a photo or record audio, the privacy guide opens above the current drawer. Tap its title to read it. Agreeing continues the action you started. If you decline, tap the same action whenever you want to try again. If the device blocks a copy, a dialog displays the full text. You can also long-press the family code, purchase link, visit-summary lines or assistant replies to select text.
- Mini-Program client. In the ignored
miniprogram/config.local.js, setenvId, the whitelisted gateway originbaseUrl(https://<your-env-id>.api.tcloudbasegateway.com), and the anonymouspublishableKeyfrom CloudBase. The storage bucket defaults toanxinyaandcloudRunServicedefaults toanxinya-harness. An emptywxProviderIduses the running Mini-Program’s AppID. To override individual fields by channel, add, for example,module.exports.envVersions = { trial: { cloudRunService: 'sprout-trial' } }. The resolver selectsdevelop,trialorreleasefromwx.getAccountInfoSync().miniProgram.envVersion. Client template - WeChat project. Copy
project.private.config.example.jsonto the ignoredproject.private.config.jsonif you do not already have it. Set itsappidto<your-wechat-appid>. For an experience upload, runnpm run upload:mp -- -v <version> -d "<description>". The wrapper accepts aWECHAT_APPIDoverride, checks the effective trial cloud settings, and restores the originalproject.config.jsonwhen the CLI exits. Private project template - CloudRun server. Set
CLOUDBASE_GATEWAY_URL,CLOUDBASE_PUBLISHABLE_KEY,CLOUDBASE_APIKEY,ANXINYA_MASTER_KEYandANXINYA_ADMIN_PASSWORDon the service. Sign in tohttps://<your-cloudrun-domain>/adminto configure vendor keys, endpoints and model routes. The service-role key, master key, admin password and vendor credentials belong on the server.
npm test
npm run check:mpThe Node tests use a synthetic gateway. The static check also runs the standalone WCC/WCSC binaries when installed. For a focused check, run, for example, node --test tests/calendar.test.mjs. Contributors using docs-sync verify both READMEs with python3 ~/.agents/skills/docs-sync/scripts/verify_docs.py . --strict-bilingual. Simulator commands are opt-in and can open a window. Repository workflow
- Open Yaya AI on Daily Care to resume the active conversation. The Trends and Meals buttons open fresh growth and food conversations. New families start with AI access disabled until an administrator enables the family’s 8-character code in
/admin; when locked, the assistant shows a Yaya AI Pending Activation card with a one-tap Family Code copy button and a Refresh Status action while daily care records and photo sync remain fully usable. Once enabled, the baby strip shows exact age and today's logged bottle milk, nursing, sleep and diapers. Tap the name to switch babies. - Tap the model pill above the input to choose DeepSeek V4.1 Flash, GLM-5.3-Flash, GLM-5.4, Kimi K3, Kimi K3.1 Pro or MiniMax M3.1 Flash, and tap the Thinking pill to choose from four thinking effort levels (Off, Low, Medium, High; default Medium). The device remembers both preferences.
- Type a question, attach up to three photos, or choose a starter for stool photos, postpartum meals, multi-entry logging or a routine review. The input tracks native keyboard height smoothly without double safe-area gaps, scrolls to the latest message when the keyboard opens, and dismisses the keyboard when tapping the conversation thread. When the model sends reasoning, its card opens above the answer and folds as the answer arrives. Tap the card to read it again. You can stop a reply or retry it in place.
- The badge below the reply identifies the model. Copy a formatted reply, tap a suggested follow-up, or check the date, time and details on proposed cards. Save one card or all outstanding cards. History restores earlier conversations for this baby. New chat starts another. Product design
The app has seven native pages. Daily Care, Trends, Meals and Inventory are tabs. Growth Moments, Nursing and the AI assistant open as subpages.
| Module | Entry | Core Interactive Controls |
|---|---|---|
| Family Space & Isolation | miniprogram/utils/family.js, miniprogram/utils/cloud.js, cloudbase/migrations/ | Families share random 8-character alphanumeric codes or WeChat invite cards. Grandparents start with large text. Other roles, including parents and nannies, start with standard text. Haptics are on, quick bottle feeds use 120 ml and the timeline shows all entries. All four settings are also editable when adding a caregiver on this device. Timeline entries name the recorder, and family data syncs through optimistic merges over CloudBase PostgreSQL RPC. |
| Daily Care | miniprogram/pages/home/index.js | Nursing entry and active timer controls, formula/expressed milk logger with automatic stock gram deduction, 7-color stool swatches (biliary atresia & blood-stool alerts) with private blurred photos, wet-diaper counter, bath/care chips, sleep timer and manual duration preview with 30-minute to 3-hour presets, vaccine/fever (<3m urgent alert)/supplement logger, length/weight/head circumference steppers, and natural-language quick entry. Daily Care, Trends and Meals share date arrows and a return-to-today action |
| Growth Moments | Growth Moments page | Open the album from Daily Care, or start an entry from the center +. Save a note of up to 1,000 characters, up to nine photos, or both. Add milestone tags and a date. The album shows the baby’s age at each entry, the caregiver and the newest moments first. Tap a moment card to open its full detail sheet with live-resolved thumbnails, tap a tag to filter, or tap any photo to browse its gallery while preserving raw cloud:// paths on edits. |
| Nursing | miniprogram/pages/nursing/index.js | Switching sides saves the completed side and starts the other at 00:00. Ten seconds on the left and fifteen on the right produce two records. The daily list shows the count and time on each side. Start on the suggested side opposite the last drained side, pause, reset the current side, or discard it. Manual entry supports 1–45 minutes, including past dates. Use the daily list to edit a record or confirm its deletion. |
| Trends & Clinic | miniprogram/pages/trends/index.js | 24-hour daily distribution lanes, 7-day bar charts, sex-specific WHO P3/P50/P97 growth curves (Canvas 2D + SVG fallback) with premature corrected-age switch, 0-12 month immunization checklist, and one-tap clipboard export of a pediatric clinic summary card |
| Postpartum Meals | miniprogram/pages/meals/index.js | Vaginal vs. C-section delivery toggle, 4 postpartum stages initially selected from the baby’s age, -200ml / +200ml hydration tracker, 6 meal slots with 254 everyday & postpartum foods across 10 categories, 1-tap meal combos & efficacy filters, a 5-group dietary diversity bar, live protein/iron/calcium/fiber recalculation, and 48-hour maternal diet to infant symptom correlation |
| Supply Inventory (JD Supported) | miniprogram/pages/inventory/index.js | Covers all 8 baby, nursery & postpartum categories (formula, diapers, feeding gear, skincare & meds, apparel & bedding, travel gear, bath & household, toys & early learning) with 92 presets, clothing size tags (52–90), non-formula fallback, and smart consumable vs. durable UX so single-unit durables (baby cameras, kettles, strollers, bathtubs, clothes) show in-use status and quantity steppers without false low-stock alerts. Supports both single-item and multi-link batch smart import (concurrently resolving multiple pasted JD/Taobao/PDD links or SKUs with per-row preview and one-tap batch save), opens JD items in the official WeChat Mini-Program (wx91d27dbf599dff74), and tracks opened-formula countdowns and weight-linked diaper warnings |
Tap the date in Daily Care, Trends or Meals, or tap the timeline’s entry count. The Apple Calendar-style month view shows active days, feeding totals, average sleep on days with sleep, and growth and meal counts. Dots mark feeding, diapers, sleep, and growth, care or meals. Tap a date to preview the baby’s age and that day’s entries. Tap the date again or choose View this day to open it. Forms use the same calendar inline.
An entry counts on its logged date. Each filled meal slot and each day with recorded water adds one entry. Overnight sleep contributes time to each day it spans, and paused intervals are excluded.
The meal picker includes 254 Chinese everyday and postpartum foods across ten categories, generated through compact composable SVG illustrations. Search by name, regional alias, benefit tag or pinyin initials, apply a slot-tailored postpartum combo, pick a frequently used food from 最近常吃, or enter any custom dish name in one tap. In an empty meal slot, 沿用昨日 copies the foods from yesterday’s matching slot. Catalog servings contribute to the 5-group dietary diversity bar, protein, iron, calcium and fiber estimates, and 48-hour allergen correlation in both the Mini-Program and the Rust harness. Food catalog
Choose 吸奶器 in Nursing to record 5–500 ml expressed from both, left or right sides (双侧, 左侧, 右侧). Use the timer, enter a duration of up to 60 minutes, or save volume alone. The journal and assistant total expressed volume and sessions separately. Direct nursing contributes minutes, and bottle intake is recorded when the baby drinks the milk. Nursing page
The Mini-Program uses wx.request to send POST /api/v1/chat and POST /api/v1/chat/stream under the whitelisted CloudRun OpenAPI URL https://<your-env-id>.api.tcloudbasegateway.com/v1/cloudrun/anxinya-harness. Each request carries Authorization: Bearer <wechat_jwt>, familyCode, sessionId, activeBabyId, day, message, images and an optional single-baby draft. CloudBase HTTP API access
Opening the assistant sends a background GET /health to the same service at most once every 45 seconds. On cold launch, the first message waits for family sync so membership can be registered. If the gateway reports HTTP 503 or SERVICE_NOT_READY, chat retries once after 1.2 seconds. A 401 triggers one token refresh. A timeout or interrupted connection keeps the original question, attachments and partial answer together for manual retry.
Both chat routes and /api/v1/admin/playground* accept optional provider, model, thinkingEffort (off | low | medium | high, default medium) and legacy boolean thinking fields. The server resolves the selection against the platform’s enabled providers and models. Anthropic routes map low / medium / high to budget_tokens (1024 / 4096 / 12000), and OpenAI-compatible routes send reasoning_effort (plus thinking for GLM and Kimi). If an upstream model rejects optional thinking parameters with HTTP 400, the harness strips them and retries once automatically. Setting thinkingEffort to off omits upstream thinking budgets and suppresses reasoning chunks from the stream.
The Mini-Program requests chunked SSE on the first turn, including on iOS. It reads a buffered SSE or JSON body from that same request when needed. An explicit chunk-unsupported error enables JSON fallback for later turns. An unavailable streaming route can also fall back for the current turn. SSE status.stage can be journal, photo, thinking or writing. Redacted reasoning arrives in reasoning.text and answer text in delta.text. The final done contains message, sessionId, provider, model, proposedActions and optional followUps. Older deployments can still supply the answer while the device suggests follow-ups.
This device keeps up to 20 threads per family and baby, with up to 32 messages per thread and a 256 KiB budget per baby. Local history contains compact photo references. If WeChat expires a temporary file, retry lets you choose it again. Deleting a local thread leaves saved journal entries and server-side family memory intact.
The family RPC checks the caller’s identity, family membership and per-family AI access (ai_enabled, default false) before any model call. Anonymous tokens and missing or invalid identities receive 401 WECHAT_AUTH_REQUIRED, nonmembers receive 403 FAMILY_FORBIDDEN, and families not yet enabled for AI receive 403 AI_NOT_ENABLED while regular journal sync and private photo storage stay unaffected. Operators grant or revoke family AI access in /admin (PUT /api/v1/admin/families/{code}/ai-access). The active baby’s recent care, meals, growth measurements, milestone text and tags, and 8-category inventory go to the selected chat model. The vision model reads attachments when the chat model accepts text only. Replies can propose text-and-tag growth moments, meals, measurements, nursing or pumping, bottle feeds, sleep, stool, urine, care, health and inventory. Saving a card requires caregiver confirmation. Formula volume can be logged without selecting stock. A linked formula item also updates inventory. Assistant page
Family histories, USER.md, MEMORY.md, recall and reflection revisions share the verified family scope across devices and CloudRun replicas. The backend checks the chat selection and looks up the configured vision route when needed. Operators manage global prompts and SKILL.md in the password-protected console. Rust Harness
The Growth Moments card on Daily Care shows the active baby’s latest note, date and milestone tag, plus up to four recent photos. The badge on the fourth photo counts the remaining photos. Tap a thumbnail to browse that entry’s photos in order, or tap the card to open the album. The daily timeline also shows thumbnails. Synced photo links are cached per family and can be used on startup while still valid.
Use Write a moment on the Daily Care banner to open the composer. You can add photos in several batches, remove individual images, and edit a saved entry from the album or timeline. Photos stay on the device while offline. Family sync publishes the gallery in its original order when every photo is available in private Storage. Deleting a moment asks for confirmation. The assistant receives milestone text and tags. Gallery images go to chat only when a caregiver attaches them there. Growth Moments page
On Daily Care, tap the age badge to open the baby’s profile. To record vitamin D3, open Health → Supplements/medicine.
Open Growth measurements in Daily Care. Choose Weight only for a home weigh-in, All three for a checkup, or tap weight, length and head circumference individually. Each control starts at the last known value for that measurement as of the entry time. Tap a timeline entry to add or remove a measurement. Only selected fields (weight, length, head) are saved and synced. The + on the growth tile repeats the previous entry’s measurements and values.
Voice quick entry accepts phrases such as 体重10.4斤 (5.2 kg) and 体重5.2 身长58 (5.2 kg and 58 cm). Each WHO curve plots entries containing its measurement and has a shortcut to log that measurement alone. The pediatric visit card lists the values recorded in each entry. Diaper size reminders use the latest recorded weight, even after a newer length or head measurement.
In Trends → WHO growth curve, choose 1 week, 1 month, 3 months, 6 months or 12 months. The weekly window ends on the selected day and shows a full week on the day of birth. The monthly view shows the first month through day 30, then the most recent 30 days. Tap a point or step between readings to see its exact value, date, time, age and change since the previous measurement. The inspector shows the P3–P97 range and P50 median interpolated from the monthly WHO table, with an Edit button for that entry.
| Command | Purpose |
|---|---|
npm run verify |
Runs npm run check:mp followed by npm test |
npm run harness:test |
Runs the Rust unit and integration tests |
npm run harness:serve |
Builds and starts the release binary using the CloudBase runtime variables. Use -- --bind 127.0.0.1:9000 --data-dir <dir> for isolated local development |
npm run check:mp |
Validates Mini-Program & Cloud Function structure, page/component registration, WXML/WXSS syntax, handler bindings, < 2 MiB client bundle budget, and WeChat wcc/wcsc compilation via scripts/check-mp.mjs |
npm test |
Executes the assistant chat and journal-card tests, behavioral tests, CloudBase PostgreSQL and family isolation, concurrent merge, JD parser, and compiler-fixture tests via node --test |
npm run prepare |
Copies the client template on first use and preserves existing local settings |
npm run upload:mp -- -v <version> [-d <description>] |
Uploads an experience build using the local AppID and client settings |
npm run devtools:open |
Opens this project in WeChat DevTools via CLI (scripts/devtools.mjs) |
node scripts/devtools.mjs calendar |
Checks month navigation, activity dots, daily and monthly summaries, and 390 px layout in both text sizes with an in-memory journal. Returns to today. |
node scripts/devtools.mjs growth-moments |
Checks growth point selection after scrolling, photo sizes on Daily Care, the timeline and the album, and horizontal overflow at 390 px in both text sizes using an in-memory journal. |
node scripts/devtools.mjs agent |
Checks the assistant title, six model choices, thinking effort selector and horizontal overflow at 390 px in both text sizes. Restores the simulator’s preferences. |
npm run devtools:e2e |
Checks family sync, invites, care entry, JD imports, four tabs and the 254-food picker. At 390 px both text sizes exercise the four scenarios, a live gateway reply, history restoration, contextual entries and confirmed batch saves in a disposable journal. |
npm run cloud:deploy -- <env-id> |
Maintenance command for the archived native journal function |
| Environment Variable | Default | Description |
|---|---|---|
WECHAT_DEVTOOLS_CLI |
/Applications/wechatwebdevtools.app/Contents/MacOS/cli |
Custom path to the WeChat DevTools cli binary |
WECHAT_DEVTOOLS_AUTO_PORT |
Local port selected per calendar build, 9421 for the full suite |
Overrides the DevTools automation WebSocket port. Calendar checks reuse a running simulator when its checkout, Mini-Program files and project configuration match. |
ALLOW_TMP_DEVTOOLS |
unset | Set to 1 to explicitly allow simulator commands from a checkout under /tmp or /private/tmp |
WECHAT_APPID |
Local private project AppID | Overrides the AppID for npm run upload:mp |
PORT |
9000 |
HTTP listener on all interfaces. Override with serve --bind <address:port> |
DATABASE_URL |
(unset) | Enables single-server self-hosted mode via direct PostgreSQL 17 TCP (postgres://...), replacing CLOUDBASE_GATEWAY_URL and CLOUDBASE_APIKEY |
DATABASE_APP_ROLE |
anxinya_app |
Non-superuser NOBYPASSRLS PostgreSQL role assumed via SET LOCAL ROLE inside every self-hosted transaction |
SPROUT_PUBLISHABLE_KEY |
required in self-hosted mode | Public client bearer token for /auth/v1/* and provisional anonymous anxinya_rpc calls |
SPROUT_JWT_SECRET |
server secret (>= 32 bytes) |
Distinct HMAC-SHA256 secret signing access/refresh JWTs and local media download URLs in self-hosted mode |
SPROUT_MEDIA_DIR |
/var/lib/sprout/media |
Local directory storing per-family attachments (<familyCode>/<name>) in self-hosted mode when SPROUT_COS_* is unset |
SPROUT_PUBLIC_BASE_URL |
(derived from Host) |
Optional canonical external origin (e.g. https://sprout.example.com) for fullSignedURL responses |
SPROUT_COS_BUCKET |
(unset) | Optional Tencent Cloud COS bucket name (<name>-<appid>) for offloading self-hosted family media to private COS with pre-signed HTTPS URLs |
SPROUT_COS_REGION |
(unset) | Tencent Cloud COS region paired with SPROUT_COS_BUCKET (e.g. ap-beijing) |
SPROUT_COS_SECRET_ID |
(unset) | Least-privilege CAM SecretId for COS object upload and V5 URL signing |
SPROUT_COS_SECRET_KEY |
(unset) | Least-privilege CAM SecretKey paired with SPROUT_COS_SECRET_ID |
WECHAT_SECRET |
server secret | Official WeChat Mini-Program AppSecret paired with WECHAT_APPID for /auth/v1/provider/token jscode2session exchange |
CLOUDBASE_GATEWAY_URL |
required in CloudBase mode | PostgreSQL gateway origin, https://<your-env-id>.api.tcloudbasegateway.com |
CLOUDBASE_PUBLISHABLE_KEY |
required in CloudBase mode | Public gateway key for caller-scoped RPCs |
CLOUDBASE_APIKEY |
server secret | Service-role key for platform settings and selected-family admin operations in CloudBase mode |
ANXINYA_MASTER_KEY |
server secret | Stable, high-entropy secret used to derive the AES-256-GCM key for vendor credentials |
ANXINYA_ADMIN_PASSWORD |
server secret | Console password, admin API Bearer credential and session signing secret |
WECHAT_CLOUD_ENV |
(empty) | Default wx.cloud environment ID used by npm run cloud:deploy when not passed as a CLI argument |
Run PostgreSQL 17, anxinya-harness and Caddy on one server with zero Mini-Program code changes:
- Copy
deploy/selfhost/.env.exampletodeploy/selfhost/.env, runchmod 600 deploy/selfhost/.env, and set strong secrets (POSTGRES_PASSWORD,SPROUT_PUBLISHABLE_KEY,SPROUT_JWT_SECRET,ANXINYA_MASTER_KEY,ANXINYA_ADMIN_PASSWORD), plusWECHAT_APPIDandWECHAT_SECRET. - Start the stack from
deploy/selfhost/:docker compose -f deploy/selfhost/docker-compose.yml up -d --build
init-db.shenablespgcrypto, creates non-superuserNOBYPASSRLSroles (anxinya_app,anxinya_owner,anon,authenticated,service_role), appliescloudbase/migrations/*.sqlin order, and enforcesFORCE ROW LEVEL SECURITY. PostgreSQL binds strictly to127.0.0.1:5432. - Leave
SPROUT_DOMAIN=:80during initial IP bootstrap before ICP filing finishes; once DNS resolves to your server, setSPROUT_DOMAIN=sprout.example.comandSPROUT_PUBLIC_BASE_URL=https://sprout.example.comsoCaddyfileenables automatic Let's Encrypt HTTPS with unbuffered SSE (flush_interval -1). - In
miniprogram/config.local.js, setenvId: 'sprout-selfhost',baseUrl: 'https://sprout.example.com'andpublishableKeymatchingSPROUT_PUBLISHABLE_KEY, then addhttps://sprout.example.comto WeChatrequestanddownloadFilelegal domains (mp.weixin.qq.com). Openhttps://sprout.example.com/adminto configure LLM vendor keys.
- Use PostgreSQL 17 in your CloudBase environment. For a fresh database, apply the SQL migrations in filename order. For an existing deployment, apply only outstanding migrations and retain the deployed token-hash prefix so provisional family identities still resolve. SQL migrations
- Build with
docker build -t anxinya-harness harness. Deploy as CloudBase Run serviceanxinya-harnesswith the variables above and container port9000. Enable CloudRun OpenAPI access for the Mini-Program. Route the environment HTTPS domain’s/admin,/api/v1/*and/healthpaths to the same service for browser access. The health response is exactly{"ok":true,"service":"anxinya-harness","runtime":"rust"}. Dockerfile - Open
https://<your-cloudrun-domain>/admin, sign in and enter the API key issued by each vendor you use. The platform defaults for chat and vision are Kimik3.1-pro. All six models in the consumer picker accept images in the stock configuration. The harness sends the public IDdeepseek-v4.1-flashasdeepseek-v4-flashonapi.deepseek.com. Older saved factory catalogs on the original endpoints gain the new presets automatically. For a customized model list, add and enable the IDs you want to offer. The console also supports custom HTTPS OpenAI/Anthropic endpoints, HTTP(S) outbound proxies and an eight-token connectivity probe. Vendor keys are encrypted in PostgreSQL. Preserve the master key with backups. - Edit prompts and global skills, roll back skill revisions, configure stdio/HTTP MCP, toggle per-family Yaya AI access (
AI Enabled/AI Disabled), or select a family for memory inspection, recall and revision rollback. The multimodal playground uses temporary conversation state and supports four thinking effort levels (Off/Low/Medium/High). External MCP servers run in the operator playground and offline CLI. Consumer tools receive the verified family’s data. POST /api/v1/admin/logintakes{"password":"…"}and returns a signed 12-hourHttpOnly; SameSite=Strictcookie withSecureover HTTPS.GET /api/v1/admin/sessionreports authentication andPOST /api/v1/admin/logoutclears the cookie. Automation can useAuthorization: Bearer <admin-password>on management endpoints. Password rotation invalidates existing sessions.
Consumer calls go to anxinya_family_agent_rpc with the publishable key and the caller’s WeChat JWT. Platform settings and skills go to anxinya_platform_admin_rpc with the service role. Selecting a family in the console enables its authorized adminOverride RPC. The explicit --data-dir <dir> development backend stores JSON on disk. Keep a separate backup of legacy local SQLite data, which lacks a verified family association.
Enable the official WeChat Mini-Program provider (WX_MICRO_APP, AppID <your-wechat-appid>) in your CloudBase environment. The client exchanges a one-time wx.login() code through CloudBase Auth (/auth/v1) for an access JWT and a refresh token. Family RPC calls, media uploads and signed URL requests use the JWT. The client caches the session per environment and refreshes it silently within two minutes of expiry. The family agent RPC accepts a signed WeChat JWT even when it omits app_metadata.provider. CloudBase PostgreSQL authentication
Before the first successful WeChat sign-in, a device can sync under a provisional tcb_ identity when the gateway is reachable. On verified sign-in, the RPC uses the existing clientToken to migrate family memberships and creation receipts to the WeChat OPENID. The app keeps the selected family, unsynced records and pending member preferences. If authentication later becomes unavailable, the journal stays editable locally and retries sync under the bound account.
.
├── project.config.json # Mini-Program & CloudBase config (miniprogramRoot + cloudfunctionRoot)
├── project.private.config.example.json # Template for the ignored private WeChat project settings
├── package.json # Verification, DevTools E2E & cloud deploy scripts
├── cloudbase/
│ └── migrations/ # Versioned PostgreSQL 17 schema & SECURITY DEFINER RPC migrations
├── deploy/
│ └── selfhost/ # Turnkey single-server Docker Compose, Caddyfile, .env.example & init-db.sh
├── cloudfunctions/
│ └── anxinya-sync/ # Archived journal function for older deployments and regression fixtures
├── harness/ # CloudRun Dockerfile, Rust service, domain data, built-in skills and API tests
├── miniprogram/ # Shippable Mini-Program client package (under 2 MiB)
│ ├── app.js # App lifecycle, invite query capture & family/cloud bootstrap
│ ├── app.json # WebView renderer, routes, global components & custom tabBar
│ ├── app.wxss # Design tokens, sage-and-cream palette & elder large-text rules
│ ├── custom-tab-bar/ # 4-tab bar with elevated center "+" quick-entry trigger
│ ├── assets/ # Local SVG illustrations & sample WebP media
│ ├── components/ # calendar-picker, date-field, baby-header, bottom-sheet and journal entry controls
│ ├── pages/ # home, trends, meals, inventory (tabs), moments, nursing and agent (subpages)
│ ├── templates/ # Shared WXML templates (journal, family & date stepper)
│ └── utils/ # Domain modules (family, family-page, workspace, cloud, store, storage, inventory, records, who)
├── scripts/
│ ├── check-mp.mjs # Structural, AST, cloud function, bundle-size & WCC/WCSC compiler audit
│ └── devtools.mjs # WeChat DevTools CLI launcher, cloud deployer & live simulator E2E runner
└── tests/ # Automated tests (home, trends-meals, inventory, jd, family-client, family-cloud, audit)
Enabling Live WeChat DevTools Automation, Domain Allowlist & Privacy Declarations
- Enable the IDE service port for an explicitly requested simulator run or upload.
- Open WeChat DevTools (
/Applications/wechatwebdevtools.app) and sign in via WeChat QR code. - Open Settings -> Security Settings and turn Service Port On.
- Use a 390 px simulator. The calendar check exercises the calendar on Daily Care. The full end-to-end runner sends a greeting to the deployed CloudRun assistant, checks the rendered reply, reopens its history, confirms two fixture cards, and saves and deletes a 120 ml pump record in a disposable fixture. In both text sizes it creates, edits and deletes a multi-photo moment and measures all three gallery layouts. It also checks that dismissing the live meal picker preserves the selected foods.
- The clipboard test copies a sample shopping link to the simulator clipboard and pastes it into an inventory draft. The runner taps the native agreement button if the privacy prompt appears. The assistant photo check uses a bundled image in a draft.
- Open WeChat DevTools (
- Production request domains:
- The assistant and journal share the gateway origin
https://<your-env-id>.api.tcloudbasegateway.com. List it under Development Management → Development Settings → Server Domain →requestLegal Domains onmp.weixin.qq.com. For JD imports, the updated harness fetches allowed product pages throughPOST /api/v1/inventory/jd-page. Until it is deployed, caregivers can paste a share title or fill the item name manually. Gateway routes
- The assistant and journal share the gateway origin
- WeChat Console Privacy Declarations:
- Declare album/camera (
wx.chooseMedia), microphone (wx.getRecorderManager), and clipboard (wx.getClipboardData/wx.setClipboardData) usage in the WeChat Mini-Program console privacy settings.
- Declare album/camera (
Released under the MIT License.