Skip to content

Conversation

merrcury
Copy link
Member

This pull request introduces support for region-aware API and WebSocket endpoints throughout the dashboard application, including the addition of a region selector to the authentication and navigation flows. It refactors several components to use a new apiHostnameManager utility for dynamic hostname resolution, ensures telemetry captures region metadata during organization creation, and updates the deployment workflow to support a new staging-apse1 environment. Minor code style improvements (such as consistent use of double quotes) are also included.

Region-aware API and WebSocket endpoints:

  • Refactored multiple components (api.client.ts, inbox-preview-content.tsx, inbox-button.tsx, configuration-group.tsx, simple-prompt-getter.ts) to use apiHostnameManager for dynamic selection of API and WebSocket hostnames, enabling region switching and improved reliability during region changes. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]

Region selector integration:

  • Added a RegionSelector component to the organization creation flow (create-organization.tsx), header navigation (header-navigation.tsx), and telemetry tracking, allowing users to select their region during onboarding and navigation. [1] [2] [3] [4] [5] [6]

Deployment workflow enhancements:

  • Updated .github/workflows/deploy.yml to add support for the staging-apse1 environment, including input options and environment matrix logic, and standardized YAML quoting for improved consistency. [1] [2] [3] [4] [5] [6] [7]

Miscellaneous improvements:

  • Updated Dockerfile entrypoint for the API service to use the SECRET_NAME environment variable for improved flexibility.
  • Synced subproject reference in .source file.

These changes collectively improve the dashboard's support for multi-region deployments and user experience around region selection and API reliability.

…ket hostnames

- Introduced a new `RegionProvider` to manage region selection and API hostname updates.
- Added `RegionSelector` component for users to select their region.
- Integrated `apiHostnameManager` to handle API and WebSocket hostnames based on selected region.
- Updated various components and pages to utilize the new region context and hostname management.
- Implemented region detection from organization metadata for improved user experience.
- Added URL-based region detection to replace localStorage approach for improved reliability.
- Introduced new constants for dashboard URLs specific to regions.
- Updated `RegionProvider` to utilize URL detection for initial region selection and organization switching.
- Enhanced `findOrganizationForRegion` and `getDashboardUrlForRegion` functions to support new detection logic.
- Improved logging for better debugging and user feedback during region changes.
- Updated region handling to redirect users to the correct dashboard URL if the URL region does not match the organization's region.
- Improved logging for clarity on region mismatches and redirection actions.
- Simplified the logic for updating the selected region state when the URL and organization match.
…on creation flow

- Eliminated unnecessary console logs in `create-organization.tsx` and `region-context.tsx` for cleaner code and improved performance.
- Updated organization creation flow to focus on telemetry tracking without logging sensitive information.
- Enhanced region handling logic to ensure consistent URL redirection during organization creation and selection.
- Improved debug logging in `RegionProvider` to provide better insights during region switching and organization creation.
- Updated logic to prevent redirection during organization creation when selecting existing organizations, ensuring a smoother user experience.
- Clarified comments and streamlined the handling of region mismatches for better maintainability.
- Removed fallback logic for `API_HOSTNAME_SG` and `WEBSOCKET_HOSTNAME_SG`, directly assigning values from environment variables.
- Streamlined configuration for better clarity and maintainability.
- Removed fallback logic for `DASHBOARD_URL_SG`, directly assigning the value from environment variables for improved clarity and maintainability.
- Introduced a new `region-config.ts` file to manage multi-region setup, allowing dynamic loading of region-specific configurations from environment variables.
- Updated `RegionSelector` to dynamically generate region options based on the configured regions.
- Refactored region-related utility functions to utilize the new configuration system, enhancing maintainability and flexibility.
- Improved region detection logic to support multiple regions and fallback mechanisms.
- Updated region parsing to dynamically determine the base region from the VITE_REGIONS environment variable.
- Simplified the assignment of environment variables for dashboard URLs, API hostnames, and region flags based on whether the region is the base region or not.
- Improved comments for clarity on the configuration logic and fallback mechanisms for non-base regions.
- Enhanced logging to provide better insights when essential configuration is missing.
@merrcury merrcury requested a review from scopsy September 30, 2025 10:39
@netlify
Copy link

netlify bot commented Sep 30, 2025

Deploy Preview for dashboard-v2-novu-staging canceled.

Name Link
🔨 Latest commit 9c320ef
🔍 Latest deploy log https://app.netlify.com/projects/dashboard-v2-novu-staging/deploys/68e68de0cc1846000816c558

@github-actions
Copy link
Contributor

github-actions bot commented Sep 30, 2025

Hey there and thank you for opening this pull request! 👋

We require pull request titles to follow specific formatting rules and it looks like your proposed title needs to be adjusted.

Your PR title is: feat(dashboard): enabling multi region setup from single dashboard and clerk

Requirements:

  1. Follow the Conventional Commits specification
  2. As a team member, include Linear ticket ID at the end: fixes TICKET-ID or include it in your branch name

Expected format: feat(scope): Add fancy new feature fixes NOV-123

Details:

PR title must end with 'fixes TICKET-ID' (e.g., 'fixes NOV-123') or include ticket ID in branch name

- Introduced environment variables for multi-region support, allowing configuration for both US and Singapore regions.
- Added detailed comments to guide users on how to extend the configuration for additional regions.
- Defined base and additional region-specific URLs, API hostnames, and AWS regions for improved deployment flexibility.
- Eliminated comments regarding the localStorage-based region initialization in `region-context.tsx` and `region-utils.ts`, as the logic has been updated to rely solely on URL-based detection for improved reliability and clarity.
- Removed outdated comments in `region-config.ts`, `region-context.tsx`, and `region-utils.ts` to enhance clarity and maintainability.
- Simplified comments related to environment variable usage and region mapping for better understanding of the configuration logic.
- Improved overall readability of the region handling code by eliminating unnecessary explanations.
- Updated the API client to wait for region switching to complete before making API calls, enhancing reliability during transitions.
- Removed outdated comments in the organization creation flow to streamline the code and focus on telemetry tracking.
- Refined region switching logic in the RegionProvider to ensure accurate state management during region changes.
…ontext

- Eliminated the region switching checks from the API client, streamlining API call handling.
- Removed redundant region switching state management from the RegionProvider to enhance clarity and maintainability.
- Cleaned up the HostnameManager by removing the region switching state, simplifying the overall logic.
@merrcury merrcury requested a review from scopsy September 30, 2025 17:46
- Renamed identification flags for clarity and separated user and organization identification states.
- Enhanced user identification logic to ensure proper tracking with LaunchDarkly.
- Streamlined organization identification process, ensuring accurate monitoring and telemetry tracking.
- Cleaned up unused variables and improved overall readability of the IdentityProvider component.
@merrcury merrcury deployed to prod-apse1 October 8, 2025 16:52 — with GitHub Actions Active
@merrcury merrcury enabled auto-merge (squash) October 8, 2025 17:30
@merrcury merrcury merged commit 2d5aa4f into next Oct 8, 2025
59 of 65 checks passed
@merrcury merrcury deleted the feat/singleClerk branch October 8, 2025 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants