> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Organization URL Routing — Integration

> Feature ID: PF-74 Status: \U0001F4CB Specification -organization-url-routing.md Last Updated: 2026-03-24

**Feature ID:** PF-74
**Status:** 📋 Specification
**Spec:** [PF-74-organization-url-routing.md](../../../specs/pf/specs/PF-74-organization-url-routing.md)
**Last Updated:** 2026-03-24

***

## Overview

PF-74 adds path-based organization routing (`/o/:orgSlug/*`), slug-to-org resolution via `useOrgBySlug`, `OrgSlugRoute` layout, and the `orgPath(slug, path)` utility for deep links. It consumes `pf_organizations.slug` (PF-01/PF-50) and integrates with `OrganizationContext` (PF-01). No new database tables or RLS changes.

### PF-95 coordination: tenant subdomain canonical redirects

When [PF-95](../../../specs/pf/specs/PF-95-tenant-white-labeling-theming.md) ships, PF-74 **implements** the **Canonical redirect matrix** (rules R1–R5) so that eligible orgs (subdomain set, `subdomain_verified`, `prefer_subdomain_redirect`) are moved from the **primary app host** to the **tenant subdomain host** while preserving `/o/:slug/...` paths and query strings. Eligibility and full rules are normative in the PF-95 spec and [PF-95 Integration](./tenant-white-labeling-theming-integration.md). Implementation layer (middleware, edge config, or client-first redirect) is a PF-74 implementation choice; default status code **308** unless product standardizes otherwise.

***

## Integration Points (from Spec)

| Point                                    | Type                           | Document / Spec                                                                                          |
| ---------------------------------------- | ------------------------------ | -------------------------------------------------------------------------------------------------------- |
| PF-01 (Organizations)                    | Direct PF dependency           | `pf_organizations.slug`, `OrganizationContext.setCurrentOrganization`                                    |
| PF-50 (Tenant Provisioning)              | Data dependency                | Slug produced/validated by PF-50; PF-74 consumes; `orgPath` in `src/platform/organizations/slug.ts`      |
| PF-10 (Notifications)                    | Downstream consumer (optional) | Deep links may use `orgPath(slug, path)` from `@/platform/organizations`                                 |
| PF-81 (Multi-Tenant Host & URL Strategy) | Strategy overview              | [PF-81 Integration](./multi-tenant-host-url-strategy-integration.md) — path routing is primary mechanism |
| React Router DOM                         | Library                        | `useParams`, `useNavigate`, `<Route>`, `<Outlet>` — layout route at `/o/:orgSlug`                        |
| Vercel (SPA)                             | Hosting                        | No changes; existing catch-all rewrite handles path-based routing                                        |
| Canonical URL policy                     | Platform doc                   | Slug URLs are canonical; no redirect to flat path. Host canonicalization in PF-77.                       |

***

## Platform Layer / Event / API Contracts

* **Platform layer:** `@/platform/organizations` exports `useOrgBySlug`, `useCurrentOrgSlug`, `useOrgPath`, `orgPath`, and `OrgSlugRoute`. Downstream (PF-10, PF-50) may call `orgPath(slug, path)` for link generation.
* **Event contracts:** None.
* **API contracts:** None (frontend-only routing and hooks).

***

## Related Docs

* [CROSS\_CORE\_INTEGRATIONS.md](./CROSS_CORE_INTEGRATIONS.md)
* [PF-81 Integration](./multi-tenant-host-url-strategy-integration.md) — multi-tenant host & URL strategy
* [PF-77 Integration](./tenant-domain-management-integration.md) — custom domains; works alongside path routing
* [PF-74 Spec](../../../specs/pf/specs/PF-74-organization-url-routing.md)
