Skip to content

WuSuBuDuoMing/freshkeeper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

12 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

FreshKeeper โ€” AI Fridge Food Management

WeChat Mini Program License: MIT Version CI PRs Welcome

A WeChat Mini Program that helps you manage fridge inventory, track expiry dates, build shopping lists, and get AI-powered recipe recommendations.

English | ไธญๆ–‡ๆ–‡ๆกฃ


Table of Contents

Features

Feature Description
Fridge Dashboard Food overview, daily tasks, quick actions at a glance
Food Management Category filtering, search, status tracking, bulk operations
Expiry Alerts Tiered warnings: today / 3 days / 7 days / expired
Shopping List Manual add, category grouping, cost estimation, auto-replenish from used items
AI Recipe Recommendations Smart suggestions based on current fridge contents, prioritizing expiring items
Weekly Menu Auto-generated 7-day meal plan with breakfast/lunch/dinner
Statistics Category distribution, waste tracking, savings tips, monthly reports
Photo Recognition Camera-based food identification (mock mode, ready for real API)
Data Export Export fridge and shopping data as CSV or JSON
Family Sharing Invite code system for shared household fridge management
Nutrition Tracking Calorie and macro tracking with weekly nutrition reports
Dark Mode Light / dark theme toggle
Accessibility Font size, high contrast, color blind modes
i18n Simplified Chinese and English
Subscription Messages Expiry reminders, shopping alerts, and weekly reports via WeChat subscriptions

Architecture

Page -> Service -> Storage (three-layer architecture)
Layer Responsibility Example
Page UI rendering, user interaction pages/fridge/fridge
Service Business logic, CRUD operations services/food-service.js
Storage Local persistence via wx.setStorageSync utils/storage-utils.js

Tech Stack

  • Framework: WeChat Mini Program (native)
  • Data: Mock data + wx.setStorageSync local cache (no backend required)
  • API Layer: Unified request wrapper (services/api/request.js) with interceptors, cache, retry, and cancellation
  • Theming: CSS variables + Behavior mixins
  • Components: Pure presentational, communicate via properties / triggerEvent
  • AI Engine: Mock recipe generation with real API switch ready (services/ai-recipe-engine.js)

Quick Start

Prerequisites

Installation

git clone https://github.com/WuSuBuDuoMing/freshkeeper.git
cd freshkeeper

Run

  1. Open WeChat Developer Tools
  2. Click Import Project and select the cloned directory
  3. Enter your AppID (or use a test account)
  4. Click Compile -- the app runs immediately with mock data

No backend required. The app works entirely offline with pre-loaded mock data and local storage.

Verify Installation

After compilation, you should see:

  • Home page with food overview and daily tasks
  • 50+ sample food items in the fridge
  • 20 sample recipes
  • Working shopping list with 30 items

Project Structure

freshkeeper/
โ”œโ”€โ”€ app.js / app.json / app.wxss    # Entry point and global config
โ”œโ”€โ”€ pages/                           # 10 page modules
โ”‚   โ”œโ”€โ”€ index/                       #   Home dashboard
โ”‚   โ”œโ”€โ”€ fridge/                      #   Fridge inventory management
โ”‚   โ”œโ”€โ”€ add-food/                    #   Add/edit food item
โ”‚   โ”œโ”€โ”€ expiry/                      #   Expiry alerts page
โ”‚   โ”œโ”€โ”€ shopping/                    #   Shopping list
โ”‚   โ”œโ”€โ”€ recipes/                     #   Recipe recommendations
โ”‚   โ”œโ”€โ”€ weekly-menu/                 #   Weekly meal plan
โ”‚   โ”œโ”€โ”€ stats/                       #   Statistics and reports
โ”‚   โ”œโ”€โ”€ profile/                     #   User settings and export
โ”‚   โ””โ”€โ”€ scan/                        #   Photo recognition
โ”œโ”€โ”€ components/                      # 22 reusable UI components
โ”œโ”€โ”€ services/                        # Business service layer
โ”‚   โ”œโ”€โ”€ food-service.js              #   Food CRUD + expiry queries
โ”‚   โ”œโ”€โ”€ recipe-service.js            #   Recipe matching + weekly menu
โ”‚   โ”œโ”€โ”€ shopping-service.js          #   Shopping list management
โ”‚   โ”œโ”€โ”€ ai-recipe-engine.js          #   AI recipe generation engine
โ”‚   โ”œโ”€โ”€ stats-service.js             #   Analytics and statistics
โ”‚   โ”œโ”€โ”€ nutrition-service.js         #   Nutrition tracking
โ”‚   โ”œโ”€โ”€ family-service.js            #   Family sharing
โ”‚   โ”œโ”€โ”€ food-recognition.js          #   Photo recognition
โ”‚   โ”œโ”€โ”€ subscription-service.js      #   WeChat subscription messages
โ”‚   โ”œโ”€โ”€ export-service.js            #   CSV/JSON data export
โ”‚   โ””โ”€โ”€ api/                         #   HTTP API layer
โ”‚       โ”œโ”€โ”€ request.js               #     Unified request wrapper
โ”‚       โ”œโ”€โ”€ config.js                #     API configuration
โ”‚       โ””โ”€โ”€ interceptors.js          #     Request/response interceptors
โ”œโ”€โ”€ utils/                           # 15 utility modules
โ”‚   โ”œโ”€โ”€ storage-utils.js             #   Local storage wrapper
โ”‚   โ”œโ”€โ”€ date-utils.js                #   Date formatting and calculations
โ”‚   โ”œโ”€โ”€ food-utils.js                #   Food status helpers
โ”‚   โ”œโ”€โ”€ i18n.js                      #   Internationalization
โ”‚   โ”œโ”€โ”€ theme-behavior.js            #   Theme switching behavior
โ”‚   โ”œโ”€โ”€ accessibility.js             #   Accessibility utilities
โ”‚   โ””โ”€โ”€ ...                          #   Animation, image, validation, etc.
โ”œโ”€โ”€ assets/                          # Static resources (icons, images)
โ”œโ”€โ”€ docs/                            # Project documentation
โ”‚   โ”œโ”€โ”€ product-requirements.md
โ”‚   โ”œโ”€โ”€ technical-architecture.md
โ”‚   โ”œโ”€โ”€ data-model.md
โ”‚   โ”œโ”€โ”€ mock-data-design.md
โ”‚   โ””โ”€โ”€ manual-test-checklist.md
โ”œโ”€โ”€ tests/                           # Test cases
โ”‚   โ””โ”€โ”€ test-cases.js
โ”œโ”€โ”€ .github/                         # GitHub configuration
โ”‚   โ”œโ”€โ”€ workflows/ci.yml             #   CI pipeline
โ”‚   โ”œโ”€โ”€ ISSUE_TEMPLATE/              #   Issue templates
โ”‚   โ”œโ”€โ”€ PULL_REQUEST_TEMPLATE.md     #   PR template
โ”‚   โ””โ”€โ”€ FUNDING.yml                  #   Sponsorship
โ”œโ”€โ”€ CONTRIBUTING.md                  # Contribution guidelines
โ”œโ”€โ”€ CODE_OF_CONDUCT.md               # Community code of conduct
โ”œโ”€โ”€ SECURITY.md                      # Security policy
โ”œโ”€โ”€ CHANGELOG.md                     # Version history
โ””โ”€โ”€ LICENSE                          # MIT License

Deployment to WeChat Developer Tools

Step 1: Download & Install WeChat DevTools

Platform Download Link Notes
macOS (Intel) Download Drag to Applications
macOS (Apple Silicon) Download Native M1/M2/M3 support
Windows 64-bit Download Run installer
Windows 32-bit Download For older systems

Warning: WeChat DevTools >= 1.06.2301010

Step 2: Clone the Repository

macOS / Linux:

git clone https://github.com/WuSuBuDuoMing/freshkeeper.git
cd freshkeeper
npm install   # if the project has npm dependencies

Windows (PowerShell):

git clone https://github.com/WuSuBuDuoMing/freshkeeper.git
cd freshkeeper
npm install

Step 3: Import Project into WeChat DevTools

  1. Open WeChat Developer Tools
  2. On the welcome screen, click the + (Import Project) button
  3. In the import dialog:
    • Project Directory: Browse to the cloned repository folder
    • AppID: Enter your Mini Program AppID (get it from MP Backend)
      • Or use the Test AppID (ๆต‹่ฏ•ๅท) for quick preview
    • Project Name: Auto-filled from the folder name
  4. Click Import (็กฎๅฎš)

Tip: If you don't have an AppID yet, click "Test Account" (ๆต‹่ฏ•ๅท) to use a sandbox environment.

Step 4: Compile & Preview

  1. After import, the simulator panel opens automatically on the left
  2. The app compiles and renders in the simulator with pre-loaded mock data
  3. Use the simulator toolbar to:
    • Switch phone models (iPhone 14, Pixel 7, etc.)
    • Toggle dark mode
    • Adjust network speed (WiFi, 4G, Offline)
    • Rotate screen orientation

Step 5: Test on Real Device

Method A: Preview (้ข„่งˆ)

  1. Click the Preview (้ข„่งˆ) button in the toolbar
  2. A QR code appears -- scan it with your phone's WeChat
  3. The mini program loads on your real device

Method B: Real-time Debug (็œŸๆœบ่ฐƒ่ฏ•)

  1. Click Real-time Debug (็œŸๆœบ่ฐƒ่ฏ•) in the toolbar
  2. Scan the QR code with your phone
  3. A debug panel opens in DevTools showing console logs, network requests, and storage

Step 6: Upload for Review (ๆไบคๅฎกๆ ธ)

  1. Click Upload (ไธŠไผ ) in the toolbar
  2. Fill in:
    • Version: e.g., 1.0.0
    • Description: What changed in this version
  3. Click Upload
  4. Go to MP Backend -> Management -> Version Management
  5. Click Submit for Review (ๆไบคๅฎกๆ ธ)
  6. Wait for WeChat's review (usually 1-7 days)

Step 7: Release (ๅ‘ๅธƒ)

  1. After review approval, go to Version Management in MP Backend
  2. Click Release (ๅ…จ้‡ๅ‘ๅธƒ)
  3. The mini program is now live for all users!

Alternative: Linux CLI Deployment (miniprogram-ci)

For Linux servers or CI/CD pipelines, use miniprogram-ci:

# Install
npm install -g miniprogram-ci

# Generate CI private key from MP Backend > Development > Upload Key
# Save as ci-private.key

# Preview (QR code for scanning)
miniprogram-ci preview \
  --appid YOUR_APPID \
  --pk-version 1 \
  --pk-branch main \
  --private-key-path ci-private.key \
  --desc "Preview"

# Upload (submit for review)
miniprogram-ci upload \
  --appid YOUR_APPID \
  --pk-version 1 \
  --pk-branch main \
  --private-key-path ci-private.key \
  --desc "Release v1.0.0"

Docker CI/CD

# docker-compose.yml
version: '3'
services:
  miniprogram-ci:
    image: nicepkg/miniprogram-ci:latest
    volumes:
      - .:/app
      - ./ci-private.key:/app/ci-private.key
    command: miniprogram-ci upload --appid YOUR_APPID --pk-version 1 --private-key-path ci-private.key

Troubleshooting

Problem Solution
"AppID does not exist" Verify your AppID in MP Backend, or use test AppID
Simulator shows blank page Check app.json pages array, ensure all files exist
npm packages not working Run npm install then click "Compile" in DevTools
Upload fails with "version exists" Increment the version number in project.config.json
Real device shows different layout Enable "Remote Debug" to check CSS/rendering differences

No backend required. The app works entirely offline with pre-loaded mock data and local storage.

Configuration

AI Recipe Engine

To switch from mock to a real AI API, edit services/ai-recipe-engine.js:

const AI_CONFIG = {
  useRealAPI: true,              // Set to true
  apiEndpoint: 'https://api.openai.com/v1/chat/completions',
  apiKey: 'your-api-key-here',
  model: 'gpt-3.5-turbo',
  maxTokens: 2000,
  temperature: 0.8
}

Photo Recognition

To switch from mock to a real vision API, edit services/food-recognition.js:

const CONFIG = {
  useRealAPI: true,
  apiEndpoint: 'https://your-vision-api.com/analyze',
  apiKey: 'your-api-key-here',
  confidence: 0.6
}

WeChat Subscription Templates

Configure template IDs in services/subscription-service.js by registering templates in the WeChat Official Account backend.

Testing

Run the test suite in WeChat Developer Tools:

  1. Import the project
  2. Open the Console
  3. Run: require('./tests/test-cases')

The test suite covers:

  • Food expiry logic (13 tests)
  • Recipe matching algorithms (12 tests)
  • Shopping list CRUD (18 tests)

Documentation

Document Description
Product Requirements Feature specifications and user stories
Technical Architecture System design and decisions
Data Model Schema, category system, and storage keys
Mock Data Design Mock data generation strategy
Manual Test Checklist Step-by-step manual testing guide

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

Quick Contribution Steps

  1. Fork the repository
  2. Create a feature branch: git checkout -b feat/my-feature
  3. Make your changes
  4. Run tests to verify
  5. Commit: git commit -m 'feat: add my feature'
  6. Push: git push origin feat/my-feature
  7. Open a Pull Request

Please follow Conventional Commits for commit messages.

Security

Please see SECURITY.md for our security policy and vulnerability reporting process.

License

This project is licensed under the MIT License.

Copyright (c) 2026 WuSuBuDuoMing

About

๐ŸงŠ AI-powered fridge food management โ€” expiry alerts, smart recipes, shopping lists, WeChat Mini Program

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages