Skip to content

feat(app): show store profile and Devkind credit on the home page - #5

Merged
rome2o merged 1 commit into
mainfrom
ft4/embedded-app-store-profile
Jul 24, 2026
Merged

rome2o merged 1 commit into
mainfrom
ft4/embedded-app-store-profile

Conversation

@Uzair-Ahmed-Dahraj

Copy link
Copy Markdown
Collaborator

What

Replaces the placeholder home page ("Example protected API call" + server time) with a meaningful embedded-app landing page for the starter, and makes GET /api/example return the authenticated shop's profile.

Why

The starter's first-run screen should demonstrate the protected-route pattern doing something real, not echo an internal shopId and a timestamp. This gives new users a proper reference for reading shop data end to end (session token to requireShop to a projected query to a Polaris UI).

Changes

  • GET /api/example returns the shop's profile (name, domain, plan, owner, contact, locale, install date) via a deliberately projected select, so internal columns never leak into the response.
  • install.ts now populates the plan column from Shopify's shop.json (plan_display_name). The column existed in the schema but was never written by any code path, so the profile always reported the plan as unset.
  • web/Pages/Home.tsx renders a store identity card (avatar, name, myshopify domain, install-status badge) with a details list, plus a separate "Built by Devkind" card linking to devkind.com.au and the source. Loading spinner and error Banner preserved.
  • Integration test widened to seed a full profile row and assert the new response shape.
  • eslint: taught jsx-a11y/anchor-is-valid that Polaris <Link> carries its href in the url prop (this is the first Link usage in web/).

Note on the query living in the route handler

The Drizzle query sits inline in the handler by design, not as a shortcut. Every data-access site in this starter follows the same idiom (createDb(...) then a projected .select().from().where().get()): the shopAuth middleware, and the install / uninstall lifecycle hooks. There is no repository or service layer anywhere in the codebase. Introducing one for this single endpoint would make it the only route that reads data differently, trading an established, consistent convention for a speculative abstraction. Keeping it inline keeps the read path uniform and easy to follow; the projection already handles the one real concern (not exposing internal columns).

Verification

  • tsc --noEmit clean
  • vitest run - 20/20 pass
  • eslint web clean
  • vite build clean
  • Verified live in a real Shopify Admin via a local tunnel (store profile renders, cards padded correctly).

Testing note

plan populates on install. Shops installed before this change carry plan = null until their next reinstall (which re-runs the install hook and the shop.json fetch).

Replace the placeholder "example protected API call + server time" with a
meaningful embedded-app landing page.

- GET /api/example returns the authenticated shop's profile (name, domain,
  plan, owner, contact, locale, install date) via a projected query, instead
  of echoing shopId and server time. The query stays inline in the handler to
  match the data-access idiom used everywhere else in this starter (shopAuth,
  install, uninstall); adding a repository layer for one route would be the
  only such abstraction in the codebase.
- Populate the shop `plan` column from Shopify's shop.json (plan_display_name)
  during the install hook. The column existed but was never written, so the
  profile always reported the plan as unset.
- Home renders a store identity card (avatar, name, myshopify domain, install
  status badge) with a details list, plus a separate "Built by Devkind" card
  linking to devkind.com.au and the source repo.
- Widen the integration-test DB stand-in to seed a full profile row and assert
  the new response shape.
- Teach eslint that Polaris <Link> carries its href in the `url` prop
  (jsx-a11y/anchor-is-valid specialLink) - the first Link use in web/.
Comment thread src/routes/example.ts

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The query is inlined in the route handler by design, segregating it out of route file would create inconsistency with the established pattern.

Comment thread web/Pages/Home.tsx

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UI decisions are grounded in Polaris guidelines, not guesswork: card padding via sectioned, and the divider was dropped per Polaris' own "avoid divider lines outside data tables, use weight and spacing for hierarchy".

@Uzair-Ahmed-Dahraj Uzair-Ahmed-Dahraj left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed.

  • Inline query is intentional: matches shopAuth/install/uninstall. No repo layer = no inconsistency.
  • Projection hides internal columns.
  • plan was never written (always "Not set"); now populated from shop.json on install.
  • Card padding + no divider per Polaris guidelines.

@rome2o
rome2o merged commit 874c016 into main Jul 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants