Tactnib.
E-commerce and marketing site for a maker of high-visibility shooting targets, edited by the client in an embedded Sanity Studio and with a Square hosted checkout link flow.
- Year
- 2026
- Built for a client
- My part
- Lead developer
- Website
- tactnib.vercel.app
My role
I led 1 other developer and built most of the app: the UI, the server part and API, the deployment and setup, and the docs and tests. The other developer added a few public pages later.
Capabilities
Storefront
- Home page of eight sections, a products list, product detail pages with a gallery and a rich-text description, and a sizing comparison
- Cart that sells products in packs and rounds quantities to whole packs
- Order confirmation page that clears the cart
Content
- 20+ Sanity document types with a custom desk and one singleton per section, edited in the embedded Studio
- Hard-coded fallback content per section, so a page renders when a document is missing
- Draft mode with Visual Editing overlays for click-to-edit
Payments
Setup
- Vercel deployment with Analytics and Speed Insights
- GitHub Actions workflow that runs lint and typecheck on every push
- Typed environment variables with T3 Env and project docs
Patterns and decisions
- Each home, cart and products section has its own Sanity singleton document and its own GROQ query. A section is a server component. It starts the fetch and hands the promise to a view through Suspense, with a skeleton for each section.
- One fetch function has three cache modes. The default revalidates every 60 seconds. Draft mode reads drafts with a token and no cache.
- The cart lives in the browser. Products are sold in packs, 250 units by default, and quantities are rounded to whole packs.
- Types for the Sanity content are generated by Sanity typegen, so queries and views share them.
- Environment variables are declared once with the T3 Env schema. Server action input is parsed with Zod through next-safe-action.
- The site uses React Compiler.
Cases
One pack price in four places. Square line items take a price per unit and a quantity, but the shop sells packs. A small rounding gap would make the cart total differ from the charge. I wrote one set of helpers for the pack size, the pack count and the quantity rounding. The product page, the cart card, the cart total and the Square payment link all call them. The payment link sends the pack price divided by the pack size as the unit price, and the pack count times the pack size as the quantity, using the same calculation as the cart total.
A site the client edits that still renders when the CMS is empty. The client changes every text and image in Sanity Studio, which is embedded in the site. The page must not break when a document is missing. The schema has more than 20 document types, and a custom desk tree gives each section a singleton. Every section has a hard-coded fallback object, and a helper merges it with whatever Sanity returns. Draft mode with Visual Editing lets the client click a block on the page and edit it in place. I built the schema, the desk structure, the fetch layer and the section views.
Hosted checkout and a verified webhook. The shop needed card payments without handling card data. The cart calls a server action. The action validates the input with Zod, creates a Square Payment Link and redirects the browser to Square's hosted page. Square also collects the shipping address and takes the coupon code there. An idempotency key goes with each attempt. The success page clears the cart. The webhook route reads the raw body, checks Square's HMAC signature and answers 403 on a wrong one. A processing failure returns 500, so Square retries.