https://github.com/jimmymckegger/b2bheadless
https://github.com/jimmymckegger/b2bheadless
customer-api fastapi headless shopify
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/jimmymckegger/b2bheadless
- Owner: JimmyMcKegger
- Created: 2024-09-11T11:35:02.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-07T08:26:40.000Z (over 1 year ago)
- Last Synced: 2025-03-29T04:42:19.656Z (about 1 year ago)
- Topics: customer-api, fastapi, headless, shopify
- Language: Python
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Headless B2B site using Shopify Customer Accounts
This project is still a work in progress. It is intenedd to become a B2B site built with FastAPI application that integrates with Shopify's Customer Accounts API using a confidential client. Follow the instructions below to clone the repository, install dependencies, and run the application.
## Prerequisites
Before you begin, ensure you have the following installed:
- [Python 3.12](https://www.python.org/downloads/)
- [Poetry](https://python-poetry.org/docs/#installation)
- [Ngrok](https://ngrok.com/download)
- Shopify Plus store with a Headless sales channel setup to use a Confdential customer accounts client
## Getting Started
### 1. Clone the Repository
First, clone the repository to your local machine:
```bash
git clone https://github.com/JimmyMckegger/b2bHeadless.git
cd customerAccounts
```
### 2. Install Dependencies
```
poetry install
```
### 3. Start Ngrok
```bash
ngrok http 8000
```
### 4. Set Environment Variables
Replace th values in the `.env.example` file and rename the file to `.env`
```env
SHOP_ID=123123123
CLIENT_ID=shp_asdf234asdf123sadf123
CLIENT_SECRET=3c50fsadfkljhsadfkljhasdfkjhd
DOMAIN=your-ngrok-domain.ngrok-free.app
```
### 5. Run the Application
```bash
poetry shell && uvicorn main:app --reload
```
### 6. Optionally add an executable script in your PATH to startup the app:
Example script:
```
#!/bin/zsh
new tmux session and detach
SESSION="customer_accounts_api"
tmux new-session -d -s $SESSION
# Split the window into two panes vertically
tmux split-window -v
# Select pane 0, navigate to the project directory, and start ngrok
tmux select-pane -t 0
tmux send-keys -t $SESSION "cd ~/path/to/project/b2bHeadless" C-m
tmux send-keys -t $SESSION "ngrok http 8000 --domain=your-domain.ngrok-free.app" C-m
# Select pane 1, navigate to the project directory, and start uvicorn
tmux select-pane -t 1
tmux send-keys -t $SESSION "cd ~/path/to/project/b2bHeadless" C-m
tmux send-keys -t $SESSION "poetry run uvicorn main:app --reload" C-m
# Attach to the tmux session
tmux attach-session -t $SESSION
```