Skip to content

Instantly share code, notes, and snippets.


Ravi Singh rvibit

View GitHub Profile
rvibit / .env
Created February 4, 2023 13:51
.env file for laravel-shopify React SPA
View .env
rvibit / Billable.php
Created February 4, 2023 13:47
vendor\kyon147\laravel-shopify\src\Http\Middleware\Billable.php for React SPA using laravel-shopify package
View Billable.php
namespace Osiset\ShopifyApp\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redirect;
use Osiset\ShopifyApp\Contracts\Queries\Shop as ShopQuery;
use Osiset\ShopifyApp\Contracts\ShopModel as IShopModel;
use Osiset\ShopifyApp\Objects\Values\ShopDomain;
rvibit / web.php
Last active February 4, 2023 13:38
View web.php
use Illuminate\Support\Facades\Route;
| Web Routes
| Here is where you can register web routes for your application. These
rvibit / welcome.blade.php
Last active February 4, 2023 13:27
laravel-shopify React SPA welcome view
View welcome.blade.php
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Shopify Laravel Example</title>
rvibit / app.js
Last active February 4, 2023 13:33
shopify-laravel-app/resources/js/app.js file for laravel-shopify React SPA
View app.js
import './bootstrap';
import "../css/app.css";
import '../frontend/index.jsx' //import react frontend entry file
rvibit / vite.config.js
Created February 4, 2023 13:03
vite.config.js for laravel-shopify react SPA
View vite.config.js
import { defineConfig, loadEnv } from "vite";
import laravel from "laravel-vite-plugin";
import react from "@vitejs/plugin-react";
import fs from "node:fs";
export default defineConfig(function ({ mode }) {
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) }; //process.env is not accessible directly in this file so we have to do this
return {
plugins: [
laravel(["resources/css/app.css", "resources/js/app.js"]),
rvibit / package.json
Created February 4, 2023 12:40
package.json file for laravel-shopif React SPA
View package.json
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build"
"dependencies": {
"@shopify/app-bridge": "^3.1.0",
"@shopify/app-bridge-react": "^3.1.0",
"@shopify/app-bridge-utils": "^3.1.0",