Skip to content

[Feature] Add configurable app URL path support for shopify.web.toml #5933

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

amcaplan
Copy link
Contributor

@amcaplan amcaplan commented Jun 3, 2025

WHY are these changes introduced?

Fixes #1181

This addresses the feature request to allow developers to configure custom app entry points in their shopify.web.toml configuration file. Currently, Shopify apps must use the root URL as their entry point, which limits flexibility for complex APIs where the Shopify app functionality is nested under a specific path (e.g., /api/shopify).

WHAT is this pull request doing?

This PR implements support for the app_url_path configuration parameter in shopify.web.toml files:

  • Schema Extension: Added app_url_path as an optional string parameter to the web configuration schema with automatic path validation (ensures paths start with /)
  • URL Generation: Updated generateApplicationURLs function to accept and use the configured app URL path when generating application URLs
  • Dev Integration: Integrated the new configuration into the dev service workflow so that shopify app dev respects the custom app URL path
  • Comprehensive Testing: Added tests to verify the functionality works correctly with and without the configuration

Example Usage:

# shopify.web.toml
roles = ["backend"]
app_url_path = "/api/shopify"
auth_callback_path = ["/api/shopify/install/callback", "/api/shopify/auth/callback"]

[commands]
dev = "npm run dev"

This generates URLs like https://myapp.com/api/shopify instead of https://myapp.com.

How to test your changes?

  1. Create a new Shopify app or use an existing one
  2. In the web directory, modify shopify.web.toml to include:
    app_url_path = "/custom/path"
  3. Run shopify app dev
  4. Verify that the application URL shown includes the custom path
  5. Check that the app functionality works correctly at the custom URL path

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

🤖 Generated with Claude Code

@amcaplan amcaplan requested a review from a team as a code owner June 3, 2025 10:30

This comment has been minimized.

@amcaplan amcaplan requested a review from a team as a code owner June 3, 2025 10:33
Copy link
Contributor

github-actions bot commented Jun 3, 2025

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
78.06% (+0.06% 🔼)
12540/16064
🟡 Branches
72.31% (+0.13% 🔼)
6086/8417
🟡 Functions
78.18% (-0.02% 🔻)
3286/4203
🟡 Lines
78.5% (+0.06% 🔼)
11867/15117
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🔴
... / dev.ts
18.38% (-0.27% 🔻)
13.7%
23.81% (-1.19% 🔻)
19.05% (-0.15% 🔻)
🔴
... / app-management-client.ts
46.06% (-0.15% 🔻)
41.43%
43.27% (-0.42% 🔻)
44.9% (-0.15% 🔻)

Test suite run success

2893 tests passing in 1257 suites.

Report generated by 🧪jest coverage report action from 4af4d08

amcaplan and others added 3 commits June 5, 2025 12:54
This implements the feature requested in GitHub issue #1181, allowing
developers to configure custom app entry points via the app_url_path
parameter in their shopify.web.toml configuration file.

Changes:
- Add app_url_path to web configuration schema with path validation
- Update generateApplicationURLs to use configured app URL path
- Integrate app_url_path into dev service URL generation
- Add comprehensive tests for the new functionality

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Refactor the generateApplicationURLs function to use an options object
instead of multiple positional parameters, making it more maintainable
and easier to extend. Update all call sites and tests accordingly.

- Change function signature to accept single options object
- Update dev service to use new API
- Fix all test cases to use new parameter structure
- Maintain backward compatibility for existing functionality

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@amcaplan amcaplan force-pushed the make-app-url-path-configurable branch from c4129de to 4af4d08 Compare June 5, 2025 09:55
@nickwesselman
Copy link
Contributor

/snapit

Copy link
Contributor

github-actions bot commented Jun 5, 2025

🫰✨ Thanks @nickwesselman! Your snapshot has been published to npm.

Test the snapshot by installing your package globally:

pnpm i -g @shopify/cli@0.0.0-snapshot-20250605123019

Tip

If you get an ETARGET error, install it with NPM and the flag --@shopify:registry=https://registry.npmjs.org

Caution

After installing, validate the version by running just shopify in your terminal.
If the versions don't match, you might have multiple global instances installed.
Use which shopify to find out which one you are running and uninstall it.

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.

[Feature]: configure App Url path from config
2 participants