{"_id":"@benjifs/micropub","_rev":"2-a6243dffc0040796b9a8bcd77b8d5f72","name":"@benjifs/micropub","dist-tags":{"latest":"2.0.1"},"versions":{"2.0.0":{"name":"@benjifs/micropub","version":"2.0.0","keywords":["indieweb","micropub","netlify","serverless"],"author":{"url":"https://benji.dog","name":"Benji Encalada Mora"},"license":"MIT","_id":"@benjifs/micropub@2.0.0","maintainers":[{"name":"benjifs","email":"b@encalada.dev"}],"homepage":"https://github.com/benjifs/micropub","bugs":{"url":"https://github.com/benjifs/micropub/issues"},"dist":{"shasum":"34b1ebcf712068c445f0e5a1d16855e46a1f50ee","tarball":"https://registry.npmjs.org/@benjifs/micropub/-/micropub-2.0.0.tgz","fileCount":24,"integrity":"sha512-UJnQ1O0o+A1VY3WyrkhvIVE2tgIzRovlp+sv0gz27Hnh8Ej1fDt8/EEcebTbZvr9Kp5oudIytjfgT4HIEwflEA==","signatures":[{"sig":"MEQCID9wlHAYoqJWAmKsO8hCoBHGQ1uabcECtBU7kPMSpL7sAiAGM5HmYHOpOSo21/UPwxlOTvYGr//jDC4LdJzlU+w8Fg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":48545},"main":"src/index.js","type":"module","engines":{"npm":">=8.x","node":">=20.x"},"gitHead":"f1ab1efd9111391a5665562e0ed44d5741b54528","scripts":{"lint":"eslint src"},"_npmUser":{"name":"benjifs","email":"b@encalada.dev"},"repository":{"url":"git+https://github.com/benjifs/micropub.git","type":"git"},"_npmVersion":"11.5.2","description":"serverless micropub endpoint","directories":{},"_nodeVersion":"22.18.0","dependencies":{"busboy":"^1.6.0","gray-matter":"^4.0.3","@paulrobertlloyd/mf2tojf2":"^2.4.0"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.33.0","globals":"^16.3.0","@eslint/js":"^9.33.0"},"_npmOperationalInternal":{"tmp":"tmp/micropub_2.0.0_1754892194020_0.4324012163654787","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"name":"@benjifs/micropub","description":"serverless micropub endpoint","version":"2.0.1","main":"src/index.js","scripts":{"lint":"eslint src"},"keywords":["indieweb","micropub","netlify","serverless"],"author":{"name":"Benji Encalada Mora","url":"https://benji.dog"},"homepage":"https://github.com/benjifs/micropub","repository":{"type":"git","url":"git+https://github.com/benjifs/micropub.git"},"bugs":{"url":"https://github.com/benjifs/micropub/issues"},"type":"module","license":"MIT","dependencies":{"@paulrobertlloyd/mf2tojf2":"^2.4.0","busboy":"^1.6.0","gray-matter":"^4.0.3"},"engines":{"node":">=20.x","npm":">=8.x"},"devDependencies":{"@eslint/js":"^9.33.0","eslint":"^9.33.0","globals":"^16.3.0"},"_id":"@benjifs/micropub@2.0.1","gitHead":"b1d54e99d8ddd5a087c99bdc5df07377cae9e8a0","_nodeVersion":"22.18.0","_npmVersion":"11.5.2","dist":{"integrity":"sha512-fhCKc/fwE5vyIhVe77wch5MmdSN5AD04iws52gfHy7SsbAO3+WqNnRwKHhgwNfPIQckCeao8WakQI+onKWsibw==","shasum":"c3d1da93da473b5dafa4ddc33481fbad17d8ff92","tarball":"https://registry.npmjs.org/@benjifs/micropub/-/micropub-2.0.1.tgz","fileCount":25,"unpackedSize":49288,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBWM574Qz3/mIbm+vBvjRl8oujSBCKhrjweke0IcY/oVAiEAlcexMWicwo0FD5xrHonUEVrwbl0lSG2QILI0PN/6j88="}]},"_npmUser":{"name":"benjifs","email":"b@encalada.dev"},"directories":{},"maintainers":[{"name":"benjifs","email":"b@encalada.dev"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/micropub_2.0.1_1755544992740_0.029115609579893675"},"_hasShrinkwrap":false}},"time":{"created":"2025-08-11T06:03:13.917Z","modified":"2025-08-18T19:23:13.119Z","2.0.0":"2025-08-11T06:03:14.199Z","2.0.1":"2025-08-18T19:23:12.952Z"},"bugs":{"url":"https://github.com/benjifs/micropub/issues"},"author":{"name":"Benji Encalada Mora","url":"https://benji.dog"},"license":"MIT","homepage":"https://github.com/benjifs/micropub","keywords":["indieweb","micropub","netlify","serverless"],"repository":{"type":"git","url":"git+https://github.com/benjifs/micropub.git"},"description":"serverless micropub endpoint","maintainers":[{"name":"benjifs","email":"b@encalada.dev"}],"readme":"# micropub\n\nThis project allows you to create a serverless [Micropub](https://indieweb.org/Micropub)\nand [media endpoint](https://www.w3.org/TR/micropub/#media-endpoint) which can add\nfiles to your static sites' repository. After setup, you can use any [Micropub Client](https://indieweb.org/Micropub/Clients)\nto add posts to your site. Tested with [Eleventy](https://www.11ty.dev/) and [Hugo](https://gohugo.io/).\n\nTo run this, checkout the [serverless-micropub](https://github.com/benjifs/serverless-micropub)\nrepository which provides a basic working example to get micropub setup using [Netlify functions](https://docs.netlify.com/build/functions/overview/).\n\n## Install\n\n`npm install @benjifs/micropub`\n\n## Usage\n\n```js\nimport MicropubEndpoint from '@benjifs/micropub'\nimport GitHubStore from '@benjifs/github-store'\n\nconst {\n\tME, TOKEN_ENDPOINT,\n\tGITHUB_TOKEN, GITHUB_USER, GITHUB_REPO,\n} = process.env\n\nexport const micropub = new MicropubEndpoint({\n\tstore: new GitHubStore({\n\t\ttoken: GITHUB_TOKEN,\n\t\tuser: GITHUB_USER,\n\t\trepo: GITHUB_REPO,\n\t}),\n\tme: ME,\n\ttokenEndpoint: TOKEN_ENDPOINT,\n})\n\nexport default async (req) => micropub.micropubHandler(req)\n```\n\n## Configuration\n\nThe following options can be added when initializing this project:\n\n### `me` (Required)\nURL for your site with trailing slash\n\n```js\nme: 'https://example.com/'\n```\n\n### `tokenEndpoint` (Required)\n[Token endpoint](https://indieauth.spec.indieweb.org/#token-endpoint) to verify the access token submitted.\n\n```js\ntokenEndpoint: 'https://auth.example.com/token'\n```\n\n### `contentDir`\nThe main directory where your posts will be added to.\n\n```js\ncontentDir: 'src' // Default value\n```\n\n### `mediaDir`\nThe directory where your media endpoint will add files to.\n\n```js\nmediaDir: 'uploads' // Default value\n```\n\n### `translateProps`\n[11ty](https://11ty.dev) uses different naming for properties (eg. name -> title,\ncategory -> tags). Settings this value to `true` (default) makes sure that these\nproperties are translated between what 11ty and the expected valid microformats.\n\n```js\ntranslateProps: true // Default value\n```\n\n### `formatSlug`\nYou can configure if you want your posts of a specific type to go into a different\ndirectory. For example, you can configure all posts regardless of type to go into\nthe same directory or all posts of type `note` and `reply` to go into a `notes`\ndirectory.\n\n```js\nformatSlug: (type, slug) => `${type}/${slug}` // Default value\n```\n\n### `formatFilename`\nUse if you do not use markdown as your file types.\n\n```js\nformatFilename: (dir, slug) => `${dir}/${slug}.md` // Default value\n```\n\n### `mediaFilename`\nFile name for uploaded files. Can be useful if you want the filenames to share\na common prefix, or to use a date format other than milliseconds.\n\n```js\nmediaFilename: (mediaDir, filename) => `${mediaDir}/${timestamp}_${filename}` // Default value\n```\n\n### `config.media-endpoint`\nURL for your media endpoint. If not configured, Micropub clients will not know the\nendpoint exists.\n\nSee [3.6.1 Discovery](https://micropub.spec.indieweb.org/#discovery).\n\n```js\nconfig: {\n\t...\n\t'media-endpoint': 'https://micropub.example.com/media',\n\t...\n}\n```\n\n### `config.syndicate-to`\nSyndicate target options.\n\nSee [3.7.3 Syndication Targets](https://micropub.spec.indieweb.org/#syndication-targets).\n\n```js\nconfig: {\n\t...\n\t'syndicate-to': [\n\t\t{ uid: 'https://fed.brid.gy/', name: 'w/ Bridgy Fed', checked: true },\n\t],\n\t...\n}\n```\n\n### `config.post-types`\nDefine supported post types for a micropub client to show.\n\nSee [discussion about proposed extension](https://indieweb.org/Micropub-extensions#Query_for_Supported_Vocabulary).\n\n```js\nconfig: {\n\t...\n\t'post-types': [ // Default values\n\t\t\t{ type: 'note', name: 'Note' },\n\t\t\t{ type: 'photo', name: 'Photo' },\n\t\t\t{ type: 'reply', name: 'Reply' },\n\t\t\t{ type: 'bookmark', name: 'Bookmark' },\n\t\t\t{ type: 'like', name: 'Like' },\n\t\t\t{ type: 'article', name: 'Article' },\n\t\t\t{ type: 'rsvp', name: 'RSVP' },\n\t\t\t{ type: 'repost', name: 'Repost' },\n\t\t\t{ type: 'watch', name: 'Watch' },\n\t\t\t{ type: 'read', name: 'Read' },\n\t\t\t{ type: 'listen', name: 'Listen' },\n\t\t\t{ type: 'game', name: 'Game' },\n\t\t],\n\t...\n}\n```\n\n## Post Types\n\nThe current supported post types are:\n* [article](https://indieweb.org/article)\n* [bookmark](https://indieweb.org/bookmark)\n* [like](https://indieweb.org/like)\n* [listen](https://indieweb.org/listen)\n* [note](https://indieweb.org/note)\n* [photo](https://indieweb.org/photo)\n* [play](https://indieweb.org/play)\n* [read](https://indieweb.org/read)\n* [repost](https://indieweb.org/repost)\n* [rsvp](https://indieweb.org/rsvp)\n* [watch](https://indieweb.org/watch)\n* [reply](https://indieweb.org/reply)\n\n> **Note:** If a post does not fit under a specific type, it will default to be\nof type `note`.\n\n## Scopes\n* create - allows the client to create posts on behalf of the user\n* update - allows the client to edit existing posts\n* delete - allows the client to delete posts\n* undelete - allows the client to undelete posts\n* media - allows the client to upload files to the media endpoint\n\n## Troubleshooting\n* `ME` should have a trailing slash\n\n## References\n* [Micropub spec](https://www.w3.org/TR/micropub)\n* [Micropub media endpoint](https://www.w3.org/TR/micropub/#media-endpoint)\n* [Handling a micropub request](https://indieweb.org/Micropub#Handling_a_micropub_request)\n* [Micropub extensions](https://indieweb.org/Micropub-extensions)\n","readmeFilename":"README.md"}