What This Guide Builds
This series explains how I built The Conspiracy Shirt Company as a custom, database-driven print-on-demand storefront.
The finished system uses:
- PHP to generate the storefront
- MySQL to store products, variants, descriptions, and collections
- HTML and CSS for the presentation layer
- JavaScript for product interactions and cart behavior
- Shopify for checkout and payment processing
- Printify for production and fulfillment
- APIs to synchronize products, prices, variants, and images
- Custom administration tools to reduce repetitive work
- LiteSpeed and image optimization for performance
Build the storefront once, keep the products in a database, use Shopify only where Shopify is valuable, use Printify only where Printify is valuable, and automate as much repetitive work as possible.
Contents
- Why I built the site
- T-shirts as small stories
- Why the storefront uses two main PHP pages
- Complete architecture
- How a page request works
- How a product moves through the system
- The full technology stack
- Why the database is the center of the site
- Why Shopify handles checkout
- Why Printify handles fulfillment
- Why automation became essential
- Tools and platforms I used
- Tools I built for the store
- Project folder structure
- Complete six-part build series
- Advantages and tradeoffs
- Who this architecture is for
- Frequently asked questions
Why I Built the Site
The Conspiracy Shirt Company started as something for my mind to do while I was dealing with cancer treatments.
I wanted a project that gave me something creative and technical to think about. I wanted to make T-shirts, but I did not want to make another collection of generic graphics.
I wanted every design to feel like part of a larger story.
Bigfoot did not need to spend the rest of his life walking through the same forest. He could ride a mountain bike, work in a small-town barbershop, get chased by a UFO, or be beamed directly into one.
I also liked taking ridiculous conspiracy theories and making them even dumber.
The moon landing was fake?
That was not stupid enough.
What if the moon itself was fake?
T-Shirts as Small Stories
The shirt is the final product, but the idea usually begins as a scene.
Instead of starting with:
I need a Bigfoot shirt.
I could start with:
- What would Bigfoot do if he lived in a small American town?
- What job would a classic monster have?
- What happens when a giant cat becomes a city-level emergency?
- What conspiracy becomes funnier when taken completely literally?
- What would a classified government memo say about something absurd?
That approach led to collections instead of isolated products. Collections could have their own visual style, characters, jokes, product descriptions, landing pages, and advertising.
The website therefore needed to support more than shirts. It needed to support collections, stories, images, related products, custom fields, and constantly changing ideas.
Why the Storefront Uses Two Main PHP Pages
I wanted to build many shirts and collections, but I was also dealing with treatment and limited energy.
I did not want to create and maintain a separate PHP file for every shirt.
I am also lazy.
That is an important part of the architecture.
I built the customer-facing store around two main PHP pages:
- index.php displays the catalog, collection filters, product cards, sorting, and pagination.
- shirt.php displays an individual product based on an item number passed in the URL.
Instead of creating a new page, I add a new database record.
Instead of creating a separate PHP file for every shirt, I add one product record to the database.
index.php
shirt.php
shirt.php?item=1001
shirt.php?item=1002 shirt.php?item=1003
The same
shirt.php
file displays every shirt. It reads the item number from the URL, loads the matching database record, finds its variants and images, and builds the complete product page automatically.
Adding a product should mean adding data, not adding another
webpage.
Complete Store Architecture
Visitor → Custom PHP Storefront → MySQL, Shopify, and Printify
Products
Collections
Variants
Prices
Images
Reviews
SEO content
Cart
Checkout
Payment
Customer order
Product
Print provider
Production
Packaging
Shipping
How a Storefront Page Request Works
When a visitor opens a product page, the site does not request all product information from Shopify or Printify in real time.
The storefront data is already stored in the local MySQL database. PHP can therefore build the page without waiting for an external platform to respond.
Visitor Opens a Product
/shirt.php?item=1001
The item number in the URL tells the site which product the visitor wants to view.
PHP Checks the Request
PHP validates the item number before using it in a prepared database query.
MySQL Loads the Product
The database returns the product record, available variants, colors, sizes, prices, descriptions, and collection information.
PHP Finds the Product Images
The site selects the correct front, back, color, and fallback images from the local product folders.
PHP Builds the Complete Page
PHP renders the product content, metadata, canonical URL, Open Graph tags, breadcrumbs, and structured data.
JavaScript Handles the Variants
JavaScript updates the selected color, size, image, availability, price, and Shopify variant ID.
Shopify Is Contacted at Checkout
The Storefront API is used only when the visitor creates a cart or proceeds to checkout.
Ordinary page views use fast local data. The storefront does not depend on Shopify or Printify responding every time someone views a shirt.
How a New Product Moves Through the System
The product workflow began as a series of manual steps. As the catalog grew, those steps were gradually connected through admin tools, local scripts, and APIs.
Create the Idea and Artwork
The process begins with the shirt concept, illustration, collection theme, and story behind the design.
Prepare the Production Files
Artwork is resized, converted, checked for transparency, and prepared for the required print areas.
Create or Update the Printify Product
The design is assigned to a blank, print provider, colors, sizes, print areas, and production variants.
Publish the Product to Shopify
Shopify receives the product and creates the variant IDs needed for the custom cart and checkout.
Import Product and Variant Data
The API tools connect the Printify product, Shopify variants, colors, sizes, prices, and availability to the local MySQL record.
Add the Storefront Details
The product receives its descriptions, collection, images, SEO fields, metadata, and related content.
The Two PHP Pages Do the Rest
The catalog page displays the new product, and the existing product template automatically builds its complete product page.
Create the design once, enter or synchronize the data once, and avoid repeatedly opening Printify, Shopify, phpMyAdmin, an image editor, and several separate scripts.
The Full Technology Stack
| Layer | Technology | Purpose |
|---|---|---|
| Frontend | HTML | Page structure and semantic content |
| Frontend | CSS | Responsive layout, product cards, navigation, and branding |
| Frontend | JavaScript | Variant selection, image switching, cart behavior, and interface controls |
| Backend | PHP | Database queries, page generation, APIs, sessions, and administration |
| Database | MySQL | Products, variants, reviews, collections, pricing, and content |
| Database access | PDO | Prepared queries and secure database access |
| Checkout | Shopify Storefront API | Cart creation and secure customer checkout |
| Fulfillment | Printify API | Products, variants, providers, pricing, images, and fulfillment data |
| Hosting | Apache and LiteSpeed | Serving PHP pages, caching, redirects, and performance |
| Administration | Custom PHP tools | Product management, bulk updates, image handling, and synchronization |
| Automation | PHP and Python scripts | Image processing, imports, exports, updates, and repetitive workflows |
Why the Database Is the Center of the Store
Shopify and Printify both contain product data, but neither platform contains every field I need for the custom storefront.
The local MySQL database acts as the store's central content layer. It connects the creative product information to the operational IDs used by Shopify and Printify.
MySQL Product Database
Stores everything the custom PHP storefront needs to build product and collection pages.
Product Content
- Item number
- Product title
- Short description
- Long description
- Category
- Collection or line
Variants and Pricing
- Retail price
- Colors
- Sizes
- Availability
- Shopify variant IDs
- Printify variant IDs
SEO and Images
- SEO title
- Meta description
- Open Graph content
- Product images
- Canonical information
Store Activity
- Likes
- Buy-click counts
- Customer reviews
- Active status
- Sorting information
Platform Connections
- Printify product ID
- Shopify product ID
- Shopify variant mapping
- Printify variant mapping
Shopify and Printify remain the operational services behind the store, while the local database controls the storefront content, organization, presentation, and platform connections.
Why Shopify Handles Checkout
Building custom product pages is one problem. Building and maintaining a secure payment system is a completely different problem.
The custom PHP site controls the shopping experience until the customer is ready to check out. Shopify then takes over the parts it is designed to handle.
Before Checkout
- Displays the product
- Loads colors and sizes
- Checks variant availability
- Updates the product image
- Selects the Shopify variant ID
Checkout and Order
- Secure checkout
- Payment processing
- Customer information
- Discount codes
- Applicable tax logic
- Shipping selection
- Order creation and status
cartCreate
It sends Shopify the selected merchandise ID and quantity. Shopify creates the cart, returns a checkout URL, and securely handles the customer's payment and order information.
Why Printify Handles Production and Fulfillment
The store sells physical products without owning blank shirts, printing equipment, packing materials, or a warehouse.
Printify connects each product to the print provider that manufactures and ships the order.
Blank Product
The shirt model, available colors, sizes, and printable areas are selected.
Print Provider
A provider is selected based on products, print areas, pricing, location, and production options.
Production Files
The artwork is connected to the correct front, back, sleeve, or neck-label print area.
Printing
After an order is received, the provider produces the selected product and variant.
Packaging
The finished product is inspected, packaged, and prepared for carrier pickup.
Shipping
The provider hands the package to the carrier and returns tracking information.
The selected color and size must connect the local storefront variant to the correct Shopify merchandise ID and the corresponding Printify production variant.
Why Automation Became Essential
The first version of a workflow is often manual. That is manageable for one product but quickly becomes a problem across a growing catalog.
Manual Product Setup
- Create the product in Printify
- Publish the product to Shopify
- Add the product to MySQL
- Copy platform and variant IDs
- Write descriptions and SEO data
- Assign the collection
- Download and organize images
- Check availability and prices
Tools and API Automation
- Product import tools
- Variant synchronization
- Bulk price updates
- Image download and organization
- Description editors
- Collection management
- Review administration
- Image resizing and compression
- Description and alt-text generation
I built a tool whenever I caught myself doing the same tedious task repeatedly.
Doing the work manually once helped define the process. Automating it meant I could spend more time creating designs and stories instead of copying the same data between Printify, Shopify, MySQL, and local image folders.
Tools and Platforms I Used
The site was not built with one all-in-one platform. I used a mix of programming languages, hosting tools, ecommerce services, image editors, APIs, and small scripts that each solved a specific part of the workflow.
Frontend and Backend
These technologies build the pages, load product data, manage interactions, and connect the storefront to outside services.
Server and Database Tools
These tools handle hosting, file management, databases, PHP execution, caching, redirects, and day-to-day server maintenance.
Checkout and Store Operations
Shopify provides the customer checkout and order system while the custom PHP site controls the storefront experience.
Print-on-Demand Platform
Printify connects the designs to blank products, print providers, production files, variants, packaging, and shipping.
Image Creation and Editing
I use GIMP and Pixlr to create, clean up, resize, composite, and prepare artwork and product images before they enter the store workflow.
Custom Store Tools
These are the tools I built to reduce repetitive work and keep product data synchronized between the storefront, Shopify, Printify, and the database.
Marketing and Product Feeds
Product information can also be prepared and sent to outside discovery platforms without making those platforms the source of the storefront data.
I did not choose every tool before building the site. I added technologies, platforms, and scripts as new problems appeared. When a task became repetitive, slow, or annoying, I either found a tool for it or built one.
Tools I Built for the Store
Most of these tools began with the same thought: I am doing this too often, and I do not want to keep doing it by hand.
Some became public tools that anyone can use. Others remain private administration tools connected directly to the store and its database.
Image Resizer
Different print areas, marketplaces, product pages, and social platforms require different dimensions. This creates correctly sized copies without repeatedly opening an image editor.
Open the Image ResizerImage Compressor
Production artwork needs to remain large, but storefront images need to load quickly. This creates smaller web copies while leaving the production master untouched.
Open the Image CompressorImage Format Converter
Print files, product pages, social images, and modern browsers do not always need the same format. This converts images between PNG, JPG, WebP, and AVIF.
Open the Format ConverterBackground Remover
Product artwork often needs a transparent background before it can be printed on different garment colors. This removes the background without requiring a full desktop editing workflow.
Open the Background RemoverImage Cropper
Mockups, thumbnails, social images, and product photography often need a cleaner composition or exact aspect ratio before publishing.
Open the Image CropperAI Product Description Generator
Writing product descriptions and image alt text for every new design became another repetitive task. This analyzes an uploaded image and creates a useful starting point.
Open the Description GeneratorURL Slug Generator
Product, collection, and guide titles can be converted into clean, consistent, URL-friendly text without manually removing punctuation and replacing spaces.
Open the Slug GeneratorMeta Tag Generator
This creates the title, description, canonical, Open Graph, and related metadata needed to give products and pages a consistent search and sharing presentation.
Open the Meta Tag GeneratorSocial Preview Tool
This previews how a page title, description, and Open Graph image may appear when a product or guide is shared on social platforms.
Open the Social Preview ToolWatermark Tool
Product images and previews can be marked before they are shared, published, or sent for review while keeping the original file clean.
Open the Watermark ToolPrivate Administration Tools
The public tools solve individual image and content problems. The private tools manage the actual store, database, products, platforms, and repetitive operational work.
The two-page storefront reduced the number of pages I had to maintain. The database reduced duplicated product data. The APIs reduced platform updates. These tools reduced the small repetitive jobs left between them.
Public Tools Built from the Store Workflow
How the Project Is Organized
The storefront is divided by responsibility. Public pages handle the customer experience, API endpoints handle browser requests, admin pages manage the catalog, and sensitive credentials remain outside the public web directory.
/public_html/
Files inside this directory can be served by the web server. Public PHP pages, styles, scripts, tools, and images live here.
Public Pages
The primary customer-facing PHP pages.
-
index.phpCatalog, collections, sorting, and product cards -
shirt.phpDynamic product page used by every shirt -
about.phpCompany story and brand information -
sitemap.phpHuman-readable site navigation
/includes/
Shared page components prevent the same markup from being repeated across the site.
-
tcsc-head.phpMetadata, canonical tags, and Open Graph content -
tcsc-header.phpSite navigation and collection links -
tcsc-footer.phpShared footer content -
product-card.phpReusable catalog product-card template
/css/
Styles are separated by the part of the storefront they control.
-
site.cssGlobal typography, layout, navigation, and utilities -
catalog.cssProduct grid, cards, filters, and pagination -
product.cssProduct gallery, variants, descriptions, and reviews
/js/
JavaScript handles interactions after PHP has rendered the page.
-
catalog.jsFiltering, sorting, pagination, and catalog behavior -
product.jsColor, size, image, and variant selection -
cart.jsCart requests and Shopify checkout behavior
/api/
Small server-side endpoints receive JavaScript requests and return structured responses.
-
create-cart.phpCreates a Shopify cart and returns its checkout URL -
like-shirt.phpRecords product likes -
submit-review.phpValidates and stores customer reviews
/tools/
Public image and content tools created from the store workflow.
resizer.phpResize imagescompressor.phpReduce image file sizeconverter.phpConvert image formatsbg-remover.phpRemove image backgroundscrop.phpCrop images and aspect ratiosalt-text.phpGenerate descriptions and alt textslug-gen.phpCreate URL-friendly slugsmeta-gen.phpGenerate page metadatasocial-preview.phpPreview social sharing cardswatermark.phpAdd watermarks to images
/admin/
Authenticated pages used to manage products and automate store operations.
-
index.phpAdministration dashboard -
products.phpProduct list and management controls -
edit-product.phpDescriptions, collections, SEO, and product data -
bulk-pricing.phpBulk retail price and margin updates -
sync-printify.phpPrintify product and variant synchronization
/images/
Product images are stored locally so normal page views do not depend on Printify or Shopify image requests.
-
/products/Product mockups, artwork, front images, and back images
/private/
Sensitive configuration and service integrations are stored
outside /public_html/ so they cannot be requested
directly through a browser.
connection.php
PDO database connection
config.php
Environment and application settings
printify.php
Printify API authentication and request helpers
shopify.php
Shopify Storefront API configuration
logging.php
Private application and API error logging
Database passwords, Shopify tokens, Printify tokens, private API helpers, and detailed error logs should not be placed in a publicly accessible directory or committed to a public repository.
Complete Six-Part Build Series
This pillar guide explains the complete system. The chapters below break the implementation into focused technical guides.
Advantages and Tradeoffs
A custom storefront gives me control that a standard ecommerce theme does not, but that control comes with maintenance and responsibility.
Advantages
Tradeoffs
This was not designed as a perfect enterprise ecommerce platform.
It was designed to solve my specific problem with the least repetitive work possible. The extra technical responsibility was worthwhile because it gave me a system built around how I create, organize, and sell the shirts.
Who This Architecture Is For
This approach makes the most sense when control and custom behavior are more important than launching as quickly as possible.
This Approach May Work for You
Use a Hosted Store Instead
A standard Shopify theme or another hosted ecommerce builder is probably the better choice when:
- You want to launch a normal store as quickly as possible.
- You do not want to write or maintain backend code.
- Your catalog works well with standard product and collection templates.
- You do not need unusual database fields or custom workflows.
- You would rather pay for apps than build integrations.
- You do not want responsibility for server security, backups, API maintenance, and debugging.
Custom code is valuable when it solves a real limitation. It should not be added only because building everything yourself sounds more impressive.
Building a Custom Print-on-Demand Store FAQ
These are the most common questions about separating the storefront, checkout, fulfillment, and local product database.
Can I build a print-on-demand website without using a Shopify theme?
Yes. A custom PHP website can display products and manage the customer-facing storefront while Shopify handles the cart and checkout through the Storefront API.
Why use Shopify only for checkout?
Using Shopify only for checkout provides control over the storefront design and local product database while retaining Shopify payments, checkout security, taxes, order handling, and ecommerce infrastructure.
What does Printify do in this architecture?
Printify provides product manufacturing and fulfillment. Product and variant data can be synchronized through the Printify API while Shopify receives and processes the customer order.
Why use a local MySQL database?
A local database allows the store to control product titles, descriptions, collections, images, prices, SEO fields, likes, reviews, and other custom data without requesting it from an external API on every page load.
Why did you build the store around two PHP pages?
One page generates the catalog and collection views, while another generates every individual product page. Product information comes from the database, so adding a shirt does not require creating another webpage.
Do I need to be an advanced programmer to follow this guide?
Basic familiarity with HTML, CSS, PHP, MySQL, and JavaScript is useful. The series explains the architecture and individual components, but readers should still understand server configuration and secure coding basics.
Can this architecture support hundreds of products?
Yes. The database-driven structure can support a large catalog when queries, indexes, image handling, pagination, caching, and synchronization processes are designed carefully.
Can I use WooCommerce instead of Shopify?
Yes, but the checkout integration, product synchronization, authentication, and order flow would need to be rewritten for WooCommerce.
Can I use another print-on-demand provider?
Yes. The same general architecture can work with another provider if it offers suitable products, fulfillment services, and API access.
Why not request Printify and Shopify data on every page load?
External API requests are slower, can fail, consume rate limits, and make the storefront dependent on another service being available. The local database acts as a fast storefront cache and content-management layer.
What custom tools are included in the project?
The project includes image resizing, compression, format conversion, product-description generation, alt-text generation, URL slug creation, product administration, bulk pricing, and API synchronization tools.
Is this a complete ecommerce platform?
The custom site handles product presentation, catalog data, content, and storefront features. Shopify handles the secure checkout and payment system, while Printify handles production and fulfillment.
Continue to Part 1
Start by building the database, folder structure, PDO connection, product records, collections, variants, and two-page PHP architecture.