Temple of the Moon - Development Log

Chronological log of development work on templeofthemoonbooks.com.


2026-01-31 - Category System & Shipping

Category Pages (PHYSICAL Tags)

Added master product category system for page population:

CategoryEmojiRoute
Candle๐Ÿ•ฏ๏ธ/category/candle
Incense๐ŸŒฟ/category/incense
Oil๐Ÿซ’/category/oil
Herb๐ŸŒฑ/category/herb
Crystal๐Ÿ’Ž/category/crystal
Stone๐Ÿชจ/category/stone
Amulet๐Ÿงฟ/category/amulet
Book๐Ÿ“š/category/book
Tarot๐ŸŽด/category/tarot
Toolโš—๏ธ/category/tool
Jewelry๐Ÿ’/category/jewelry
Statue๐Ÿ—ฟ/category/statue
Clothing๐Ÿ‘˜/category/clothing

Features:

  • /category index page with all categories and counts
  • /category/[slug] dynamic route
  • Sidebar navigation between categories
  • Product cards with correspondence tags

Redirects Added:

  • /candles โ†’ /category/candle
  • /books โ†’ /category/book
  • /amulets โ†’ /category/amulet
  • (And 17 more common variants)

Shipping Estimation

Added weight-based shipping calculator to cart:

Schema Change:

weight Decimal? @db.Decimal(6, 3)  // Weight in lbs

Shipping Options:

MethodCarrierDaysNotes
Local DeliveryTOTM1-3FREE for KC Metro
First ClassUSPS3-5Packages under 13oz
Priority MailUSPS2-3Flat rate options
Ground AdvantageUSPS5-7Economy option

KC Metro Coverage: ~100 ZIP codes covering:

  • KCMO (64xxx)
  • Independence, Blue Springs, Leeโ€™s Summit
  • Overland Park, Olathe, Shawnee, Lenexa (66xxx)

Cart Features:

  • ZIP code input with real-time rate calculation
  • Package weight display
  • Multiple shipping options with radio selection
  • Auto-selects cheapest option

Product Page Updates

  • New AddToCartButton component with quantity selector
  • Weight passed to cart context
  • โ€œBrowse all [Category]โ€ link on product pages
  • PHYSICAL tags separated from magical correspondences

Commits

HashMessage
acefa23Add PHYSICAL category tags and category pages
240959bAdd shipping estimation to cart with weight tracking
6c089aaAdd collapsible filter sections on shop page

2026-01-31 (Later) - Filters & More Products

Collapsible Shop Filters

  • Created FilterSection client component
  • Category filter defaults to open
  • Planet, Element, Intent filters collapsed
  • Chevron animation on toggle

Product Expansion

Scraped and imported additional products:

  • 20 Athames & Swords
  • 20 Statues (deities, gargoyles)
  • Total: 77 products now in DB

Auto-tagged:

  • 61 products tagged
  • 16 skipped (deity names not in correspondences)

2026-01-31 (Morning) - Order System & Admin Dashboard

PayPal Integration โœ…

Full PayPal REST API v2 integration:

Library: src/lib/paypal.ts

  • createPayPalOrder() - initiate checkout
  • capturePayPalOrder() - capture after approval
  • getPayPalOrder() - fetch order details
  • refundPayPalCapture() - process refunds

Env Vars Needed:

PAYPAL_CLIENT_ID=your_client_id
PAYPAL_CLIENT_SECRET=your_client_secret
PAYPAL_MODE=sandbox  # or live
NEXT_PUBLIC_BASE_URL=http://localhost:3000

Internal PO System โœ…

Auto-generated PO numbers for all orders:

Order TypeFormatExample
Customer OrderTOTM-YYYY-NNNNNTOTM-2026-00001
Supplier POAG-YYYY-NNNNNAG-2026-00001

Counter Tables:

  • POCounter - customer order sequence
  • SupplierPOCounter - supplier order sequence

Order Status Flow

PENDING โ†’ PAID โ†’ PROCESSING โ†’ SHIPPED โ†’ DELIVERED
              โ†“
         BACKORDERED (local delivery + AG items)
              โ†“
         PROCESSING (when AG order received)

Fulfillment Logic:

  • In-House items: Ship immediately
  • Azure Green + Shipping: Drop-ship to customer
  • Azure Green + Local Delivery: BACKORDERED until AG shipment arrives

Supplier Order System โœ…

Batch Azure Green orders into daily POs:

Flow:

  1. Customer orders come in (paid)
  2. AG items sit as PENDING fulfillment
  3. Run daily PO generation โ†’ batch into one supplier PO
  4. Supplier PO tracks: DRAFT โ†’ PENDING โ†’ ORDERED โ†’ SHIPPED โ†’ RECEIVED
  5. Customer order items auto-update as supplier PO progresses

API Endpoints:

EndpointMethodPurpose
/api/ordersGETList customer orders
/api/ordersPOSTCreate order + PayPal checkout
/api/orders/[id]GETSingle order details
/api/orders/[id]PATCHUpdate status/tracking
/api/paypal/capturePOSTCapture payment
/api/supplier-ordersGETList supplier POs
/api/supplier-orders/generateGETPreview unfulfilled items
/api/supplier-orders/generatePOSTCreate batch PO
/api/supplier-orders/[id]GETSupplier PO details
/api/supplier-orders/[id]PATCHUpdate supplier PO

CLI Script:

npx ts-node scripts/generate-daily-po.ts          # Create order
npx ts-node scripts/generate-daily-po.ts --dry-run  # Preview

Admin Dashboard โœ…

New admin area at /admin:

PageRouteFeatures
Dashboard/admin/dashboardStats, quick actions
Orders/admin/ordersList, filter by status
Supplier POs/admin/supplier-ordersList, status tracking
Generate PO/admin/supplier-orders/generateBatch AG order creation
Inventory/admin/inventoryProducts, stock levels

Order List Features:

  • Filter by status (PENDING, PAID, BACKORDERED, etc.)
  • Shows source mix (In-House vs Azure Green)
  • Local delivery vs shipping indicator
  • Pagination

Inventory Features:

  • Filter by source (In-House, Azure Green)
  • Filter by stock level (Low, Out)
  • Stock counts for in-house items
  • Correspondence tag preview

Schema Updates

Order Model Additions:

poNumber          String @unique
paymentMethod     PaymentMethod?
paypalOrderId     String?
paypalCaptureId   String?
paypalPayerId     String?
trackingNumber    String?
trackingCarrier   String?
shippedAt         DateTime?
deliveredAt       DateTime?
internalNotes     String?

New Models:

  • OrderStatusHistory - audit trail
  • SupplierOrder - batch POs to Azure Green
  • SupplierOrderItem - line items
  • CustomerOrderItemLink - links customer items to supplier items
  • SupplierOrderHistory - supplier PO audit trail
  • POCounter / SupplierPOCounter - sequence generators

New Enums:

  • PaymentMethod - PAYPAL, STRIPE, CASH, CHECK
  • FulfillmentStatus - PENDING, ALLOCATED, BACKORDERED, SHIPPED, RECEIVED, FULFILLED
  • SupplierOrderStatus - DRAFT โ†’ RECEIVED flow

Product Count

Current: 132 products in database

  • Voodoo: 20
  • Scrying: 16
  • Salts: 20
  • Athames: 20
  • Statues: 20
  • Amulets: ~20
  • Others: ~16

2026-01-31 (Afternoon) - Community Page & Blog System

Community Page โœ…

Rebranded โ€œJournalโ€ to โ€œCommunityโ€ โ€” a blog/content hub for guerrilla marketing.

URL: https://templeofthemoonbooks.com/community

Features:

  • Hero section with search bar
  • Pinned posts displayed prominently at top
  • Regular posts in responsive grid
  • Full-text search across title, content, excerpt
  • Social sharing (X/Twitter, Facebook)
  • Related posts on individual post pages
  • SEO metadata per post

Post Schema

model Post {
  id              String    @id @default(cuid())
  title           String
  slug            String    @unique
  content         String    @db.Text
  excerpt         String?   @db.Text
  featuredImage   String?
  published       Boolean   @default(false)
  pinned          Boolean   @default(false)  // NEW
  publishedAt     DateTime?
  metaTitle       String?   // NEW - SEO
  metaDescription String?   // NEW - SEO
  createdAt       DateTime  @default(now())
  updatedAt       DateTime  @updatedAt
}

Admin Posts Management โœ…

Routes:

RoutePurpose
/admin/postsList all posts with actions
/admin/posts/newCreate new post
/admin/posts/[id]Edit existing post

Actions (one-click):

  • ๐Ÿ“Œ Pin/Unpin post
  • ๐Ÿ‘๏ธ Publish/Unpublish
  • โœ๏ธ Edit
  • ๐Ÿ—‘๏ธ Delete

Post Editor:

  • Title with auto-slug generation
  • Excerpt for previews/SEO
  • Featured image URL
  • HTML content area
  • Pin to top checkbox
  • Collapsible SEO settings (meta title, description)
  • Save Draft / Publish buttons

API Endpoints

EndpointMethods
/api/admin/postsGET (list), POST (create)
/api/admin/posts/[id]GET, PATCH, DELETE

Welcome Post โœ…

Created and pinned inaugural community post:

  • Title: โ€œWelcome to Temple of the Moon Booksโ€
  • Slug: welcome-to-temple-of-the-moon
  • Content: Who we are, what we offer, philosophy, community vision
  • Pinned: Yes
  • Published: Yes
  • Header: โ€œJournalโ€ โ†’ โ€œCommunityโ€ (/community)
  • Footer: Updated link and label
  • Admin sidebar: Added โ€œCommunity Postsโ€ link

Purpose

Community page serves as content marketing engine for first 90 days:

  • Build brand story and trust
  • SEO content for organic traffic
  • Announcements and promotions
  • Educational content (correspondences, rituals, etc.)
  • Customer engagement

Next Steps

  • PayPal credentials configuration (sandbox โ†’ live)
  • Customer checkout UI flow
  • Order confirmation emails
  • Supplier order printable summary (for AG phone orders)
  • Inventory adjustment UI (stock in/out)
  • More product scraping (books especially)
  • Community content calendar (first 90 days)
  • Category hero images
  • Featured product carousel on homepage