This guide will explain how to spin up a bazaar instance.
Step 0: Requirements Check
Make sure you have accounts for the following services:
Stripe (payment processing)
Cloudflare (inventory storage)
Github (deployment)
AT Protocol (identity)
Fly.io (hosting)
A domain (for the store itself, referred to as
APP_URL)
Step 1: Fork bazaar
Fork bazaar from https://github.com/incognitothief/bazaar , then clone it locally
git clone <https://github.com/>{you}/bazaar.git && cd bazaar
npm installStep 2: Create a Storefront Key
Run the key creation script
make storefront-key DOMAIN=<APP_URL>This writes a key file under keys/ and prints four secrets:
STOREFRONT_DID
STOREFRONT_KID
STOREFRONT_PRIVATE_KEY
STOREFRONT_PUBLIC_MULTIBASE
Store these in a secure location. You will use these to configure your deployment.
Step 3: Set up your infrastructure
Cloudflare R2
This will be your inventory storage. In the cloudflare dashboard:
- 1.
Subscribe to R2 if you haven't.
- 2.
Create a bucked named
bazaar-prodor something else. Note down the name as yourR2_BUCKET_NAME. - 3.
Under R2 → Manage R2 API Tokens, create an S3 API token with Object Read &
Write on that bucket. (This is not the same thing as an account-level Cloudflare API token; account tokens will not work.) - 4.
Note your Account ID from the dashboard sidebar.
After performing these steps, you should have the following environment variables noted down:
CF_ACCOUNT_IDR2_ACCESS_KEY_IDR2_SECRET_ACCESS_KEYR2_BUCKET_NAME
Fly App and Volume
Decide a name for your compute instance → FLY_APP_NAME
Using the fly cli
fly apps create <FLY_APP_NAME>
fly volumes create bazaar_data --region ams --size 1 -a <FLY_APP_NAME>While you are here, you should also procure a FLY_API_TOKEN
fly auth tokenDomain Certificate
Using Fly cli
fly certs create <APP_URL> -a <FLY_APP_NAME>This will print the DNS records to create. Add them to the registrar where your domain is kept.
Step 4: Configure your environment
The following environment variables must be set in order for bazaar to deploy correctly.
In Github, under Settings → Secrets and variables → Actions:
FLY_API_TOKEN- API token from your fly accountFLY_APP_NAME- Name of the app you createdVITE_MERCHANT_DID- Your DID
In fly.io, using fly cli
fly secrets set -a <FLY_APP_NAME> \
MERCHANT_DID=did:plc:… \
STOREFRONT_DID=did:web:store.example.com \
STOREFRONT_KID=storefront-key-… \
STOREFRONT_PRIVATE_KEY="$(cat keys/…)" \
STOREFRONT_PUBLIC_MULTIBASE=z… \
APP_URL=https://store.example.com \
CF_ACCOUNT_ID=… \
R2_ACCESS_KEY_ID=… \
R2_SECRET_ACCESS_KEY=… \
R2_BUCKET_NAME=bazaar-prod Step 5: Deploy
Enable Actions on your repo
Open the Actions tab and click "I understand my workflows, go ahead and enable them."
Kick off the deploy action
Actions → Deploy → Run workflow → branch main → Run workflow
Verify the deploy
Visit the address you configured as your
APP_URLVerify that your storefront DID document was constructed properly
https://APP_URL/.well-known/did.json
Step 6: Configure your storefront
Sign in to your store
Once you are signed in, visit the merchant dashboard
Go to 'Settings'
Configure your Merchant Profile, Business information, and Stripe Secrets