Utility scripts for GitStore development and demonstration.
Creates a sample product catalog with categories, collections, and products for demonstration and testing purposes.
./scripts/init-demo-catalog.sh [--data-dir <catalog-path>]Arguments:
--data-dir <catalog-path>(optional): Data directory wherecatalog.gitwill be created
Path Resolution Precedence:
GITSTORE_DATA_DIRenvironment variable--data-dirflag./demo-catalog(default)
Example:
# Create demo catalog in default location
./scripts/init-demo-catalog.sh
# Create demo catalog in custom location
./scripts/init-demo-catalog.sh --data-dir ./my-catalog
# Environment variable takes precedence over CLI argument
GITSTORE_DATA_DIR=./from-env ./scripts/init-demo-catalog.shThe script initializes a git repository at <CATALOG_PATH>/catalog.git with:
Categories (4):
- Electronics (root)
- Computers (child)
- Accessories (child)
- Books (root)
Collections (3):
- Featured Products
- New Arrivals
- Best Sellers
Products (7):
- MacBook Pro 16" M3 Max - $3,499 (in stock)
- ThinkPad X1 Carbon Gen 11 - $1,899 (in stock)
- Apple Magic Mouse - $99 (in stock)
- RGB Mechanical Keyboard - $149.99 (in stock)
- Mastering Go Book - $59.99 (in stock)
- 7-in-1 USB-C Hub - $79.99 (low stock)
- 32" 4K Monitor - $899 (out of stock)
After running the script:
-
Start GitStore services:
# Start all services (git-server must be running before HTTP clone) docker compose up --build -d # Wait for services to be healthy (about 10-15 seconds) docker compose ps
-
Clone the catalog repository via HTTP:
git clone http://localhost:9418/catalog.git catalog-work cd catalog-workImportant:
- Clone from
http://localhost:9418/(git-server endpoint), NOT from filesystem path - Git-server must be running before this step
- This ensures
git pushtriggers websocket notifications
- Clone from
-
Create a release tag:
# Create annotated release tag git tag -a v1.0.0 -m "Initial catalog release"
-
Push the tag (triggers notification):
# Push tag to git-server via HTTP (triggers websocket notification) git push origin v1.0.0 # Check logs to verify notification docker compose logs git-server | grep -i "broadcast" # Should see: "Broadcasted tag notification tag=v1.0.0"
-
Query via GraphQL:
Open http://localhost:4000/playground and run:
query { products { edges { node { id sku title price category { name } collections { name } } } } }
Bare Repository (demo-catalog/catalog.git/):
- Created by
init-demo-catalog.sh - Contains git objects and references (no working files)
- Used by git-server for serving via git protocol
- Do NOT work directly in this directory
Working Copy (catalog-work/):
- Cloned from bare repository
- Contains actual markdown files you can edit
- Used for making changes and creating tags
- Push changes back to bare repository
For quick testing without a working copy:
# Initialize catalog
export GITSTORE_DATA_DIR=$(pwd)/demo-catalog
./scripts/init-demo-catalog.sh
# Tag directly in bare repo (works but not recommended for regular workflow)
cd $GITSTORE_DATA_DIR/catalog.git
git tag -a v1.0.0 HEAD -m "Initial release"
cd ../..
# Start services
docker compose up --buildNote: This works for initial testing but is not the recommended workflow for making catalog changes.
The catalog follows GitStore's markdown + YAML frontmatter format:
---
id: prod_example_001
sku: EXAMPLE-SKU-001
title: Example Product
price: 99.99
currency: USD
category_id: cat_example_001
collection_ids:
- coll_featured_001
inventory_status: in_stock
inventory_quantity: 50
---
# Product Description
Markdown content here...- Quick Start: Get started with GitStore quickly
- Development: Test features with realistic data
- Demos: Showcase GitStore capabilities
- Testing: Validate catalog loading and GraphQL queries
- Documentation: Understand data structure through examples
Edit the script to:
- Add more products, categories, or collections
- Modify pricing and inventory
- Change metadata fields
- Adjust product descriptions
- Create different catalog structures
- The script is idempotent - running it multiple times on an existing catalog will not duplicate data
- Generated catalogs include category hierarchy, collection associations, and various inventory statuses
- All timestamps use ISO 8601 format
- Product images use placeholder URLs (update to real CDN URLs in production)