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

https://github.com/jimmymckegger/b2bheadless


https://github.com/jimmymckegger/b2bheadless

customer-api fastapi headless shopify

Last synced: 5 months ago
JSON representation

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
```