Feature Removal
When a feature flag is permanently OFF for a tenant, the code behind it is still shipped — it just never renders. For a slimmed tenant build (e.g. a standalone frontend export) you can physically delete that code. This page maps, per flag, what is actually deletable versus what must stay because it is shared.
Deletable surface is very uneven across flags. “Big flag” does not mean “big
deletion”: route-gated features (estimate, blog) delete cleanly, while
data-layer features (locations, map) look huge but their
config/API/service spine is shared app-wide.
How flags gate code
Each App Router page checks the flag and 404s when it is off:
// app/<route>/page.tsx
if (!features.locations) return <Page40XTemplate />The route still exists and the whole imported subtree stays in the bundle — so deletable = everything exclusively reachable from that feature. Anything imported by another feature is shared and must stay.
Utilities are mostly kept. Helpers in src/utils/ genuinely stitch
features together (URL building, formatters, filters, listing visibility).
Treat a util as deletable only when it is provably feature-exclusive.
Removal ROI at a glance
| Tier | Flags (approx. exclusive files) |
|---|---|
| Best — isolated | estimate ~400 · buildings ~125 · blog ~61 · dashboard ~35 |
| Solid | aiQuality ~20 · messaging ~18 · saveSearch ~17 · aiChat ~15 · aiImageSearch(+aiSearch) ~15 · liveBy ~15 |
| Small & clean | favorites ~11 · imageFavorites ~10 · aiAgent ~10 · profile ~9 · recentlyViewed/openHouse/aiSpaces ~4 · aiSearch ~3 · cookieConsent ~1 |
| Deceptive | locations (57 pages, data layer shared) · map (~500 files but core) · blurRestrictedProperty (0 files) |
Route-gated features
These own a self-contained App Router route + page-component tree — the cleanest deletions.
estimate — home valuation / AVM · ~400 files
app/(Estimates)/**— all routes (estimate, embedded, agent/client estimate, admin/agents)components/pages/estimate/**— exceptStatistics/components/WidgetsPanel/**andStatistics/hooks/useWidgetData.tscomponents/pages/agent/**— realtor estimates UI (no own flag; lives under (Estimates))providers/EstimateProvider/**,EstimateStepsProvider.tsx,AgentEstimatesProvider.tsx,AgentClientsProvider/**,AgentsProvider/**services/API/APIEstimate.ts,APIAgent.ts,types/estimate.ts,types/agent.tscomponents/shared/Widgets/EstimateWidget/**,Widgets/EstimateDateDetails/**,shared/Estimate/**,shared/Dialogs/EstimateRemoveDialog/**,shared/CmsWidgets/widgets/EstimateWidget.tsxconfigs/*/estimate/**, i18nEstimates
Shared with dashboard: keep
estimate/Statistics/components/WidgetsPanel/**,
Statistics/hooks/useWidgetData.ts, components/shared/Stats/**,
services/API/APIWidgets.ts. The dashboard imports the WidgetsPanel directly.
buildings — buildings/condos directory (WordPress ACF) · ~125 files
app/building/**,app/buildings/**,app/condo/**,app/condos/**components/pages/building/**,buildings/**,condos/**providers/BuildingProvider/**(ACF/Yoast parsers)services/API/APIBuildings.ts+types/buildings.tsconfigs/urbn/redirects-buildings*.tsscripts/generate-building-redirects.ts,fetch-condo-buildings.ts,fetch-wp-categories.ts,find-unmatched-buildings.ts,dump-repliers-buildings.tsapp/api/condo-development/route.ts, i18nBuilding/Buildings- Verify then delete
utils/buildings/**(buildingMatcher, mergeBuildings, assembleBuilding, buildSpecs…) — confirm no listing/search import first
Keep shared: services/CMS/.../WordPressClient/customPosts.ts (blog uses it — just drop
'buildings' from tenant blog.ts customPostTypes); services/Map/BuildingPopupExtension.tsx
shared/BuildingCard(locations map overlay).
Product decision — MLS condos: condoResolver + utils/dataMapper/resolvers/condo/**
power condo listing detail pages (propertyClass='condo' from MLS), which are not
gated by buildings. Deleting them breaks condo listings. Decide whether buildings off
means only the CMS directory, or also condo sections in MLS listings.
blog — CMS editorial · ~61 files
app/blog/**,app/author/**,app/authors/**,app/api/blog/**components/pages/blog/**(full tree incl._urbnforks)configs/*/blog.ts
Keep shared: services/CMS/** (WordPress / Ghost / Markdown clients —
also serve buildings + static pages) and components/shared/CmsWidgets/**.
Header/menu need surgical removal of the $blog/$cmsMenu entries (edit, not
delete).
dashboard — market insights · ~35 files (cleanest, zero cross-impact)
app/dashboard/**components/pages/dashboard/**(incl._hhanna/_urbnforks)- i18n
Menu.dashboard;content.tsdashboardpagesMeta;routes.tsdashboard route
Keep shared: templates/DashboardPageTemplate.tsx +
templates/components/DashboardHeader/** (used by favorites / saved-searches
/ recently-viewed / image-favorites), the estimate WidgetsPanel +
@shared/Stats + APIWidgets (dashboard is the consumer), and
services/LocationsTree/**.
locations — neighbourhoods directory · ~57 files (pages delete, data layer stays)
app/locations/**(route,[[...slugs]], debug, sitemap, error, types)components/pages/locations/**(full page tree: LocationHeader, LocationFilters, SeoDescription, Popular*/Nearby*, forks)services/LocationsTree/pipeline/**+LocationsTree/filters.tsapp/api/generateLocations/route.ts,public/<tenant>/locations.json
Deeply shared — keep: providers/LocationProvider.tsx (condos),
services/LocationsTree/ core (condos + dashboard/condo sitemaps),
services/API/APILocations.ts + locationsToGeoJson.ts
(search/map/autosuggest/LiveBy/listing), configs/*/location.ts (URL
rewrites, dashboard, estimate, home), utils/urls.ts,
Map/hooks/useLocationSelection*, Map/MapTitle/**.
Account & personalization
Route pattern app/(ClientPages)/<route>/page.tsx + components/pages/<page>/**. The trap:
the provider/hook is usually mounted app-wide and driven by a button on listing cards or
the map, so it survives the page — unless that button is itself flag-gated.
recentlyViewed— ~4 files. route +components/pages/recently-viewed/**. No provider/API → fully deletable.profile— ~9 files. route +components/pages/profile/**(incl. Unsubscribe, FeedbackForm). No provider/API → fully deletable.favorites— ~11 files. route +components/pages/favorites/**+FavoriteRemoveDialog.tsx+FavoritesMenuItem.tsx+services/API/APIFavorites.ts. KeepFavoritesProvider+useFavorites(listing-card favorite button).imageFavorites— ~10 files. route +components/pages/image-favorites/**+ImageFavoriteRemoveDialog.tsx+AiSearchDialog/components/ImageFavorites{Browser,Item,List}.tsx+ImageFavoritesMenuItem.tsx+services/API/APIImageFavorites.ts. KeepImageFavoritesProvider+useImageFavorites(photo StarButton).saveSearch— ~17 files. route +components/pages/saved-searches/**+MapFilters/components/SaveSearchButton.tsx+useSaveSearchButton.tsx(+_movesmartlyfork) +SaveSearchDialog/**+SaveSearchRemoveDialog.tsx+SaveSearchMenuItem.tsx. Keepservices/API/APISavedSearch.ts+SaveSearchProvider/utils.ts(used bysearch/[layout]for?searchId=hydration).
AI features
Not route-gated. Shared core stays if any relevant flag is on: providers/AiSearchProvider.tsx,
services/API/APIChat.ts, shared/Dialogs/AiSearchDialog/**.
aiAgent— ~10 files.components/pages/search/components/SupportAgent/**(EVAS iframe + postMessage). Independent.aiChat— ~15 files.search/.../MapRoot/components/ChatContent/**(desktop NLP panel). Independent render.aiQuality— ~20 files.GalleryDialog/components/{GalleryTabs,GalleryGroupsView,InspectionGroup}+AdvancedFiltersDialog/components/AiQualityFiltersTab/**+ quality sort modes +getQualityTag. Independent.aiSearch— ~3 files.MapFilters/components/AiSearchButton/**. Dialog shared withaiImageSearch.aiImageSearch— ~15 files.shared/Dialogs/AiSearchDialog/**(+shared/Photos/AiSubmitButton.tsx). Deletes only ifaiSearchis also off (composite gate).aiSpaces— ~4 files.MapFilters/components/AiSpacesSelect/**. Feature browser lives in the shared AiSearchDialog.
Maps & overlays
liveBy — demographics + overlays · ~15 exclusive (+~30 overlay engine, tenant-dependent)
Delete (liveBy-exclusive): providers/LiveByDemographicsProvider.tsx, pages/listing/.../LiveByDemographics/**,
shared/Map/OverlayMarkerPopup/LiveBy*Card.tsx, configs/defaults/overlays/liveBy.ts,
ListingBrowserDialog/hooks/useListingDemographics.ts, i18n liveByDemographics.
The overlay engine (shared/Map/hooks/useOverlayLayers/**,
useOverlayMarkers/{renderMarkers,cluster}, OverlayMarkerPopup/**, OverlayLayersController,
OverlayToggleButton, app/api/{schools,social-housing,parcel,mapbox/pois}/**) is deletable
only if the target tenant defines zero overlays. In defaults, LiveBy and the
publicRecord-gated parcels are the only overlay sources, so with both flags off it all goes
dead; movesmartly/urbn keep it (schools/parcels/transit). Keep
shared/Map/markerElement.ts, MapOptionsProvider, tenant configs/<t>/map.ts, services/MoveSmartly/**.
publicRecord — assessor parcels · ~12 files
Delete (publicRecord-exclusive): configs/defaults/overlays/parcels.ts, app/api/public-record/**,
shared/Map/hooks/useParcelListings/**, shared/Map/OverlayMarkerPopup/ParcelCard.tsx,
providers/ParcelProvider.tsx, pages/listing/.../{ListingParcelLayer,ParcelFacts}.tsx,
configs/defaults/parcel-facts.ts, utils/map/parcelLayers.ts and the FenceIcon toggle in MapControls.
The flag exists because the Repliers /locations source=PublicRecord is an account entitlement —
an account without it gets a 400 on the source itself, so the layer must not even be offered.
map — interactive search (CORE) · ~500 files, but not cleanly isolatable
Delete (interaction layer): app/search/**, app/listing/**, components/pages/search/** (~139),
components/pages/listing/** (~215), components/shared/Map/** (~68), services/Map/**,
providers/SearchProvider/**, MapOptionsProvider/**, ListingProvider.tsx/ListingDetailsProvider.tsx/ListingEnrichmentProvider.tsx.
Blockers — keep (foundational, reused by
favorites/dashboard/locations/estimate/widgets/carousels):
components/shared/Listing/** (ListingCard/DrawerListingCard),
@configs/filters (~45 consumers), services/API/APISearch.ts +
APIListingDetails.ts, and MapOptionsProvider (embedded maps in
listing/locations). Map is the interaction layer;
listings/filters/cards/APIs are the data layer, baked throughout. Verify
each SearchProvider/MapOptionsProvider wrap in non-map pages before
removing.
Contact & UI
messaging— ~18 files.shared/Dialogs/ContactUsDialog/**,pages/listing/components/ListingContactForm/**(all tenant forks),ProfileDialog/components/NotificationsBar.tsx(+fork), andAPIContactmethodsaddComment/requestInfo/homeTourRequest. Keepshared/Forms/ContactForm/**(CMS/buildings) andAPIContact.meetingRequest/subscribeNewsletter.openHouse— 4 files:AdvancedFiltersDialog/components/{OpenHouseFilter,OpenHouseSwitch}.tsx,ListingMainContent/components/OpenHouseSection.tsx(+_movesmartlyfork). Plus edits (useAdvancedFilters, useListingTags) + i18n.cookieConsent— 1 file:shared/Dialogs/CookieDialog.tsx(+ remove one line in DialogWindows + its export).blurRestrictedProperty— 0 files. Pure conditional logic inListingProvider/ListingCard/MapRoot+utils/listings/visibility.tshelpers — flag flip + edits only.
Hidden gate: messaging also gates OTP auth — AuthForm does if (!features.messaging) return <ThirdPartyLoginForm /> , so the whole OTP login/signup machinery becomes dead code (deletable; keep
ThirdPartyLoginForm).
Rules of thumb
- Route-gated features (
estimate,blog,dashboard,buildings) delete cleanest — the page tree is self-contained. - Provider-backed features (
favorites,saveSearch, AI) delete the page but keep the app-wide provider unless its trigger (card/map button) is also flag-gated. - Data-layer features (
locations,map) look huge but the config/API/service spine is shared — only the pages/interaction delete. - Cross-tenant / CMS infra (WordPress client,
ContactForm, the overlay engine) is shared — verify per-tenant before a global deletion. - Watch the hidden gates:
messaging→ OTP auth ·buildings→ MLS condo listings ·estimate↔dashboardStatistics. - After any removal, run
pnpm --filter portal-frontend type-checkfor the tenant — a standalone tenant export is the first time a tenant’s real code paths are fully type-checked.