npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

strapi-plugin-wechat

v0.1.3

Published

A Strapi plugin for WeChat Mini Program authentication and user management

Readme

Strapi Plugin WeChat

一个用于微信小程序用户认证和管理的 Strapi 插件。

功能特性

  • 微信小程序登录认证
  • 用户信息管理(头像、昵称)
  • 支持扩展字段存储
  • 自动创建和更新微信用户

安装

系统要求

  • Strapi v5.0.0 或更高版本
  • Node.js 18.x 或 20.x
  • NPM 6.0.0 或更高版本
# 使用 npm
npm install strapi-plugin-wechat

# 使用 yarn
yarn add strapi-plugin-wechat

配置

  1. 在项目根目录的 .env 文件中添加以下配置:
WECHAT_MINI_APPID=你的小程序AppID
WECHAT_MINI_SECRET=你的小程序AppSecret
  1. config/plugins.ts 中启用插件:
export default {
  // ...
  'strapi-plugin-wechat': {
    enabled: true,
  },
  // ...
};

API 接口

小程序登录

POST /api/strapi-plugin-wechat/mini/login

请求体:

{
  "code": "微信登录code"
}

响应:

{
  "data": {
    "id": 1,
    "openid": "用户openid",
    "nickname": "用户昵称",
    "avatar": {
      "url": "头像URL"
    },
    "type": "mini-program",
    "extend": {}
  }
}

获取用户信息

GET /api/strapi-plugin-wechat/mini/users/:openid

响应:

{
  "data": {
    "id": 1,
    "openid": "用户openid",
    "nickname": "用户昵称",
    "avatar": {
      "url": "头像URL"
    },
    "type": "mini-program",
    "extend": {}
  }
}

更新用户头像

POST /api/strapi-plugin-wechat/mini/users/:openid/avatar

请求体:

  • Content-Type: multipart/form-data
  • 文件字段名:files

响应:

{
  "data": {
    "id": 1,
    "openid": "用户openid",
    "avatar": {
      "url": "新头像URL"
    }
  }
}

更新用户昵称

PUT /api/strapi-plugin-wechat/mini/users/:openid/nickname

请求体:

{
  "nickname": "新昵称"
}

响应:

{
  "data": {
    "id": 1,
    "openid": "用户openid",
    "nickname": "新昵称"
  }
}

更新扩展信息

POST /api/strapi-plugin-wechat/mini/users/:openid/extend

请求体:

{
  "extend": {
    "key1": "value1",
    "key2": "value2"
  }
}

响应:

{
  "data": {
    "id": 1,
    "openid": "用户openid",
    "extend": {
      "key1": "value1",
      "key2": "value2"
    }
  }
}

数据结构

WeChat User

| 字段 | 类型 | 描述 | | -------- | ------ | -------------------------- | | openid | string | 微信用户唯一标识 | | nickname | string | 用户昵称 | | avatar | media | 用户头像 | | type | enum | 用户类型 (mini-program/h5) | | extend | json | 扩展信息 |

注意事项

  1. 头像上传大小限制为 2MB
  2. extend 字段支持存储任意 JSON 格式数据

License

MIT