Giter Site home page Giter Site logo

muflhi01 / saleor-app-template Goto Github PK

View Code? Open in Web Editor NEW

This project forked from saleor/saleor-app-template

0.0 0.0 0.0 846 KB

Your boilerplate for new Saleor Apps. Batteries included.

Home Page: saleor-app-template.vercel.app

License: Other

Shell 0.21% JavaScript 7.00% TypeScript 91.30% CSS 1.49%

saleor-app-template's Introduction

Saleor App Template

Bare-bones boilerplate for writing Saleor Apps with Next.js.

What's Saleor App in a nutshell

Saleor App is the fastest way of extending Saleor with custom logic using asynchronous and synchronous webhooks (and vast Saleor's API). In most cases, creating an App consists of two tasks:

  • Writing webhook's code realizing your custom logic
  • Developing configuration UI that can be exposed to Saleor Dashboard via specialized view (designated in App's manifest).

What's included?

  • ๐Ÿš€ Communication between Saleor instance and Saleor App
  • โš™๏ธ Encapsulated Metadata and Private Metadata handling logic
  • ๐Ÿ“ฑ Configuration UI
  • โšก Example of Webhook handling
  • ๐Ÿงญ Example of using App Extension
  • ๐Ÿ“– Manifest with webhooks using custom query

Why Next.js

You can use any preferred technology to create Saleor Apps, but Next.js is among the most efficient for two reasons. The first is the simplicity of maintaining your API endpoints/webhooks and your apps' configuration React front-end in a single, well-organized project. The second reason is the ease and quality of local development and deployment.

Learn more about Apps

Apps guide

Configuring apps in dashboard

How to use this project

Saleor CLI for the win ๐Ÿš€

Saleor CLI is designed to save you from the repetitive chores around Saleor development, including creating Apps. It will take the burden of spawning new apps locally, connecting them with Saleor environments, and establishing a tunnel for local development in seconds.

Full Saleor CLI reference

If you don't have (free developer) Saleor Cloud account create one with the following command:

saleor register

Now you're ready to create your first App:

saleor app create [your-app-name]

In this step, Saleor CLI will:

  • clone this repository to the specified folder
  • install dependencies
  • ask you whether you'd like to install the app in the selected Saleor environment
  • create .env file
  • start the app in development mode

Having your app ready, the final thing you want to establish is a tunnel with your Saleor environment. Go to your app's directory first and run:

saleor app tunnel

Your local application should be available now to the outside world (Saleor instance) for accepting all the events via webhooks.

A quick note: the next time you come back to your project, it is enough to launch your app in a standard way (and then launch your tunnel as described earlier):

pnpm dev

Local development without CLI

Add URL of your Saleor instance to the .env file:

NEXT_PUBLIC_SALEOR_HOST_URL=https://your-saleor-instance.com

Install dependencies pnpm install

Start local server pnpm run dev

Follow the guide how install your app and use tunneling tools like localtunnel or ngrok in order to expose your local server.

If you use saleor-dashboard and your local server is exposed, you can install your app by following this link:

[YOUR_SALEOR_DASHBOARD_URL]/apps/install?manifestUrl=[YOUR_APPS_MANIFEST_URL]

Generated schema and typings

Commands build and dev would generate schema and typed functions using Saleor's GraphQL endpoint. Commit generated folder to your repo as they are necessary for queries and keeping track of the schema changes.

Learn more about GraphQL code generation.

saleor-app-template's People

Contributors

zaiste avatar magul avatar timuric avatar cloud11pl avatar 2can avatar mirekm avatar witoszekdev avatar krzysztofwolski avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.