https://github.com/rexxars/picosanity
Tiny Sanity client alternative should you only need to do queries
https://github.com/rexxars/picosanity
client headless sanity
Last synced: about 2 months ago
JSON representation
Tiny Sanity client alternative should you only need to do queries
- Host: GitHub
- URL: https://github.com/rexxars/picosanity
- Owner: rexxars
- License: mit
- Created: 2018-06-18T07:21:44.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2025-04-30T18:05:48.000Z (2 months ago)
- Last Synced: 2025-05-04T22:44:11.464Z (about 2 months ago)
- Topics: client, headless, sanity
- Language: JavaScript
- Homepage:
- Size: 1.24 MB
- Stars: 74
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# picosanity
[](http://browsenpm.org/package/picosanity)[](https://bundlephobia.com/result?p=picosanity)
Tiny Sanity client alternative, if you only need to do queries and only need to support modern browsers.
## Targets
- Node.js >= 20
- Modern browsers (Edge >= 14, Chrome, Safari, Firefox etc)## Installation
```bash
npm install --save picosanity
```## Usage
```js
import {createClient} from 'picosanity'const client = createClient({
projectId: 'myProjectId',
dataset: 'myDataset',
apiVersion: '2025-04-25', // use a UTC date string
useCdn: true,
})client
.fetch('*[_type == $someType]', {someType: 'article'})
.then((articles) => console.log(articles))
.catch((err) => console.error('Oh noes: %s', err.message))
```## UMD bundle
You can load this module as a UMD-bundle from unpkg - https://unpkg.com/picosanity
If used in a global browser context, it will be available as `window.PicoSanity.createClient()`## License
MIT © [Espen Hovlandsdal](https://espen.codes/)