Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/baroshem/nuxt-medusa

🛍️ Medusa module for Nuxt
https://github.com/baroshem/nuxt-medusa

ecommerce javascript medusa nuxt typescript vue

Last synced: 20 days ago
JSON representation

🛍️ Medusa module for Nuxt

Awesome Lists containing this project

README

        

# Nuxt Medusa

[![nuxt-medusa](./docs/public/cover.jpeg)](https://nuxt-medusa.vercel.app)

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![License][license-src]][license-href]

[Medusa](https://medusajs.com) module for Nuxt.

- [▶️  Play online](https://stackblitz.com/github/baroshem/nuxt-medusa?file=.stackblitz%2Fnuxt.config.ts)
- [📖  Documentation](https://nuxt-medusa.vercel.app)
- [🎥  Intro video](https://www.youtube.com/watch?v=EuakPz8M7CM)
- [✨  Release Notes](https://github.com/baroshem/nuxt-medusa/releases)

## Features

- Nuxt 3 ready
- Wrapper around `@medusajs/medusa-js`
- Handy composables like `useMedusaClient`
- Usage in API server routes with `serverMedusaClient`
- TypeScript support

## Quick Setup

1. Add `nuxt-medusa` dependency to your project

```bash
npx nuxi@latest module add medusa
```

2. Create .env file with following `MEDUSA_URL` variable:

```bash
MEDUSA_URL= # By default http://localhost:9000
```

And that's it! You can now fetch data from Medusa in Nuxt ✨

```vue

const client = useMedusaClient();
const { products } = await client.products.list();

```

If you are encountering problems with `CORS` from Medusa, make sure that `process.env.STORE_CORS` in `medusa-config.js` file is pointing to your local Nuxt project. By default, Medusa has CORS set for `http://localhost:8000` while Nuxt is running by default on `http://localhost:3000`

## Development

```bash
# Install dependencies
yarn

# Generate type stubs
yarn dev:prepare

# Develop with the playground
yarn dev

# Build the playground
yarn dev:build

# Run ESLint
yarn lint

# Run Vitest
yarn test
yarn test:watch

# Release new version
yarn release
```

[npm-version-src]: https://img.shields.io/npm/v/nuxt-medusa/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
[npm-version-href]: https://npmjs.com/package/nuxt-medusa

[npm-downloads-src]: https://img.shields.io/npm/dm/nuxt-medusa.svg?style=flat&colorA=18181B&colorB=28CF8D
[npm-downloads-href]: https://npmjs.com/package/nuxt-medusa

[license-src]: https://img.shields.io/npm/l/nuxt-medusa.svg?style=flat&colorA=18181B&colorB=28CF8D
[license-href]: https://npmjs.com/package/nuxt-medusa