Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

refactor(auth): guards, auth decorators and ephemeral tokens move into an auth-core kernel

Mauricecc79f561e55e
diff --git a/server/scripts/import-boundaries-baseline.json b/server/scripts/import-boundaries-baseline.json
index 7b0e0bcd1..bee833248 100644
--- a/server/scripts/import-boundaries-baseline.json
+++ b/server/scripts/import-boundaries-baseline.json
@@ -2,12 +2,10 @@
"fileCycles": [],
"domainCycles": [
"accommodations -> assignments",
- "accommodations -> auth",
"accommodations -> mcp-shared",
"accommodations -> places",
"accommodations -> plugins",
"accommodations -> realtime",
- "addons -> auth",
"addons -> memories",
"addons -> settings",
"addons -> transit",
@@ -22,30 +20,21 @@
"admin -> plugins",
"admin -> realtime",
"admin -> settings",
- "admin -> tokens",
- "airports -> auth",
- "assignments -> auth",
"assignments -> days",
"assignments -> journey",
"assignments -> mcp-shared",
"assignments -> plugins",
"assignments -> realtime",
"atlas -> addons",
- "atlas -> auth",
"atlas -> geo",
"atlas -> plugins",
- "atlas -> public-api",
- "atlas -> tokens",
"auth -> budget",
"auth -> files",
"auth -> maps",
"auth -> notifications",
"auth -> plugins",
"auth -> settings",
- "auth -> storage",
- "auth -> tokens",
"booking-import -> addons",
- "booking-import -> airports",
"booking-import -> budget",
"booking-import -> llm-parse",
"booking-import -> maps",
@@ -53,52 +42,40 @@
"booking-import -> realtime",
"booking-import -> reservations",
"budget -> addons",
- "budget -> auth",
"budget -> mcp-shared",
"budget -> plugins",
"budget -> realtime",
"calendar -> days",
"calendar -> reservations",
- "categories -> auth",
"categories -> mcp-shared",
"categories -> plugins",
"collab -> addons",
- "collab -> auth",
"collab -> files",
"collab -> mcp-shared",
"collab -> notifications",
"collab -> plugins",
"collab -> realtime",
- "collab -> storage",
"collections -> addons",
- "collections -> auth",
"collections -> notifications",
"collections -> places",
"collections -> plugins",
"collections -> realtime",
- "collections -> storage",
- "day-notes -> auth",
"day-notes -> mcp-shared",
"day-notes -> plugins",
"day-notes -> realtime",
"days -> accommodations",
"days -> assignments",
- "days -> auth",
"days -> mcp-shared",
"days -> places",
"days -> plugins",
"days -> realtime",
- "files -> auth",
"files -> mcp-shared",
"files -> plugins",
"files -> realtime",
- "files -> storage",
"geo -> maps",
- "google-quota -> auth",
"integrations -> addons",
"integrations -> assignments",
"integrations -> atlas",
- "integrations -> auth",
"integrations -> journey",
"integrations -> mcp-shared",
"integrations -> places",
@@ -106,7 +83,6 @@
"integrations -> reservations",
"journey -> addons",
"journey -> atlas",
- "journey -> auth",
"journey -> files",
"journey -> maps",
"journey -> memories",
@@ -114,56 +90,38 @@
"journey -> plugins",
"journey -> realtime",
"journey -> settings",
- "journey -> storage",
"llm-parse -> addons",
- "llm-parse -> auth",
"llm-parse -> settings",
- "maps -> auth",
"maps -> geo",
- "maps -> google-quota",
- "maps -> place-photos",
"maps -> settings",
- "maps -> storage",
"mcp-shared -> realtime",
"memories -> addons",
- "memories -> auth",
"memories -> notifications",
"memories -> photos",
"memories -> realtime",
- "memories -> storage",
"notifications -> admin",
- "notifications -> auth",
"notifications -> realtime",
- "notifications -> storage",
"oauth -> addons",
- "oauth -> auth",
"packing -> addons",
"packing -> admin",
- "packing -> auth",
"packing -> mcp-shared",
"packing -> notifications",
"packing -> plugins",
"packing -> realtime",
- "photos -> auth",
"photos -> memories",
- "place-photos -> storage",
"places -> accommodations",
"places -> assignments",
"places -> atlas",
- "places -> auth",
"places -> journey",
"places -> maps",
"places -> mcp-shared",
- "places -> place-photos",
"places -> plugins",
"places -> realtime",
- "places -> storage",
"places -> unsplash",
"plugins -> accommodations",
"plugins -> addons",
"plugins -> assignments",
"plugins -> atlas",
- "plugins -> auth",
"plugins -> budget",
"plugins -> categories",
"plugins -> collab",
@@ -184,14 +142,10 @@
"plugins -> trips",
"plugins -> vacay",
"plugins -> weather",
- "public-api -> tokens",
- "realtime -> auth",
"realtime -> journey",
"realtime -> plugins",
"reservations -> accommodations",
- "reservations -> airports",
"reservations -> assignments",
- "reservations -> auth",
"reservations -> budget",
"reservations -> days",
"reservations -> integrations",
@@ -200,19 +154,12 @@
"reservations -> plugins",
"reservations -> realtime",
"settings -> admin",
- "settings -> auth",
- "storage -> auth",
- "tags -> auth",
"tags -> plugins",
"todo -> addons",
- "todo -> auth",
"todo -> mcp-shared",
"todo -> plugins",
"todo -> realtime",
- "tokens -> auth",
- "transit -> auth",
"transit -> days",
- "transit -> google-quota",
"transit -> maps",
"transit -> mcp-shared",
"transit -> reservations",
@@ -235,7 +182,6 @@
"trip-read-model -> trips",
"trips -> accommodations",
"trips -> addons",
- "trips -> auth",
"trips -> budget",
"trips -> calendar",
"trips -> collab",
@@ -248,30 +194,23 @@
"trips -> realtime",
"trips -> reservations",
"trips -> settings",
- "trips -> storage",
"trips -> todo",
"trips -> trip-members",
"trips -> trip-read-model",
"trips -> unsplash",
"trips -> vacay",
"unsplash -> settings",
- "unsplash -> storage",
"vacay -> addons",
"vacay -> auth",
"vacay -> notifications",
"vacay -> plugins",
"vacay -> realtime",
- "weather -> auth",
"weather -> plugins"
],
"sharedImportsDomain": [
"nest/common/idempotency-cleanup.job.ts -> nest/audit/audit-log.logger.ts",
"nest/common/idempotency-cleanup.job.ts -> nest/scheduling/cron-registrar.service.ts",
"nest/common/rowShape.ts -> nest/query-helpers/query-helpers.service.ts",
- "nest/common/validate-route-guards.ts -> nest/auth/cookie-auth.guard.ts",
- "nest/common/validate-route-guards.ts -> nest/auth/jwt-auth.guard.ts",
- "nest/common/validate-route-guards.ts -> nest/auth/optional-jwt.guard.ts",
- "nest/common/validate-route-guards.ts -> nest/auth/public.decorator.ts",
"nest/common/validate-route-guards.ts -> nest/public-api/api-token.guard.ts"
],
"domainInternals": [
@@ -301,7 +240,6 @@
"collections -> storage/storage-upload.factory.ts",
"days -> accommodations/night-seat.ts",
"doc-sync -> storage/content-type.ts",
- "files -> auth/jwt-verify.ts",
"files -> storage/content-type.ts",
"files -> storage/storage-upload.factory.ts",
"geo -> maps/maps.helpers.ts",
@@ -318,8 +256,6 @@
"place-enrichment -> maps/trek-places.client.ts",
"places -> atlas/atlas-geo.ts",
"places -> storage/storage-upload.factory.ts",
- "platform -> auth/jwt-verify.ts",
- "plugins -> auth/jwt-verify.ts",
"plugins -> llm-parse/clients/openai-compatible.client.ts",
"plugins -> llm-parse/llm-client.factory.ts",
"plugins -> llm-parse/llm-config.resolver.ts",
diff --git a/server/scripts/import-boundaries.mjs b/server/scripts/import-boundaries.mjs
index 11f35fe2c..b82379369 100644
--- a/server/scripts/import-boundaries.mjs
+++ b/server/scripts/import-boundaries.mjs
@@ -25,8 +25,8 @@
* the next rule instead.
* sharedImportsDomain
* a file of the shared kernel (src/nest/common, database,
- * app-config), which every domain imports, importing from a
- * domain. That ties the domain into every other one.
+ * app-config, auth-core), which every domain imports,
+ * importing from a domain. That ties the domain into every other one.
* domainInternals a file in src/nest/<A>/ importing (value or type) a
* file of src/nest/<B>/ that is not B's public surface.
* Public is what the codebase already treats that way: the
@@ -58,8 +58,12 @@ const ts = require('typescript');
export const RULES = ['fileCycles', 'domainCycles', 'sharedImportsDomain', 'domainInternals', 'dbImportsNest'];
-/** Folders under src/nest whose every file is shared infrastructure, open to all domains. */
-export const SHARED_DOMAINS = new Set(['common', 'database', 'app-config']);
+/**
+ * Folders under src/nest whose every file is shared infrastructure, open to all domains.
+ * auth-core holds the request-auth primitives (the guards, the decorators, JWT
+ * verification, ephemeral tokens) every controller needs; it imports no domain.
+ */
+export const SHARED_DOMAINS = new Set(['common', 'database', 'app-config', 'auth-core']);
/** File name suffixes that make up a domain's public surface. */
export const PUBLIC_SUFFIXES = [
diff --git a/server/src/nest/README.md b/server/src/nest/README.md
index 38e6e1404..bdfe2b105 100644
--- a/server/src/nest/README.md
+++ b/server/src/nest/README.md
@@ -72,7 +72,13 @@ over an injected `AddonsService`.
import them from outside the container. `geo.ts` keeps the clamped haversine,
since `asin` of a value a hair over 1 is NaN and a NaN distance fails every
comparison silently.
-- `auth/jwt-verify.ts`: `extractToken` and `verifyJwtAndLoadUser`, the one
+- `auth-core/`: the request-auth kernel every controller imports: the guards
+ (`JwtAuthGuard`, `OptionalJwtAuthGuard`, `CookieAuthGuard`, `AdminGuard`, the
+ global `GlobalAuthGuard` and `MfaPolicyGuard`), `@CurrentUser()`, `@Public()`/
+ `@OptionalAuth()`, JWT verification and the ephemeral download/ws tokens. It
+ imports no domain, so `lint:boundaries` treats it as shared kernel like
+ `common/`; `auth/` keeps the account flows (login, MFA, passkeys, sessions).
+- `auth-core/jwt-verify.ts`: `extractToken` and `verifyJwtAndLoadUser`, the one
session check behind the guards, the MCP bearer path and the download token.
`JWT_SECRET` stays a live binding from `src/config.ts`, because the admin panel
rotates it at runtime and a `registerAs` token would freeze the boot value.
diff --git a/server/src/nest/accommodations/accommodations.controller.ts b/server/src/nest/accommodations/accommodations.controller.ts
index a05db5c3a..dc42cf6a5 100644
--- a/server/src/nest/accommodations/accommodations.controller.ts
+++ b/server/src/nest/accommodations/accommodations.controller.ts
@@ -14,8 +14,8 @@ import {
import type { User } from '../../types';
import { AccommodationsService, type MirrorSender } from './accommodations.service';
import { AccommodationCreateDto, AccommodationUpdateDto } from './accommodations.dto';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { RequirePermission, TripAccessGuard } from '../permissions/trip-access.guard';
type AccommodationBody = {
diff --git a/server/src/nest/addons/addons.controller.ts b/server/src/nest/addons/addons.controller.ts
index 62830c6bd..2c24b68c1 100644
--- a/server/src/nest/addons/addons.controller.ts
+++ b/server/src/nest/addons/addons.controller.ts
@@ -1,6 +1,6 @@
import { Controller, Get, UseGuards } from '@nestjs/common';
import { AddonsService } from './addons.service';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
/**
* GET /api/addons — the enabled trip add-ons + photo providers feed.
diff --git a/server/src/nest/admin/admin.controller.ts b/server/src/nest/admin/admin.controller.ts
index 08b1ee1b0..c6482ea35 100644
--- a/server/src/nest/admin/admin.controller.ts
+++ b/server/src/nest/admin/admin.controller.ts
@@ -23,9 +23,9 @@ import {
} from './admin.dto';
import { PluginRuntimeService } from '../plugins/plugin-runtime.service';
import { AddonsService } from '../addons/addons.service';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { AdminGuard } from '../auth/admin.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { AdminGuard } from '../auth-core/admin.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { getClientIp } from '../audit/client-ip';
import { logInfo } from '../audit/audit-log.logger';
import { AuditService } from '../audit/audit.service';
diff --git a/server/src/nest/airports/airports.controller.ts b/server/src/nest/airports/airports.controller.ts
index 8ac3f463a..2e4e5e289 100644
--- a/server/src/nest/airports/airports.controller.ts
+++ b/server/src/nest/airports/airports.controller.ts
@@ -1,7 +1,7 @@
import { Controller, Get, HttpException, Param, Query, UseGuards } from '@nestjs/common';
import type { Airport } from '@trek/shared';
import { AirportsService } from './airports.service';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
/**
* /api/airports — typeahead search + single lookup by IATA code.
diff --git a/server/src/nest/app.module.ts b/server/src/nest/app.module.ts
index a1f422bd0..de24eba89 100644
--- a/server/src/nest/app.module.ts
+++ b/server/src/nest/app.module.ts
@@ -14,8 +14,8 @@ import { AssignmentsModule } from './assignments/assignments.module';
import { AtlasModule } from './atlas/atlas.module';
import { AuditModule } from './audit/audit.module';
import { AuthModule } from './auth/auth.module';
-import { GlobalAuthGuard } from './auth/global-auth.guard';
-import { MfaPolicyGuard } from './auth/mfa-policy.guard';
+import { GlobalAuthGuard } from './auth-core/global-auth.guard';
+import { MfaPolicyGuard } from './auth-core/mfa-policy.guard';
import { SessionRenewalInterceptor } from './auth/session-renewal.interceptor';
import { BackupModule } from './backup/backup.module';
import { BookingImportModule } from './booking-import/booking-import.module';
diff --git a/server/src/nest/assignments/assignments.controller.ts b/server/src/nest/assignments/assignments.controller.ts
index e7f57dbb6..336ca5ad9 100644
--- a/server/src/nest/assignments/assignments.controller.ts
+++ b/server/src/nest/assignments/assignments.controller.ts
@@ -23,8 +23,8 @@ import {
AssignmentRouteDto,
AssignmentParticipantsDto,
} from './assignments.dto';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { RequirePermission, TripAccessGuard } from '../permissions/trip-access.guard';
diff --git a/server/src/nest/atlas/atlas.controller.ts b/server/src/nest/atlas/atlas.controller.ts
index 9ca23a3e1..126942ff7 100644
--- a/server/src/nest/atlas/atlas.controller.ts
+++ b/server/src/nest/atlas/atlas.controller.ts
@@ -18,8 +18,8 @@ import type { AtlasLocateResponse, RegionGeo } from '@trek/shared';
import type { User } from '../../types';
import { AtlasService, BucketItemExistsError } from './atlas.service';
import { AtlasMarkRegionDto, AtlasCreateBucketItemDto, AtlasUpdateBucketItemDto } from './atlas.dto';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
/**
* /api/addons/atlas — visited countries/regions, region GeoJSON, bucket list.
diff --git a/server/src/nest/atlas/atlas.module.ts b/server/src/nest/atlas/atlas.module.ts
index 77347477d..440d6242a 100644
--- a/server/src/nest/atlas/atlas.module.ts
+++ b/server/src/nest/atlas/atlas.module.ts
@@ -7,7 +7,6 @@ import { AtlasRpc } from './atlas.rpc';
import { PluginGuardsModule } from '../plugins/host/plugin-guards.module';
import { AtlasMcp } from './atlas.mcp';
import { AddonsModule } from '../addons/addons.module';
-import { AuthModule } from '../auth/auth.module';
import { PublicStatsController } from './public-stats.controller';
import { ApiTokenGuard } from '../public-api/api-token.guard';
import { TokensModule } from '../tokens/tokens.module';
@@ -54,7 +53,7 @@ import { PlaceRegionsRepairJob } from './place-regions-repair.job';
*/
@Module({
imports: [
- AuthModule,
+
PluginGuardsModule,
AddonsModule,
TokensModule,
diff --git a/server/src/nest/atlas/travel-stats.controller.ts b/server/src/nest/atlas/travel-stats.controller.ts
index 70f6530f0..ec5842eb8 100644
--- a/server/src/nest/atlas/travel-stats.controller.ts
+++ b/server/src/nest/atlas/travel-stats.controller.ts
@@ -1,7 +1,7 @@
import { Controller, Get, UseGuards } from '@nestjs/common';
import { AtlasService } from './atlas.service';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import type { User } from '../../types';
/**
diff --git a/server/src/nest/auth/admin.guard.ts b/server/src/nest/auth-core/admin.guard.ts
similarity index 100%
rename from server/src/nest/auth/admin.guard.ts
rename to server/src/nest/auth-core/admin.guard.ts
diff --git a/server/src/nest/auth/cookie-auth.guard.ts b/server/src/nest/auth-core/cookie-auth.guard.ts
similarity index 100%
rename from server/src/nest/auth/cookie-auth.guard.ts
rename to server/src/nest/auth-core/cookie-auth.guard.ts
diff --git a/server/src/nest/auth/current-user.decorator.ts b/server/src/nest/auth-core/current-user.decorator.ts
similarity index 100%
rename from server/src/nest/auth/current-user.decorator.ts
rename to server/src/nest/auth-core/current-user.decorator.ts
diff --git a/server/src/nest/auth/ephemeral-token.module.ts b/server/src/nest/auth-core/ephemeral-token.module.ts
similarity index 100%
rename from server/src/nest/auth/ephemeral-token.module.ts
rename to server/src/nest/auth-core/ephemeral-token.module.ts
diff --git a/server/src/nest/auth/ephemeral-token.service.ts b/server/src/nest/auth-core/ephemeral-token.service.ts
similarity index 100%
rename from server/src/nest/auth/ephemeral-token.service.ts
rename to server/src/nest/auth-core/ephemeral-token.service.ts
diff --git a/server/src/nest/auth/ephemeral-tokens.ts b/server/src/nest/auth-core/ephemeral-tokens.ts
similarity index 100%
rename from server/src/nest/auth/ephemeral-tokens.ts
rename to server/src/nest/auth-core/ephemeral-tokens.ts
diff --git a/server/src/nest/auth/global-auth.guard.ts b/server/src/nest/auth-core/global-auth.guard.ts
similarity index 100%
rename from server/src/nest/auth/global-auth.guard.ts
rename to server/src/nest/auth-core/global-auth.guard.ts
diff --git a/server/src/nest/auth/jwt-auth.guard.ts b/server/src/nest/auth-core/jwt-auth.guard.ts
similarity index 100%
rename from server/src/nest/auth/jwt-auth.guard.ts
rename to server/src/nest/auth-core/jwt-auth.guard.ts
diff --git a/server/src/nest/auth/jwt-verify.ts b/server/src/nest/auth-core/jwt-verify.ts
similarity index 98%
rename from server/src/nest/auth/jwt-verify.ts
rename to server/src/nest/auth-core/jwt-verify.ts
index 047ecc447..54b08cc9b 100644
--- a/server/src/nest/auth/jwt-verify.ts
+++ b/server/src/nest/auth-core/jwt-verify.ts
@@ -14,7 +14,7 @@ import { dbNow } from '../../db/types';
*
* Free functions rather than a provider: the platform routes run outside the
* container and would have no way to inject one, and the guards that call this
- * (the MFA policy is nest/auth/mfa-policy.guard.ts now) share the one copy.
+ * (the MFA policy is nest/auth-core/mfa-policy.guard.ts now) share the one copy.
* Note JWT_SECRET is deliberately a live binding from src/config, not an app-config value: the admin panel rotates it
* at runtime and `export let` is what makes a rotation take effect in-process.
*
diff --git a/server/src/nest/auth/mfa-policy.guard.ts b/server/src/nest/auth-core/mfa-policy.guard.ts
similarity index 100%
rename from server/src/nest/auth/mfa-policy.guard.ts
rename to server/src/nest/auth-core/mfa-policy.guard.ts
diff --git a/server/src/nest/auth/optional-jwt.guard.ts b/server/src/nest/auth-core/optional-jwt.guard.ts
similarity index 100%
rename from server/src/nest/auth/optional-jwt.guard.ts
rename to server/src/nest/auth-core/optional-jwt.guard.ts
diff --git a/server/src/nest/auth/public.decorator.ts b/server/src/nest/auth-core/public.decorator.ts
similarity index 100%
rename from server/src/nest/auth/public.decorator.ts
rename to server/src/nest/auth-core/public.decorator.ts
diff --git a/server/src/nest/auth/auth-public.controller.ts b/server/src/nest/auth/auth-public.controller.ts
index eaf1a3601..45e380e27 100644
--- a/server/src/nest/auth/auth-public.controller.ts
+++ b/server/src/nest/auth/auth-public.controller.ts
@@ -3,14 +3,14 @@ import type { Request, Response } from 'express';
import { AuthService } from './auth.service';
import { RegisterDto, LoginDto, ForgotPasswordDto, ResetPasswordDto, MfaVerifyLoginDto } from './auth.dto';
import { RateLimitService } from '../common/rate-limit.service';
-import { OptionalJwtGuard } from './optional-jwt.guard';
+import { OptionalJwtGuard } from '../auth-core/optional-jwt.guard';
import { getClientIp } from '../audit/client-ip';
import { AuditService } from '../audit/audit.service';
import { willDropSecureCookie } from '../common/cookie';
import type { User } from '../../types';
-import { Public } from './public.decorator';
-import { MfaExempt } from './mfa-policy.guard';
-import { extractToken, verifiedSessionClaims } from './jwt-verify';
+import { Public } from '../auth-core/public.decorator';
+import { MfaExempt } from '../auth-core/mfa-policy.guard';
+import { extractToken, verifiedSessionClaims } from '../auth-core/jwt-verify';
import { SessionsService, sessionClientFrom } from '../sessions/sessions.service';
const WINDOW = 15 * 60 * 1000;
diff --git a/server/src/nest/auth/auth.controller.ts b/server/src/nest/auth/auth.controller.ts
index efd36e733..d6ab99b71 100644
--- a/server/src/nest/auth/auth.controller.ts
+++ b/server/src/nest/auth/auth.controller.ts
@@ -37,14 +37,14 @@ import {
ResourceTokenDto,
} from './auth.dto';
import { RateLimitService } from '../common/rate-limit.service';
-import { JwtAuthGuard } from './jwt-auth.guard';
-import { CurrentUser } from './current-user.decorator';
-import { currentSessionId, decodeSessionClaims } from './jwt-verify';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
+import { currentSessionId, decodeSessionClaims } from '../auth-core/jwt-verify';
import { sessionClientFrom } from '../sessions/sessions.service';
import { getClientIp } from '../audit/client-ip';
import { AuditService } from '../audit/audit.service';
import type { User } from '../../types';
-import { MfaExempt } from './mfa-policy.guard';
+import { MfaExempt } from '../auth-core/mfa-policy.guard';
import { ManagedForbidden } from '../common/managed';
const WINDOW = 15 * 60 * 1000;
diff --git a/server/src/nest/auth/auth.module.ts b/server/src/nest/auth/auth.module.ts
index 20a0aa1a7..c624e7e0c 100644
--- a/server/src/nest/auth/auth.module.ts
+++ b/server/src/nest/auth/auth.module.ts
@@ -41,7 +41,7 @@ import { AuditModule } from '../audit/audit.module';
import { MailerModule } from '../notifications/mailer/mailer.module';
import { PermissionsModule } from '../permissions/permissions.module';
import { TripMembershipModule } from '../trip-membership/trip-membership.module';
-import { EphemeralTokenModule } from './ephemeral-token.module';
+import { EphemeralTokenModule } from '../auth-core/ephemeral-token.module';
import { MulterModule } from '@nestjs/platform-express';
import { StorageModule } from '../storage/storage.module';
import { StorageService } from '../storage/storage.service';
diff --git a/server/src/nest/auth/auth.service.ts b/server/src/nest/auth/auth.service.ts
index ed2380480..42c7fcc2e 100644
--- a/server/src/nest/auth/auth.service.ts
+++ b/server/src/nest/auth/auth.service.ts
@@ -37,7 +37,7 @@ import { SessionsService, type SessionClient } from '../sessions/sessions.servic
// Type-and-guard only: the app-config read reports the provider choice, it does
// not construct one, so this does not pull the maps domain into auth.
import { isPlacesProviderChoice } from '../maps/providers/places-provider';
-import { EphemeralTokenService } from './ephemeral-token.service';
+import { EphemeralTokenService } from '../auth-core/ephemeral-token.service';
// Import from sessionManager directly, NOT the ../../mcp barrel: the barrel pulls
// the whole tools fan-out (and via the domain bridges, the Nest services) into
// every consumer of this module — a nest→mcp→nest module cycle.
@@ -45,7 +45,7 @@ import { revokeUserSessions } from '../../mcp/sessionManager';
import { UserCleanupService } from './user-cleanup.service';
import { splitManagedKeys } from '../common/managed';
import { emitUserDeleted } from '../../plugin-user-lifecycle';
-import { verifyJwtAndLoadUser } from './jwt-verify';
+import { verifyJwtAndLoadUser } from '../auth-core/jwt-verify';
import { User } from '../../types';
import { UserIdentityTakenError, type UserRow } from '../../db/repositories/Users.repository';
import { DEMO_EMAIL_PRIMARY, DEMO_PASS, isDemoEmail } from '../common/demo';
@@ -1110,7 +1110,7 @@ export class AuthService {
// -------------------------------------------------------------------------
/**
- * Verify a JWT the same way `auth/jwt-verify.ts#verifyJwtAndLoadUser`
+ * Verify a JWT the same way `auth-core/jwt-verify.ts#verifyJwtAndLoadUser`
* does — including the `password_version` check — so that stolen tokens
* lose access the moment the victim resets their password.
*
diff --git a/server/src/nest/auth/passkey.controller.ts b/server/src/nest/auth/passkey.controller.ts
index cfb9d915f..48d5a5489 100644
--- a/server/src/nest/auth/passkey.controller.ts
+++ b/server/src/nest/auth/passkey.controller.ts
@@ -1,16 +1,16 @@
import { Body, Controller, Delete, Get, HttpCode, HttpException, Param, Patch, Post, Req, Res, UseGuards } from '@nestjs/common';
import type { Request, Response } from 'express';
import { RateLimitService } from '../common/rate-limit.service';
-import { JwtAuthGuard } from './jwt-auth.guard';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
import { PasskeyEnabledGuard } from './passkey-enabled.guard';
-import { CurrentUser } from './current-user.decorator';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { setAuthCookie } from '../common/cookie';
import { getClientIp } from '../audit/client-ip';
import { AuditService } from '../audit/audit.service';
import { PasskeyService } from './passkey.service';
import { PasskeyRegisterOptionsDto, PasskeyRegisterVerifyDto, PasskeyLoginVerifyDto, PasskeyRenameDto, PasskeyDeleteDto } from './auth.dto';
import type { User } from '../../types';
-import { MfaExempt } from './mfa-policy.guard';
+import { MfaExempt } from '../auth-core/mfa-policy.guard';
import { sessionClientFrom } from '../sessions/sessions.service';
const WINDOW = 15 * 60 * 1000;
diff --git a/server/src/nest/auth/session-renewal.interceptor.ts b/server/src/nest/auth/session-renewal.interceptor.ts
index d7f83b38b..a15a9241f 100644
--- a/server/src/nest/auth/session-renewal.interceptor.ts
+++ b/server/src/nest/auth/session-renewal.interceptor.ts
@@ -2,7 +2,7 @@ import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from '@nes
import type { Request, Response } from 'express';
import type { Observable } from 'rxjs';
import { SessionsService, sessionClientFrom } from '../sessions/sessions.service';
-import { decodeSessionClaims } from './jwt-verify';
+import { decodeSessionClaims } from '../auth-core/jwt-verify';
import { setAuthCookie } from '../common/cookie';
/**
diff --git a/server/src/nest/auth/sessions.controller.ts b/server/src/nest/auth/sessions.controller.ts
index 15330b3d7..7086cd3d4 100644
--- a/server/src/nest/auth/sessions.controller.ts
+++ b/server/src/nest/auth/sessions.controller.ts
@@ -15,9 +15,9 @@ import { SessionsService } from '../sessions/sessions.service';
import { isDemoEmail } from '../common/demo';
import { readEnv } from '../../app-config';
import type { User } from '../../types';
-import { CurrentUser } from './current-user.decorator';
-import { currentSessionId } from './jwt-verify';
-import { JwtAuthGuard } from './jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
+import { currentSessionId } from '../auth-core/jwt-verify';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
/**
* The signed-in user's own sessions: where they are signed in, and signing
diff --git a/server/src/nest/backup/backup.controller.ts b/server/src/nest/backup/backup.controller.ts
index 1b0327c0b..74cc571c3 100644
--- a/server/src/nest/backup/backup.controller.ts
+++ b/server/src/nest/backup/backup.controller.ts
@@ -21,9 +21,9 @@ import { readEnv } from '../../app-config';
import type { User } from '../../types';
import { BackupService } from './backup.service';
import { AutoBackupJob } from './auto-backup.job';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { AdminGuard } from '../auth/admin.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { AdminGuard } from '../auth-core/admin.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { AutoBackupSettingsDto } from './backup.dto';
import { getClientIp } from '../audit/client-ip';
import { AuditService } from '../audit/audit.service';
diff --git a/server/src/nest/budget/budget.controller.ts b/server/src/nest/budget/budget.controller.ts
index 71bd51b2f..eb88657f4 100644
--- a/server/src/nest/budget/budget.controller.ts
+++ b/server/src/nest/budget/budget.controller.ts
@@ -14,8 +14,8 @@ import {
} from '@nestjs/common';
import type { User } from '../../types';
import { BudgetService } from './budget.service';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { RequirePermission, TripAccessGuard } from '../permissions/trip-access.guard';
import { Trip } from '../permissions/trip.decorator';
import type { TripAccess } from '../../db/repositories/Trips.repository';
diff --git a/server/src/nest/categories/categories.controller.ts b/server/src/nest/categories/categories.controller.ts
index 8bb31cb58..a5f09b782 100644
--- a/server/src/nest/categories/categories.controller.ts
+++ b/server/src/nest/categories/categories.controller.ts
@@ -3,9 +3,9 @@ import type { Category, CategoryListResponse } from '@trek/shared';
import type { User } from '../../types';
import { CategoriesService } from './categories.service';
import { CategoryCreateDto, CategoryUpdateDto } from './categories.dto';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { AdminGuard } from '../auth/admin.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { AdminGuard } from '../auth-core/admin.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
/**
* /api/categories — place-category palette CRUD.
diff --git a/server/src/nest/collab/collab.controller.ts b/server/src/nest/collab/collab.controller.ts
index 0bf3b28c7..fa0b3b818 100644
--- a/server/src/nest/collab/collab.controller.ts
+++ b/server/src/nest/collab/collab.controller.ts
@@ -32,8 +32,8 @@ import {
CollabMessageCreateDto,
CollabReactionDto,
} from './collab.dto';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { RequirePermission, TripAccessGuard } from '../permissions/trip-access.guard';
import { BLOCKED_EXTENSIONS, MAX_FILE_SIZE } from '../files/files.constants';
import { SpoolCleanupInterceptor } from '../common/spool-cleanup.interceptor';
diff --git a/server/src/nest/collections/collections.controller.ts b/server/src/nest/collections/collections.controller.ts
index d15500685..e9b369aac 100644
--- a/server/src/nest/collections/collections.controller.ts
+++ b/server/src/nest/collections/collections.controller.ts
@@ -25,8 +25,8 @@ import { CollectionsService } from './collections.service';
import { AddonGuard } from '../addons/addon.guard';
import { RequireAddon } from '../addons/require-addon.decorator';
import { ADDON_IDS } from '../../addons';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { PLACE_IMAGE_FILE_FILTER } from '../common/place-image-upload';
import { StorageService } from '../storage/storage.service';
import { placeImageUrl } from '../places/place-image';
diff --git a/server/src/nest/common/validate-route-guards.ts b/server/src/nest/common/validate-route-guards.ts
index 2432214b7..0a001d088 100644
--- a/server/src/nest/common/validate-route-guards.ts
+++ b/server/src/nest/common/validate-route-guards.ts
@@ -1,10 +1,10 @@
import { METHOD_METADATA, PATH_METADATA, GUARDS_METADATA } from '@nestjs/common/constants';
import { ModulesContainer } from '@nestjs/core';
import type { INestApplication } from '@nestjs/common';
-import { IS_PUBLIC, OPTIONAL_AUTH } from '../auth/public.decorator';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CookieAuthGuard } from '../auth/cookie-auth.guard';
-import { OptionalJwtGuard } from '../auth/optional-jwt.guard';
+import { IS_PUBLIC, OPTIONAL_AUTH } from '../auth-core/public.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CookieAuthGuard } from '../auth-core/cookie-auth.guard';
+import { OptionalJwtGuard } from '../auth-core/optional-jwt.guard';
import { ApiTokenGuard } from '../public-api/api-token.guard';
export interface RouteGuardEntry {
diff --git a/server/src/nest/config/config.controller.ts b/server/src/nest/config/config.controller.ts
index c43e72b0b..48fc6d5dd 100644
--- a/server/src/nest/config/config.controller.ts
+++ b/server/src/nest/config/config.controller.ts
@@ -1,7 +1,7 @@
import { Controller, Get } from '@nestjs/common';
import type { PublicConfig } from '@trek/shared';
import { DEFAULT_LANGUAGE } from '../../config';
-import { Public } from '../auth/public.decorator';
+import { Public } from '../auth-core/public.decorator';
/**
* /api/config — public (unauthenticated) bootstrap config.
diff --git a/server/src/nest/day-notes/day-notes.controller.ts b/server/src/nest/day-notes/day-notes.controller.ts
index 13844d26d..348f8ea56 100644
--- a/server/src/nest/day-notes/day-notes.controller.ts
+++ b/server/src/nest/day-notes/day-notes.controller.ts
@@ -13,8 +13,8 @@ import {
import type { User } from '../../types';
import { DayNotesService } from './day-notes.service';
import { DayNoteCreateDto, DayNoteUpdateDto } from './day-notes.dto';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { RequirePermission, TripAccessGuard } from '../permissions/trip-access.guard';
/**
diff --git a/server/src/nest/days/days.controller.ts b/server/src/nest/days/days.controller.ts
index 28561bfc0..7cce12c66 100644
--- a/server/src/nest/days/days.controller.ts
+++ b/server/src/nest/days/days.controller.ts
@@ -14,8 +14,8 @@ import type { User } from '../../types';
import { DaysService, DayReorderError, DayAppendError, type DatedDayAppend } from './days.service';
import { DayRemovalService, DayDeleteError, type DayRemoval } from './day-removal.service';
import { DayCreateDto, DayReorderDto, DayTransportDto, DayUpdateDto } from './days.dto';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { RequirePermission, TripAccessGuard } from '../permissions/trip-access.guard';
/**
diff --git a/server/src/nest/doc-sync/doc-sync-webhook.controller.ts b/server/src/nest/doc-sync/doc-sync-webhook.controller.ts
index 7e48c7419..3ec554f33 100644
--- a/server/src/nest/doc-sync/doc-sync-webhook.controller.ts
+++ b/server/src/nest/doc-sync/doc-sync-webhook.controller.ts
@@ -2,7 +2,7 @@ import { Controller, HttpCode, OnModuleDestroy, Param, Post, Req } from '@nestjs
import { MikroORM } from '@mikro-orm/core';
import type { Request } from 'express';
import crypto from 'crypto';
-import { Public } from '../auth/public.decorator';
+import { Public } from '../auth-core/public.decorator';
import { withRequestContext } from '../database/request-context';
import { WEBHOOK_NUDGE_DEBOUNCE_SECONDS } from './doc-sync.constants';
import { DocSyncConfigService, type LinkRow } from './doc-sync-config.service';
diff --git a/server/src/nest/doc-sync/doc-sync.controller.ts b/server/src/nest/doc-sync/doc-sync.controller.ts
index e28de7ce2..2ab2fa72f 100644
--- a/server/src/nest/doc-sync/doc-sync.controller.ts
+++ b/server/src/nest/doc-sync/doc-sync.controller.ts
@@ -20,8 +20,8 @@ import type { User } from '../../types';
import { ADDON_IDS } from '../../addons';
import { AddonGuard } from '../addons/addon.guard';
import { RequireAddon } from '../addons/require-addon.decorator';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { TripAccessGuard } from '../permissions/trip-access.guard';
import { RealtimeService } from '../realtime/realtime.service';
import { withRequestContext } from '../database/request-context';
diff --git a/server/src/nest/feeds/feeds.controller.ts b/server/src/nest/feeds/feeds.controller.ts
index cd0b499b5..8314cdd0b 100644
--- a/server/src/nest/feeds/feeds.controller.ts
+++ b/server/src/nest/feeds/feeds.controller.ts
@@ -13,13 +13,13 @@ import type { Request, Response } from 'express';
import { readEnv } from '../../app-config';
import { contentDisposition } from '../common/content-disposition';
import { FeedsService } from './feeds.service';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import type { User } from '../../types';
import { RequirePermission, TripAccessGuard } from '../permissions/trip-access.guard';
import { Trip } from '../permissions/trip.decorator';
import type { TripAccess } from '../../db/repositories/Trips.repository';
-import { Public } from '../auth/public.decorator';
+import { Public } from '../auth-core/public.decorator';
// Resolve the public origin used to build feed URLs. APP_URL wins — it is the
// canonical externally-reachable URL behind a reverse proxy. When it is unset
diff --git a/server/src/nest/files/files-download.controller.ts b/server/src/nest/files/files-download.controller.ts
index c823ab91d..9d17a683f 100644
--- a/server/src/nest/files/files-download.controller.ts
+++ b/server/src/nest/files/files-download.controller.ts
@@ -3,7 +3,7 @@ import type { Request, Response } from 'express';
import path from 'path';
import { FilesService } from './files.service';
import { contentDisposition } from '../common/content-disposition';
-import { Public } from '../auth/public.decorator';
+import { Public } from '../auth-core/public.decorator';
import { StorageService } from '../storage/storage.service';
/**
diff --git a/server/src/nest/files/files.controller.ts b/server/src/nest/files/files.controller.ts
index aafde65a2..2d1c4812a 100644
--- a/server/src/nest/files/files.controller.ts
+++ b/server/src/nest/files/files.controller.ts
@@ -24,8 +24,8 @@ import fs from 'fs';
import type { User } from '../../types';
import { StorageService } from '../storage/storage.service';
import { FilesService } from './files.service';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { TripAccessGuard } from '../permissions/trip-access.guard';
import type { TripAccess } from '../../db/repositories/Trips.repository';
import { Trip } from '../permissions/trip.decorator';
diff --git a/server/src/nest/files/files.module.ts b/server/src/nest/files/files.module.ts
index 48b825706..c720c75b9 100644
--- a/server/src/nest/files/files.module.ts
+++ b/server/src/nest/files/files.module.ts
@@ -10,7 +10,7 @@ import { PluginGuardsModule } from '../plugins/host/plugin-guards.module';
import { RealtimeModule } from '../realtime/realtime.module';
import { PermissionsModule } from '../permissions/permissions.module';
import { AppConfigModule } from '../app-config/app-config.module';
-import { EphemeralTokenModule } from '../auth/ephemeral-token.module';
+import { EphemeralTokenModule } from '../auth-core/ephemeral-token.module';
import { MulterModule } from '@nestjs/platform-express';
import { AllowedFileTypesModule } from './allowed-file-types.module';
import { AllowedFileTypesService } from './allowed-file-types.service';
diff --git a/server/src/nest/files/files.service.ts b/server/src/nest/files/files.service.ts
index 6f71e99c9..65c6abe18 100644
--- a/server/src/nest/files/files.service.ts
+++ b/server/src/nest/files/files.service.ts
@@ -8,8 +8,8 @@ import type { TrekWsPayload, TrekWsTripEventName } from '@trek/shared';
import { RealtimeService } from '../realtime/realtime.service';
import { PermissionsService } from '../permissions/permissions.service';
import { avatarUrl } from '../common/avatarUrl';
-import { EphemeralTokenService } from '../auth/ephemeral-token.service';
-import { verifyJwtAndLoadUser } from '../auth/jwt-verify';
+import { EphemeralTokenService } from '../auth-core/ephemeral-token.service';
+import { verifyJwtAndLoadUser } from '../auth-core/jwt-verify';
import { EntityManager } from '@mikro-orm/core';
import { Users } from '../../db/entities/Users.entity';
import { UserSessions } from '../../db/entities/UserSessions.entity';
diff --git a/server/src/nest/google-quota/google-quota.controller.ts b/server/src/nest/google-quota/google-quota.controller.ts
index b80d1ff85..d4e5b5d0b 100644
--- a/server/src/nest/google-quota/google-quota.controller.ts
+++ b/server/src/nest/google-quota/google-quota.controller.ts
@@ -1,9 +1,9 @@
import { Body, Controller, Get, Put, Req, UseGuards } from '@nestjs/common';
import type { Request } from 'express';
import type { GoogleQuotaStatus } from '@trek/shared';
-import { AdminGuard } from '../auth/admin.guard';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { AdminGuard } from '../auth-core/admin.guard';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { AuditService } from '../audit/audit.service';
import { getClientIp } from '../audit/client-ip';
import type { User } from '../../types';
diff --git a/server/src/nest/health/features.controller.ts b/server/src/nest/health/features.controller.ts
index 8d31aac8a..5db9c1ea7 100644
--- a/server/src/nest/health/features.controller.ts
+++ b/server/src/nest/health/features.controller.ts
@@ -4,7 +4,7 @@ import { MaintenanceRepository } from '../../db/repositories/MaintenanceReposito
import { KitineraryExtractorService } from '../booking-import/kitinerary-extractor.service';
import { AddonsService } from '../addons/addons.service';
import { ADDON_IDS } from '../../addons';
-import { Public } from '../auth/public.decorator';
+import { Public } from '../auth-core/public.decorator';
import { ReadinessService } from './readiness.service';
/** Exposes the container probe and the server feature flags consumed by the
diff --git a/server/src/nest/help/help.controller.ts b/server/src/nest/help/help.controller.ts
index 69cd5a0f2..1535df01b 100644
--- a/server/src/nest/help/help.controller.ts
+++ b/server/src/nest/help/help.controller.ts
@@ -1,6 +1,6 @@
import { Controller, Get, HttpException, Param, Query, Req, Res } from '@nestjs/common';
import type { Request, Response } from 'express';
-import { Public } from '../auth/public.decorator';
+import { Public } from '../auth-core/public.decorator';
import {
getWikiIndex,
getWikiPage,
diff --git a/server/src/nest/integrations/airtrail.controller.ts b/server/src/nest/integrations/airtrail.controller.ts
index 6fd5d08ce..5752b597c 100644
--- a/server/src/nest/integrations/airtrail.controller.ts
+++ b/server/src/nest/integrations/airtrail.controller.ts
@@ -1,8 +1,8 @@
import { Body, Controller, Get, HttpCode, HttpException, Post, Put, Req, UseGuards } from '@nestjs/common';
import type { Request } from 'express';
import type { User } from '../../types';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { AddonGuard } from '../addons/addon.guard';
import { RequireAddon } from '../addons/require-addon.decorator';
import { ADDON_IDS } from '../../addons';
diff --git a/server/src/nest/integrations/dawarich.controller.ts b/server/src/nest/integrations/dawarich.controller.ts
index d362d5497..3a96bd584 100644
--- a/server/src/nest/integrations/dawarich.controller.ts
+++ b/server/src/nest/integrations/dawarich.controller.ts
@@ -14,8 +14,8 @@ import {
} from '@nestjs/common';
import type { Request } from 'express';
import type { User } from '../../types';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { AddonGuard } from '../addons/addon.guard';
import { RequireAddon } from '../addons/require-addon.decorator';
import { ADDON_IDS } from '../../addons';
diff --git a/server/src/nest/journey/journey-public.controller.ts b/server/src/nest/journey/journey-public.controller.ts
index a3a9b0795..8c88fdd18 100644
--- a/server/src/nest/journey/journey-public.controller.ts
+++ b/server/src/nest/journey/journey-public.controller.ts
@@ -6,7 +6,7 @@ import { StorageService } from '../storage/storage.service';
import { AddonGuard } from '../addons/addon.guard';
import { RequireAddon } from '../addons/require-addon.decorator';
import { ADDON_IDS } from '../../addons';
-import { Public } from '../auth/public.decorator';
+import { Public } from '../auth-core/public.decorator';
/**
* /api/public/journey — unauthenticated, share-token validated read + photo
diff --git a/server/src/nest/journey/journey.controller.ts b/server/src/nest/journey/journey.controller.ts
index 590d9a602..78392ab82 100644
--- a/server/src/nest/journey/journey.controller.ts
+++ b/server/src/nest/journey/journey.controller.ts
@@ -30,8 +30,8 @@ import { JourneyPhotoCaptureService } from './journey-photo-capture.service';
import { AddonGuard } from '../addons/addon.guard';
import { RequireAddon } from '../addons/require-addon.decorator';
import { ADDON_IDS } from '../../addons';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import {
JourneyAddTripDto, JourneyContributorAddDto, JourneyContributorUpdateDto, JourneyCreateDto,
JourneyEntryCreateDto, JourneyEntryPhotoUploadDto, JourneyEntryUpdateDto, JourneyGalleryVideoDto,
diff --git a/server/src/nest/llm-parse/llm-capabilities.controller.ts b/server/src/nest/llm-parse/llm-capabilities.controller.ts
index 6ff0b36e9..bbb39207d 100644
--- a/server/src/nest/llm-parse/llm-capabilities.controller.ts
+++ b/server/src/nest/llm-parse/llm-capabilities.controller.ts
@@ -1,8 +1,8 @@
import { Controller, Get, UseGuards } from '@nestjs/common';
import type { LlmCapabilitiesResponse } from '@trek/shared';
import type { User } from '../../types';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { LlmParseService } from './llm-parse.service';
/**
diff --git a/server/src/nest/llm-parse/llm-local.controller.ts b/server/src/nest/llm-parse/llm-local.controller.ts
index 044dd77d1..1f77a780f 100644
--- a/server/src/nest/llm-parse/llm-local.controller.ts
+++ b/server/src/nest/llm-parse/llm-local.controller.ts
@@ -1,7 +1,7 @@
import { Controller, Get, Post, Query, Body, Res, UseGuards } from '@nestjs/common';
import type { Response } from 'express';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { AdminGuard } from '../auth/admin.guard';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { AdminGuard } from '../auth-core/admin.guard';
import { LlmLocalService } from './llm-local.service';
import { LlmLocalPullDto } from './llm-local.dto';
import { ManagedForbidden } from '../common/managed';
diff --git a/server/src/nest/maps/maps.controller.ts b/server/src/nest/maps/maps.controller.ts
index a3cd62e9f..306e0f1af 100644
--- a/server/src/nest/maps/maps.controller.ts
+++ b/server/src/nest/maps/maps.controller.ts
@@ -25,8 +25,8 @@ import type { User } from '../../types';
import { MapsService } from './maps.service';
import { StorageService } from '../storage/storage.service';
import { isClientAbortError } from '../storage/storage.types';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { MapsSearchDto, MapsNearbyDto, MapsAutocompleteDto, MapsResolveUrlDto } from './maps.dto';
/** Google's session-token shape: URL-safe ASCII, at most 36 characters. The
diff --git a/server/src/nest/mcp-transport/mcp-transport.controller.ts b/server/src/nest/mcp-transport/mcp-transport.controller.ts
index cb36ceb8e..c5919ad6c 100644
--- a/server/src/nest/mcp-transport/mcp-transport.controller.ts
+++ b/server/src/nest/mcp-transport/mcp-transport.controller.ts
@@ -1,6 +1,6 @@
import { Controller, Delete, Get, Post, Req, Res } from '@nestjs/common';
import type { Request, Response } from 'express';
-import { Public } from '../auth/public.decorator';
+import { Public } from '../auth-core/public.decorator';
import { McpTransportService } from './mcp-transport.service';
/**
diff --git a/server/src/nest/memories/immich.controller.ts b/server/src/nest/memories/immich.controller.ts
index bc8d4d2bd..0c6727437 100644
--- a/server/src/nest/memories/immich.controller.ts
+++ b/server/src/nest/memories/immich.controller.ts
@@ -2,8 +2,8 @@ import { Body, Controller, Get, Headers, HttpCode, Param, Post, Put, Req, Res, U
import type { Request, Response } from 'express';
import type { User } from '../../types';
import { MemoriesService } from './memories.service';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { getClientIp } from '../audit/client-ip';
import { ImmichSearchDto, ImmichSettingsDto, ImmichTestDto } from './memories.dto';
diff --git a/server/src/nest/memories/synology.controller.ts b/server/src/nest/memories/synology.controller.ts
index 20cf5577f..149e27165 100644
--- a/server/src/nest/memories/synology.controller.ts
+++ b/server/src/nest/memories/synology.controller.ts
@@ -4,8 +4,8 @@ import type { User } from '../../types';
import type { ServiceResult } from './memories.helpers';
import { fail, success } from './memories.helpers';
import { MemoriesService } from './memories.service';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { SynologySearchDto, SynologySettingsDto, SynologyTestDto } from './memories.dto';
function _parseStringBodyField(value: unknown): string {
diff --git a/server/src/nest/memories/unified.controller.ts b/server/src/nest/memories/unified.controller.ts
index 99e9a3fc8..4cb98e711 100644
--- a/server/src/nest/memories/unified.controller.ts
+++ b/server/src/nest/memories/unified.controller.ts
@@ -3,8 +3,8 @@ import type { Response } from 'express';
import type { User } from '../../types';
import type { Selection } from './memories.helpers';
import { MemoriesService } from './memories.service';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { AddTripPhotosDto, CreateAlbumLinkDto, RemoveTripPhotoDto, SetTripPhotoSharingDto } from './memories.dto';
/**
diff --git a/server/src/nest/notifications/notifications.controller.ts b/server/src/nest/notifications/notifications.controller.ts
index 6af974f7a..475aa2e63 100644
--- a/server/src/nest/notifications/notifications.controller.ts
+++ b/server/src/nest/notifications/notifications.controller.ts
@@ -22,11 +22,11 @@ import {
TestNtfyDto,
NotificationRespondDto,
} from './notifications.dto';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { AdminGuard } from '../auth/admin.guard';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { AdminGuard } from '../auth-core/admin.guard';
import { NotificationPreferencesService } from './notification-preferences.service';
import { AdminNotificationPreferencesDto, NotificationDefaultsUpdateDto } from '../admin/admin.dto';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { ManagedForbidden } from '../common/managed';
// The masked placeholder the client sends instead of a stored secret (8× U+2022).
diff --git a/server/src/nest/notifications/notifications.module.ts b/server/src/nest/notifications/notifications.module.ts
index 38a3b3762..910cad844 100644
--- a/server/src/nest/notifications/notifications.module.ts
+++ b/server/src/nest/notifications/notifications.module.ts
@@ -13,7 +13,6 @@ import { PushController } from './push/push.controller';
import { PushSubscriptionsService } from './push/push-subscriptions.service';
import { VapidKeysService } from './push/vapid-keys.service';
import { MailerModule } from './mailer/mailer.module';
-import { AuthModule } from '../auth/auth.module';
import { SchedulingModule } from '../scheduling/scheduling.module';
import { StorageModule } from '../storage/storage.module';
import { Notifications } from '../../db/entities/Notifications.entity';
@@ -25,9 +24,9 @@ import { TodoItems } from '../../db/entities/TodoItems.entity';
import { PushSubscriptions } from '../../db/entities/PushSubscriptions.entity';
/** Notifications domain (L6 leaf module). Registered in AppModule.
- * AuthModule feeds NotificationsMcp's demo gate; MailerModule carries SMTP,
- * which lives outside this module so AuthService can send the password-reset
- * mail without AuthModule and NotificationsModule importing each other.
+ * MailerModule carries SMTP, which lives outside this module so AuthService
+ * can send the password-reset mail without AuthModule and NotificationsModule
+ * importing each other.
* StorageModule feeds StorageHealthNotifierService, which bridges replica
* failures into admin notifications — this direction has no cycle (Storage
* imports only AppConfig+Audit+Scheduling).
@@ -63,7 +62,7 @@ import { PushSubscriptions } from '../../db/entities/PushSubscriptions.entity';
TodoItems,
PushSubscriptions,
]),
- AuthModule,
+
MailerModule,
SchedulingModule,
StorageModule,
diff --git a/server/src/nest/notifications/push/push.controller.ts b/server/src/nest/notifications/push/push.controller.ts
index 066efe8e7..50e1f9c75 100644
--- a/server/src/nest/notifications/push/push.controller.ts
+++ b/server/src/nest/notifications/push/push.controller.ts
@@ -1,8 +1,8 @@
import { Body, Controller, Delete, Get, Headers, HttpCode, HttpException, Post, UseGuards } from '@nestjs/common';
import type { PushPublicKeyResult, PushSubscribeResult, PushUnsubscribeResult } from '@trek/shared';
import type { User } from '../../../types';
-import { CurrentUser } from '../../auth/current-user.decorator';
-import { JwtAuthGuard } from '../../auth/jwt-auth.guard';
+import { CurrentUser } from '../../auth-core/current-user.decorator';
+import { JwtAuthGuard } from '../../auth-core/jwt-auth.guard';
import { PushSubscribeDto, PushUnsubscribeDto } from '../notifications.dto';
import { checkPushSubscription } from './push-subscription.helpers';
import { PushSubscriptionsService } from './push-subscriptions.service';
diff --git a/server/src/nest/oauth/oauth-api.controller.ts b/server/src/nest/oauth/oauth-api.controller.ts
index bf5ff5a81..f3cf6e09a 100644
--- a/server/src/nest/oauth/oauth-api.controller.ts
+++ b/server/src/nest/oauth/oauth-api.controller.ts
@@ -2,10 +2,10 @@ import { Body, Controller, Delete, Get, HttpCode, HttpException, Param, Post, Qu
import type { Request, Response } from 'express';
import { OauthService } from './oauth.service';
import { RateLimitService } from '../common/rate-limit.service';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CookieAuthGuard } from '../auth/cookie-auth.guard';
-import { OptionalJwtGuard } from '../auth/optional-jwt.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CookieAuthGuard } from '../auth-core/cookie-auth.guard';
+import { OptionalJwtGuard } from '../auth-core/optional-jwt.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { getClientIp } from '../audit/client-ip';
import type { User } from '../../types';
import type { AuthorizeParams } from './oauth.service';
diff --git a/server/src/nest/oauth/oauth-public.controller.ts b/server/src/nest/oauth/oauth-public.controller.ts
index bf3921d21..9ec69e679 100644
--- a/server/src/nest/oauth/oauth-public.controller.ts
+++ b/server/src/nest/oauth/oauth-public.controller.ts
@@ -5,7 +5,7 @@ import { RateLimitService } from '../common/rate-limit.service';
import { getClientIp } from '../audit/client-ip';
import { logWarn } from '../audit/audit-log.logger';
import { AuditService } from '../audit/audit.service';
-import { Public } from '../auth/public.decorator';
+import { Public } from '../auth-core/public.decorator';
import { OAUTH_CLIENT_ALLOWED_SCOPES } from '../../db/json-columns';
import { decodeJson } from '../../utils/json-column';
diff --git a/server/src/nest/oidc/oidc.controller.ts b/server/src/nest/oidc/oidc.controller.ts
index b588a11a7..26c23c2e7 100644
--- a/server/src/nest/oidc/oidc.controller.ts
+++ b/server/src/nest/oidc/oidc.controller.ts
@@ -4,14 +4,14 @@ import { oidcLoginQuerySchema } from '@trek/shared';
import { readEnv } from '../../app-config';
import { OidcService, OIDC_STATE_TTL_MS, OIDC_AUTH_CODE_TTL_MS } from './oidc.service';
import { cookieOptions } from '../common/cookie';
-import { AdminGuard } from '../auth/admin.guard';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { AdminGuard } from '../auth-core/admin.guard';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import type { User } from '../../types';
import { AuditService } from '../audit/audit.service';
import { getClientIp } from '../audit/client-ip';
import { AdminOidcUpdateDto } from '../admin/admin.dto';
-import { Public } from '../auth/public.decorator';
+import { Public } from '../auth-core/public.decorator';
import { ManagedForbidden } from '../common/managed';
import { sessionClientFrom } from '../sessions/sessions.service';
diff --git a/server/src/nest/packing/admin-packing-templates.controller.ts b/server/src/nest/packing/admin-packing-templates.controller.ts
index b60cd8ff5..bc8d0fe59 100644
--- a/server/src/nest/packing/admin-packing-templates.controller.ts
+++ b/server/src/nest/packing/admin-packing-templates.controller.ts
@@ -2,9 +2,9 @@ import { Body, Controller, Delete, Get, HttpCode, HttpException, Param, Post, Pu
import type { Request } from 'express';
import { PackingService } from './packing.service';
import { AdminTemplateNameDto } from '../admin/admin.dto';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { AdminGuard } from '../auth/admin.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { AdminGuard } from '../auth-core/admin.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { getClientIp } from '../audit/client-ip';
import { AuditService } from '../audit/audit.service';
import type { User } from '../../types';
diff --git a/server/src/nest/packing/packing.controller.ts b/server/src/nest/packing/packing.controller.ts
index 5f815b15f..73a55217b 100644
--- a/server/src/nest/packing/packing.controller.ts
+++ b/server/src/nest/packing/packing.controller.ts
@@ -15,8 +15,8 @@ import type { TrekWsPayload, TrekWsTripEventName } from '@trek/shared';
import type { User } from '../../types';
import { PackingService, isInvalidBagRef } from './packing.service';
import { isUpdateConflict } from '../common/conflictResult';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { RequirePermission, TripAccessGuard } from '../permissions/trip-access.guard';
import { toRowId } from '../common/row-id';
import {
diff --git a/server/src/nest/photos/photos.controller.ts b/server/src/nest/photos/photos.controller.ts
index 65caf07ea..dfefa7ba8 100644
--- a/server/src/nest/photos/photos.controller.ts
+++ b/server/src/nest/photos/photos.controller.ts
@@ -2,8 +2,8 @@ import { Controller, Get, Headers, HttpException, Param, Res, UseGuards } from '
import type { Response } from 'express';
import type { User } from '../../types';
import { PhotosService } from './photos.service';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
/**
* /api/photos/:id/{thumbnail,original,info} — global (not trip-scoped) photo
diff --git a/server/src/nest/place-enrichment/place-enrichment.controller.ts b/server/src/nest/place-enrichment/place-enrichment.controller.ts
index bf54266df..4a58c49ce 100644
--- a/server/src/nest/place-enrichment/place-enrichment.controller.ts
+++ b/server/src/nest/place-enrichment/place-enrichment.controller.ts
@@ -2,8 +2,8 @@ import { Body, Controller, Get, HttpCode, HttpException, Param, Post, Req, UseGu
import type { Request } from 'express';
import type { MapsPlaceEnrichmentResult } from '@trek/shared';
import type { User } from '../../types';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { RateLimitService } from '../common/rate-limit.service';
import { PlaceEnrichmentService } from './place-enrichment.service';
import { PlaceEnrichmentDto } from './place-enrichment.dto';
diff --git a/server/src/nest/place-shadow/place-shadow.controller.ts b/server/src/nest/place-shadow/place-shadow.controller.ts
index 28ace148b..8e9c66fd9 100644
--- a/server/src/nest/place-shadow/place-shadow.controller.ts
+++ b/server/src/nest/place-shadow/place-shadow.controller.ts
@@ -4,8 +4,8 @@ import type {
PlaceShadowPickResult,
PlaceShadowSummaryResult,
} from '@trek/shared';
-import { AdminGuard } from '../auth/admin.guard';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
+import { AdminGuard } from '../auth-core/admin.guard';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
import { PlaceShadowPickDto } from './place-shadow.dto';
import { PlaceShadowService } from './place-shadow.service';
diff --git a/server/src/nest/places/places.controller.ts b/server/src/nest/places/places.controller.ts
index cef0be793..74d058f1c 100644
--- a/server/src/nest/places/places.controller.ts
+++ b/server/src/nest/places/places.controller.ts
@@ -26,8 +26,8 @@ import type { User } from '../../types';
import { PlacesService } from './places.service';
import { isDirectionsUrl } from './maps-dir.helpers';
import { isUpdateConflict } from '../common/conflictResult';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { RequirePermission, TripAccessGuard } from '../permissions/trip-access.guard';
import { PLACE_IMAGE_FILE_FILTER } from '../common/place-image-upload';
import { StorageService } from '../storage/storage.service';
diff --git a/server/src/nest/platform/discovery.controller.ts b/server/src/nest/platform/discovery.controller.ts
index 17955f9d9..0ae9f52b7 100644
--- a/server/src/nest/platform/discovery.controller.ts
+++ b/server/src/nest/platform/discovery.controller.ts
@@ -1,6 +1,6 @@
import { All, Controller, Get, NotFoundException, Req, Res } from '@nestjs/common';
import type { Request, Response } from 'express';
-import { Public } from '../auth/public.decorator';
+import { Public } from '../auth-core/public.decorator';
import { DiscoveryMetadataService } from './discovery-metadata.service';
import { AddonsService } from '../addons/addons.service';
import { ADDON_IDS } from '../../addons';
diff --git a/server/src/nest/platform/platform.routes.ts b/server/src/nest/platform/platform.routes.ts
index 4bf631e6e..d6bff5479 100644
--- a/server/src/nest/platform/platform.routes.ts
+++ b/server/src/nest/platform/platform.routes.ts
@@ -3,7 +3,7 @@ import path from 'node:path';
import type { EntityManager } from '@mikro-orm/core';
import { readEnv } from '../../app-config';
-import { verifyJwtAndLoadUser } from '../auth/jwt-verify';
+import { verifyJwtAndLoadUser } from '../auth-core/jwt-verify';
import { withRequestContext } from '../database/request-context';
import { StorageService } from '../storage/storage.service';
import { StorageInvalidKeyError, StorageNotFoundError, type StorageCategory } from '../storage/storage.types';
diff --git a/server/src/nest/plugins/contributions/atlas-layers.controller.ts b/server/src/nest/plugins/contributions/atlas-layers.controller.ts
index b3d693474..b7df5c42a 100644
--- a/server/src/nest/plugins/contributions/atlas-layers.controller.ts
+++ b/server/src/nest/plugins/contributions/atlas-layers.controller.ts
@@ -1,6 +1,6 @@
import { Controller, Get, Req, UseGuards } from '@nestjs/common';
import type { Request } from 'express';
-import { JwtAuthGuard } from '../../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../../auth-core/jwt-auth.guard';
import { pluginsEnabled } from '../kill-switch';
import { PluginHooks } from '../plugin-hooks.service';
import { stripEmoji } from '../text-sanitize';
diff --git a/server/src/nest/plugins/contributions/day-schedule.controller.ts b/server/src/nest/plugins/contributions/day-schedule.controller.ts
index b4991c9ed..f489247f5 100644
--- a/server/src/nest/plugins/contributions/day-schedule.controller.ts
+++ b/server/src/nest/plugins/contributions/day-schedule.controller.ts
@@ -5,7 +5,7 @@ import { Trips } from '../../../db/entities/Trips.entity';
import type { TripsRepository } from '../../../db/repositories/Trips.repository';
import { Days } from '../../../db/entities/Days.entity';
import type { DaysRepository } from '../../../db/repositories/Days.repository';
-import { JwtAuthGuard } from '../../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../../auth-core/jwt-auth.guard';
import { pluginsEnabled } from '../kill-switch';
import { PluginHooks } from '../plugin-hooks.service';
import { stripEmoji } from '../text-sanitize';
diff --git a/server/src/nest/plugins/contributions/day-tints.controller.ts b/server/src/nest/plugins/contributions/day-tints.controller.ts
index de0da14d8..7ed2ecbd1 100644
--- a/server/src/nest/plugins/contributions/day-tints.controller.ts
+++ b/server/src/nest/plugins/contributions/day-tints.controller.ts
@@ -5,7 +5,7 @@ import { Trips } from '../../../db/entities/Trips.entity';
import type { TripsRepository } from '../../../db/repositories/Trips.repository';
import { Days } from '../../../db/entities/Days.entity';
import type { DaysRepository } from '../../../db/repositories/Days.repository';
-import { JwtAuthGuard } from '../../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../../auth-core/jwt-auth.guard';
import { pluginsEnabled } from '../kill-switch';
import { PluginHooks } from '../plugin-hooks.service';
import { stripEmoji } from '../text-sanitize';
diff --git a/server/src/nest/plugins/contributions/journal-entry-rows.controller.ts b/server/src/nest/plugins/contributions/journal-entry-rows.controller.ts
index eaf0d2580..8594561fd 100644
--- a/server/src/nest/plugins/contributions/journal-entry-rows.controller.ts
+++ b/server/src/nest/plugins/contributions/journal-entry-rows.controller.ts
@@ -6,7 +6,7 @@ import { JourneyEntries } from '../../../db/entities/JourneyEntries.entity';
import type { JourneyEntriesRepository } from '../../../db/repositories/JourneyEntries.repository';
import { AddonsService } from '../../addons/addons.service';
import { ADDON_IDS } from '../../../addons';
-import { JwtAuthGuard } from '../../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../../auth-core/jwt-auth.guard';
import { pluginsEnabled } from '../kill-switch';
import { PluginHooks } from '../plugin-hooks.service';
import { stripEmoji } from '../text-sanitize';
diff --git a/server/src/nest/plugins/contributions/map-layers.controller.ts b/server/src/nest/plugins/contributions/map-layers.controller.ts
index 8bcfd5c9f..93ac85b74 100644
--- a/server/src/nest/plugins/contributions/map-layers.controller.ts
+++ b/server/src/nest/plugins/contributions/map-layers.controller.ts
@@ -3,7 +3,7 @@ import type { Request } from 'express';
import { InjectRepository } from '@mikro-orm/nestjs';
import { Trips } from '../../../db/entities/Trips.entity';
import type { TripsRepository } from '../../../db/repositories/Trips.repository';
-import { JwtAuthGuard } from '../../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../../auth-core/jwt-auth.guard';
import { pluginsEnabled } from '../kill-switch';
import { PluginHooks } from '../plugin-hooks.service';
import { stripEmoji } from '../text-sanitize';
diff --git a/server/src/nest/plugins/contributions/map-markers.controller.ts b/server/src/nest/plugins/contributions/map-markers.controller.ts
index 7e6eb59c0..7e0297f9f 100644
--- a/server/src/nest/plugins/contributions/map-markers.controller.ts
+++ b/server/src/nest/plugins/contributions/map-markers.controller.ts
@@ -3,7 +3,7 @@ import type { Request } from 'express';
import { InjectRepository } from '@mikro-orm/nestjs';
import { Trips } from '../../../db/entities/Trips.entity';
import type { TripsRepository } from '../../../db/repositories/Trips.repository';
-import { JwtAuthGuard } from '../../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../../auth-core/jwt-auth.guard';
import { pluginsEnabled } from '../kill-switch';
import { PluginHooks } from '../plugin-hooks.service';
import { stripEmoji } from '../text-sanitize';
diff --git a/server/src/nest/plugins/contributions/pdf-sections.controller.ts b/server/src/nest/plugins/contributions/pdf-sections.controller.ts
index ec93ae578..398a63a19 100644
--- a/server/src/nest/plugins/contributions/pdf-sections.controller.ts
+++ b/server/src/nest/plugins/contributions/pdf-sections.controller.ts
@@ -3,7 +3,7 @@ import type { Request } from 'express';
import { InjectRepository } from '@mikro-orm/nestjs';
import { Trips } from '../../../db/entities/Trips.entity';
import type { TripsRepository } from '../../../db/repositories/Trips.repository';
-import { JwtAuthGuard } from '../../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../../auth-core/jwt-auth.guard';
import { pluginsEnabled } from '../kill-switch';
import { PluginHooks } from '../plugin-hooks.service';
import { stripEmoji } from '../text-sanitize';
diff --git a/server/src/nest/plugins/contributions/place-details.controller.ts b/server/src/nest/plugins/contributions/place-details.controller.ts
index e3251cfbd..d41854fb2 100644
--- a/server/src/nest/plugins/contributions/place-details.controller.ts
+++ b/server/src/nest/plugins/contributions/place-details.controller.ts
@@ -5,7 +5,7 @@ import { Trips } from '../../../db/entities/Trips.entity';
import type { TripsRepository } from '../../../db/repositories/Trips.repository';
import { Places } from '../../../db/entities/Places.entity';
import type { PlacesRepository } from '../../../db/repositories/Places.repository';
-import { JwtAuthGuard } from '../../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../../auth-core/jwt-auth.guard';
import { pluginsEnabled } from '../kill-switch';
import { PluginHooks } from '../plugin-hooks.service';
import { stripEmoji } from '../text-sanitize';
diff --git a/server/src/nest/plugins/contributions/plugin-calendar.controller.ts b/server/src/nest/plugins/contributions/plugin-calendar.controller.ts
index e988f19b7..e601c1eb6 100644
--- a/server/src/nest/plugins/contributions/plugin-calendar.controller.ts
+++ b/server/src/nest/plugins/contributions/plugin-calendar.controller.ts
@@ -1,6 +1,6 @@
import { Controller, Get, Query, Req, UseGuards } from '@nestjs/common';
import type { Request } from 'express';
-import { JwtAuthGuard } from '../../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../../auth-core/jwt-auth.guard';
import { pluginsEnabled } from '../kill-switch';
import { PluginHooks } from '../plugin-hooks.service';
import { stripEmoji } from '../text-sanitize';
diff --git a/server/src/nest/plugins/contributions/plugin-photos.controller.ts b/server/src/nest/plugins/contributions/plugin-photos.controller.ts
index 5d0d04162..21331209f 100644
--- a/server/src/nest/plugins/contributions/plugin-photos.controller.ts
+++ b/server/src/nest/plugins/contributions/plugin-photos.controller.ts
@@ -1,6 +1,6 @@
import { Controller, Get, Query, Req, UseGuards } from '@nestjs/common';
import type { Request } from 'express';
-import { JwtAuthGuard } from '../../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../../auth-core/jwt-auth.guard';
import { pluginsEnabled } from '../kill-switch';
import { PluginHooks } from '../plugin-hooks.service';
import { stripEmoji } from '../text-sanitize';
diff --git a/server/src/nest/plugins/contributions/plugin-pois.controller.ts b/server/src/nest/plugins/contributions/plugin-pois.controller.ts
index c25dc809b..b6e2ede63 100644
--- a/server/src/nest/plugins/contributions/plugin-pois.controller.ts
+++ b/server/src/nest/plugins/contributions/plugin-pois.controller.ts
@@ -1,8 +1,8 @@
import { Controller, Get, HttpException, Query, UseGuards } from '@nestjs/common';
import { pluginPoiQuerySchema, type PluginPoiQuery, type PluginPoiResponse } from '@trek/shared';
import type { User } from '../../../types';
-import { CurrentUser } from '../../auth/current-user.decorator';
-import { JwtAuthGuard } from '../../auth/jwt-auth.guard';
+import { CurrentUser } from '../../auth-core/current-user.decorator';
+import { JwtAuthGuard } from '../../auth-core/jwt-auth.guard';
import { PluginPoisService, UNKNOWN_POI_CATEGORY } from './plugin-pois.service';
const BBOX_FIELDS: ReadonlySet<string> = new Set(['south', 'west', 'north', 'east', 'bbox']);
diff --git a/server/src/nest/plugins/contributions/plugin-routes.controller.ts b/server/src/nest/plugins/contributions/plugin-routes.controller.ts
index 1833d51de..6cfc31656 100644
--- a/server/src/nest/plugins/contributions/plugin-routes.controller.ts
+++ b/server/src/nest/plugins/contributions/plugin-routes.controller.ts
@@ -5,7 +5,7 @@ import { Trips } from '../../../db/entities/Trips.entity';
import type { TripsRepository } from '../../../db/repositories/Trips.repository';
import { Plugins } from '../../../db/entities/Plugins.entity';
import type { PluginsRepository } from '../../../db/repositories/Plugins.repository';
-import { JwtAuthGuard } from '../../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../../auth-core/jwt-auth.guard';
import { pluginsEnabled } from '../kill-switch';
import { PluginHooks } from '../plugin-hooks.service';
import { PluginRouteDto } from '../plugins.dto';
diff --git a/server/src/nest/plugins/contributions/plugin-search.controller.ts b/server/src/nest/plugins/contributions/plugin-search.controller.ts
index f7f176e74..2ec2496ff 100644
--- a/server/src/nest/plugins/contributions/plugin-search.controller.ts
+++ b/server/src/nest/plugins/contributions/plugin-search.controller.ts
@@ -1,7 +1,7 @@
import { Controller, Get, Query, Req, UseGuards } from '@nestjs/common';
import type { Request } from 'express';
import { PLUGIN_SEARCH_SUGGEST_MAX } from '@trek/shared';
-import { JwtAuthGuard } from '../../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../../auth-core/jwt-auth.guard';
import { pluginsEnabled } from '../kill-switch';
import { PluginHooks } from '../plugin-hooks.service';
import {
diff --git a/server/src/nest/plugins/contributions/trip-card-contributions.controller.ts b/server/src/nest/plugins/contributions/trip-card-contributions.controller.ts
index 175866fcf..56ffc7ad5 100644
--- a/server/src/nest/plugins/contributions/trip-card-contributions.controller.ts
+++ b/server/src/nest/plugins/contributions/trip-card-contributions.controller.ts
@@ -3,7 +3,7 @@ import type { Request } from 'express';
import { InjectRepository } from '@mikro-orm/nestjs';
import { Trips } from '../../../db/entities/Trips.entity';
import type { TripsRepository } from '../../../db/repositories/Trips.repository';
-import { JwtAuthGuard } from '../../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../../auth-core/jwt-auth.guard';
import { pluginsEnabled } from '../kill-switch';
import { PluginHooks } from '../plugin-hooks.service';
import { stripEmoji } from '../text-sanitize';
diff --git a/server/src/nest/plugins/contributions/trip-warnings.controller.ts b/server/src/nest/plugins/contributions/trip-warnings.controller.ts
index 8c1b12673..b870a9ae3 100644
--- a/server/src/nest/plugins/contributions/trip-warnings.controller.ts
+++ b/server/src/nest/plugins/contributions/trip-warnings.controller.ts
@@ -3,7 +3,7 @@ import type { Request } from 'express';
import { InjectRepository } from '@mikro-orm/nestjs';
import { Trips } from '../../../db/entities/Trips.entity';
import type { TripsRepository } from '../../../db/repositories/Trips.repository';
-import { JwtAuthGuard } from '../../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../../auth-core/jwt-auth.guard';
import { pluginsEnabled } from '../kill-switch';
import { PluginHooks } from '../plugin-hooks.service';
import { stripEmoji } from '../text-sanitize';
diff --git a/server/src/nest/plugins/contributions/view-contributions.controller.ts b/server/src/nest/plugins/contributions/view-contributions.controller.ts
index 433719693..31526cd76 100644
--- a/server/src/nest/plugins/contributions/view-contributions.controller.ts
+++ b/server/src/nest/plugins/contributions/view-contributions.controller.ts
@@ -3,7 +3,7 @@ import type { Request } from 'express';
import { InjectRepository } from '@mikro-orm/nestjs';
import { Trips } from '../../../db/entities/Trips.entity';
import type { TripsRepository } from '../../../db/repositories/Trips.repository';
-import { JwtAuthGuard } from '../../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../../auth-core/jwt-auth.guard';
import { pluginsEnabled } from '../kill-switch';
import { PluginHooks } from '../plugin-hooks.service';
import { stripEmoji } from '../text-sanitize';
diff --git a/server/src/nest/plugins/oauth/plugin-oauth.controller.ts b/server/src/nest/plugins/oauth/plugin-oauth.controller.ts
index b2d3fa020..e5627f5a9 100644
--- a/server/src/nest/plugins/oauth/plugin-oauth.controller.ts
+++ b/server/src/nest/plugins/oauth/plugin-oauth.controller.ts
@@ -1,7 +1,7 @@
import { Controller, Get, Param, Post, Query, Req, Res, UseGuards } from '@nestjs/common';
import type { Request, Response } from 'express';
import { InjectRepository } from '@mikro-orm/nestjs';
-import { JwtAuthGuard } from '../../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../../auth-core/jwt-auth.guard';
import { pluginsEnabled } from '../kill-switch';
import { PluginOAuthService } from './plugin-oauth.service';
import { Plugins } from '../../../db/entities/Plugins.entity';
diff --git a/server/src/nest/plugins/plugin-activity.controller.ts b/server/src/nest/plugins/plugin-activity.controller.ts
index 3ff673598..83f063e29 100644
--- a/server/src/nest/plugins/plugin-activity.controller.ts
+++ b/server/src/nest/plugins/plugin-activity.controller.ts
@@ -3,7 +3,7 @@ import type { Request } from 'express';
import { InjectRepository } from '@mikro-orm/nestjs';
import { PluginCapabilityAudit } from '../../db/entities/PluginCapabilityAudit.entity';
import type { PluginCapabilityAuditRepository } from '../../db/repositories/PluginCapabilityAudit.repository';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
import { pluginsEnabled } from './kill-switch';
import { readAuditForUser } from './host/plugin-audit';
diff --git a/server/src/nest/plugins/plugin-frame.controller.ts b/server/src/nest/plugins/plugin-frame.controller.ts
index 5dbbbeb11..35be2713a 100644
--- a/server/src/nest/plugins/plugin-frame.controller.ts
+++ b/server/src/nest/plugins/plugin-frame.controller.ts
@@ -5,7 +5,7 @@ import path from 'node:path';
import { pluginsEnabled } from './kill-switch';
import { PluginRuntimeService } from './plugin-runtime.service';
import { pluginCodeDir } from './paths';
-import { Public } from '../auth/public.decorator';
+import { Public } from '../auth-core/public.decorator';
/**
* Serves a page/widget plugin's static client from /plugin-frame/:id/* (#plugins,
diff --git a/server/src/nest/plugins/plugin-user-settings.controller.ts b/server/src/nest/plugins/plugin-user-settings.controller.ts
index cebd62d22..87622e173 100644
--- a/server/src/nest/plugins/plugin-user-settings.controller.ts
+++ b/server/src/nest/plugins/plugin-user-settings.controller.ts
@@ -1,7 +1,7 @@
import { Body, Controller, Get, HttpCode, HttpException, Param, Post, Req, UseGuards } from '@nestjs/common';
import type { Request } from 'express';
import { InjectRepository } from '@mikro-orm/nestjs';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
import { pluginsEnabled } from './kill-switch';
import { PluginsService, MissingRequiredSettingError } from './plugins.service';
import { PluginRuntimeService } from './plugin-runtime.service';
diff --git a/server/src/nest/plugins/plugins-feed.controller.ts b/server/src/nest/plugins/plugins-feed.controller.ts
index 9ab86bc7a..72b2d0f63 100644
--- a/server/src/nest/plugins/plugins-feed.controller.ts
+++ b/server/src/nest/plugins/plugins-feed.controller.ts
@@ -3,7 +3,7 @@ import { InjectRepository } from '@mikro-orm/nestjs';
import type { PluginPoiCategory } from '@trek/shared';
import { Plugins } from '../../db/entities/Plugins.entity';
import type { PluginsRepository } from '../../db/repositories/Plugins.repository';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
import { pluginsEnabled } from './kill-switch';
import { POI_CATEGORY_PERMISSION, poiCategoriesOf } from './poi-categories';
diff --git a/server/src/nest/plugins/plugins-proxy.controller.ts b/server/src/nest/plugins/plugins-proxy.controller.ts
index 4d5746c60..c63bc9d86 100644
--- a/server/src/nest/plugins/plugins-proxy.controller.ts
+++ b/server/src/nest/plugins/plugins-proxy.controller.ts
@@ -1,10 +1,10 @@
import { All, Controller, Param, Req, Res } from '@nestjs/common';
import { EntityManager } from '@mikro-orm/core';
import type { Request, Response } from 'express';
-import { extractToken, verifyJwtAndLoadUser } from '../auth/jwt-verify';
+import { extractToken, verifyJwtAndLoadUser } from '../auth-core/jwt-verify';
import { pluginsEnabled } from './kill-switch';
import { PluginRuntimeService } from './plugin-runtime.service';
-import { Public } from '../auth/public.decorator';
+import { Public } from '../auth-core/public.decorator';
import { Users } from '../../db/entities/Users.entity';
import { UserSessions } from '../../db/entities/UserSessions.entity';
diff --git a/server/src/nest/plugins/plugins.controller.ts b/server/src/nest/plugins/plugins.controller.ts
index 74bcb8011..1d86fffc4 100644
--- a/server/src/nest/plugins/plugins.controller.ts
+++ b/server/src/nest/plugins/plugins.controller.ts
@@ -5,9 +5,9 @@ import { PluginsService, MissingRequiredSettingError } from './plugins.service';
import { PluginRuntimeService, PluginConsentRequired, PluginDependencyError } from './plugin-runtime.service';
import { DependencyCycleError } from './dependencies';
import { PluginRegistryService, RegistryError } from './registry/registry.service';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { AdminGuard } from '../auth/admin.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { AdminGuard } from '../auth-core/admin.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { getClientIp } from '../audit/client-ip';
import { pluginsEnabled } from './kill-switch';
import { devLinkEnabled } from './dev-link';
diff --git a/server/src/nest/realtime/realtime-gateway.module.ts b/server/src/nest/realtime/realtime-gateway.module.ts
index 637925471..9681b7511 100644
--- a/server/src/nest/realtime/realtime-gateway.module.ts
+++ b/server/src/nest/realtime/realtime-gateway.module.ts
@@ -1,7 +1,7 @@
import { Module, type OnModuleDestroy } from '@nestjs/common';
import { MikroOrmModule } from '@mikro-orm/nestjs';
import { RealtimeGateway } from './realtime.gateway';
-import { EphemeralTokenModule } from '../auth/ephemeral-token.module';
+import { EphemeralTokenModule } from '../auth-core/ephemeral-token.module';
import { JourneyDomainModule } from '../journey/journey-domain.module';
import { AppSettings } from '../../db/entities/AppSettings.entity';
import { Users } from '../../db/entities/Users.entity';
diff --git a/server/src/nest/realtime/realtime.gateway.ts b/server/src/nest/realtime/realtime.gateway.ts
index 6784b5748..0b2dde53f 100644
--- a/server/src/nest/realtime/realtime.gateway.ts
+++ b/server/src/nest/realtime/realtime.gateway.ts
@@ -11,7 +11,7 @@ import {
import type { IncomingMessage } from 'node:http';
import type { WebSocketServer } from 'ws';
import { InjectRepository } from '@mikro-orm/nestjs';
-import { EphemeralTokenService } from '../auth/ephemeral-token.service';
+import { EphemeralTokenService } from '../auth-core/ephemeral-token.service';
import { AppSettings } from '../../db/entities/AppSettings.entity';
import type { AppSettingsRepository } from '../../db/repositories/AppSettings.repository';
import { Users } from '../../db/entities/Users.entity';
diff --git a/server/src/nest/receipt-scan/receipt-scan.controller.ts b/server/src/nest/receipt-scan/receipt-scan.controller.ts
index 923586e09..3849ec653 100644
--- a/server/src/nest/receipt-scan/receipt-scan.controller.ts
+++ b/server/src/nest/receipt-scan/receipt-scan.controller.ts
@@ -6,8 +6,8 @@ import type { ReceiptScanStartResponse } from '@trek/shared';
import type { User } from '../../types';
import { ADDON_IDS } from '../../addons';
import { AddonsService } from '../addons/addons.service';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { Trips } from '../../db/entities/Trips.entity';
import type { TripsRepository } from '../../db/repositories/Trips.repository';
import { PermissionsService } from '../permissions/permissions.service';
diff --git a/server/src/nest/reservation-import/reservation-import.controller.ts b/server/src/nest/reservation-import/reservation-import.controller.ts
index d84fa2a68..4de49c3f5 100644
--- a/server/src/nest/reservation-import/reservation-import.controller.ts
+++ b/server/src/nest/reservation-import/reservation-import.controller.ts
@@ -13,8 +13,8 @@ import {
import { FilesInterceptor } from '@nestjs/platform-express';
import { memoryStorage } from 'multer';
import type { User } from '../../types';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { RequirePermission, TripAccessGuard } from '../permissions/trip-access.guard';
import { AddonGuard } from '../addons/addon.guard';
import { RequireAddon } from '../addons/require-addon.decorator';
diff --git a/server/src/nest/reservations/reservations.controller.ts b/server/src/nest/reservations/reservations.controller.ts
index bf4aefc82..b3d2e400b 100644
--- a/server/src/nest/reservations/reservations.controller.ts
+++ b/server/src/nest/reservations/reservations.controller.ts
@@ -12,8 +12,8 @@ import {
} from '@nestjs/common';
import type { User } from '../../types';
import { ReservationsService } from './reservations.service';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { RequirePermission, TripAccessGuard } from '../permissions/trip-access.guard';
import { AirtrailLinkService } from '../integrations/airtrail-link.service';
import {
diff --git a/server/src/nest/reservations/upcoming-reservations.controller.ts b/server/src/nest/reservations/upcoming-reservations.controller.ts
index 8623f5472..5957a495a 100644
--- a/server/src/nest/reservations/upcoming-reservations.controller.ts
+++ b/server/src/nest/reservations/upcoming-reservations.controller.ts
@@ -1,8 +1,8 @@
import { Controller, Get, UseGuards } from '@nestjs/common';
import type { User } from '../../types';
import { ReservationsService } from './reservations.service';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
/**
* GET /api/reservations/upcoming — the cross-trip "upcoming reservations" feed
diff --git a/server/src/nest/roadtrip/charging-lookup.controller.ts b/server/src/nest/roadtrip/charging-lookup.controller.ts
index da59f02cd..a759f6ae6 100644
--- a/server/src/nest/roadtrip/charging-lookup.controller.ts
+++ b/server/src/nest/roadtrip/charging-lookup.controller.ts
@@ -4,7 +4,7 @@ import { createZodDto } from 'nestjs-zod';
import { ADDON_IDS } from '../../addons';
import { AddonGuard } from '../addons/addon.guard';
import { RequireAddon } from '../addons/require-addon.decorator';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
import { TripAccessGuard } from '../permissions/trip-access.guard';
import { ChargingService } from './charging.service';
diff --git a/server/src/nest/roadtrip/charging.controller.ts b/server/src/nest/roadtrip/charging.controller.ts
index fce48f220..541164421 100644
--- a/server/src/nest/roadtrip/charging.controller.ts
+++ b/server/src/nest/roadtrip/charging.controller.ts
@@ -2,7 +2,7 @@ import { Controller, Get, Param, ParseIntPipe, UseGuards } from '@nestjs/common'
import { ADDON_IDS } from '../../addons';
import { AddonGuard } from '../addons/addon.guard';
import { RequireAddon } from '../addons/require-addon.decorator';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
import { TripAccessGuard } from '../permissions/trip-access.guard';
import { ChargingService } from './charging.service';
diff --git a/server/src/nest/roadtrip/day-boundaries.controller.ts b/server/src/nest/roadtrip/day-boundaries.controller.ts
index fff30d746..4edff4f67 100644
--- a/server/src/nest/roadtrip/day-boundaries.controller.ts
+++ b/server/src/nest/roadtrip/day-boundaries.controller.ts
@@ -4,7 +4,7 @@ import { roadtripDayBoundarySchema } from '@trek/shared';
import { ADDON_IDS } from '../../addons';
import { RequireAddon } from '../addons/require-addon.decorator';
import { AddonGuard } from '../addons/addon.guard';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
import { RequirePermission, TripAccessGuard } from '../permissions/trip-access.guard';
import { RealtimeService } from '../realtime/realtime.service';
import { DayBoundariesService } from './day-boundaries.service';
diff --git a/server/src/nest/roadtrip/google-route.controller.ts b/server/src/nest/roadtrip/google-route.controller.ts
index 8a86ff3bb..b386f25ce 100644
--- a/server/src/nest/roadtrip/google-route.controller.ts
+++ b/server/src/nest/roadtrip/google-route.controller.ts
@@ -5,7 +5,7 @@ import { googleRouteImportSchema, googleRoutePreviewRequestSchema } from '@trek/
import { ADDON_IDS } from '../../addons';
import { AddonGuard } from '../addons/addon.guard';
import { RequireAddon } from '../addons/require-addon.decorator';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
import { TripAccessGuard } from '../permissions/trip-access.guard';
import { GoogleRouteService } from './google-route.service';
diff --git a/server/src/nest/roadtrip/roadtrip-hazards.controller.ts b/server/src/nest/roadtrip/roadtrip-hazards.controller.ts
index 183b29b87..21b14692b 100644
--- a/server/src/nest/roadtrip/roadtrip-hazards.controller.ts
+++ b/server/src/nest/roadtrip/roadtrip-hazards.controller.ts
@@ -2,7 +2,7 @@ import { Controller, Get, UseGuards } from '@nestjs/common';
import { ADDON_IDS } from '../../addons';
import { AddonGuard } from '../addons/addon.guard';
import { RequireAddon } from '../addons/require-addon.decorator';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
import { TripAccessGuard } from '../permissions/trip-access.guard';
import { RoadtripHazardsService } from './roadtrip-hazards.service';
diff --git a/server/src/nest/roadtrip/roadtrip-preferences.controller.ts b/server/src/nest/roadtrip/roadtrip-preferences.controller.ts
index 433b92851..74056d2e9 100644
--- a/server/src/nest/roadtrip/roadtrip-preferences.controller.ts
+++ b/server/src/nest/roadtrip/roadtrip-preferences.controller.ts
@@ -1,7 +1,7 @@
import { ADDON_IDS } from '../../addons';
import { AddonGuard } from '../addons/addon.guard';
import { RequireAddon } from '../addons/require-addon.decorator';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
import { RequirePermission, TripAccessGuard } from '../permissions/trip-access.guard';
import { RoadtripPreferencesService } from './roadtrip-preferences.service';
import { Body, Controller, Get, Headers, Param, Put, UseGuards } from '@nestjs/common';
diff --git a/server/src/nest/roadtrip/roadtrip-search.controller.ts b/server/src/nest/roadtrip/roadtrip-search.controller.ts
index f2dab890c..755d28394 100644
--- a/server/src/nest/roadtrip/roadtrip-search.controller.ts
+++ b/server/src/nest/roadtrip/roadtrip-search.controller.ts
@@ -5,7 +5,7 @@ import { createZodDto } from 'nestjs-zod';
import { ADDON_IDS } from '../../addons';
import { AddonGuard } from '../addons/addon.guard';
import { RequireAddon } from '../addons/require-addon.decorator';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
import { RoadtripSearchService } from './roadtrip-search.service';
export class SearchAreaDto extends createZodDto(roadtripSearchAreaSchema) {}
diff --git a/server/src/nest/roadtrip/roadtrip.controller.ts b/server/src/nest/roadtrip/roadtrip.controller.ts
index 141d98e99..c8c692ab0 100644
--- a/server/src/nest/roadtrip/roadtrip.controller.ts
+++ b/server/src/nest/roadtrip/roadtrip.controller.ts
@@ -2,7 +2,7 @@ import { Body, Controller, Delete, Get, Headers, HttpCode, HttpException, Param,
import type { RoadtripDayTrack, RoadtripVia } from '@trek/shared';
import { RoadtripService } from './roadtrip.service';
import { RoadtripViaBatchDto, RoadtripViaCreateDto, RoadtripViaReanchorDto, RoadtripViaUpdateDto } from './roadtrip.dto';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
import { RequirePermission, TripAccessGuard } from '../permissions/trip-access.guard';
import { RequireAddon } from '../addons/require-addon.decorator';
import { AddonGuard } from '../addons/addon.guard';
diff --git a/server/src/nest/route-usage/route-usage.controller.ts b/server/src/nest/route-usage/route-usage.controller.ts
index 6f1879fad..5147041f5 100644
--- a/server/src/nest/route-usage/route-usage.controller.ts
+++ b/server/src/nest/route-usage/route-usage.controller.ts
@@ -1,7 +1,7 @@
import { Body, Controller, Delete, Get, HttpCode, Post, UseGuards } from '@nestjs/common';
import type { RouteUsageReportResult, RouteUsageSummaryResult } from '@trek/shared';
-import { AdminGuard } from '../auth/admin.guard';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
+import { AdminGuard } from '../auth-core/admin.guard';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
import { RouteUsageReportDto } from './route-usage.dto';
import { RouteUsageService } from './route-usage.service';
diff --git a/server/src/nest/school-holidays/school-holidays.controller.ts b/server/src/nest/school-holidays/school-holidays.controller.ts
index 0706d8723..a83232770 100644
--- a/server/src/nest/school-holidays/school-holidays.controller.ts
+++ b/server/src/nest/school-holidays/school-holidays.controller.ts
@@ -1,8 +1,8 @@
import { Body, Controller, Delete, Get, Param, ParseIntPipe, Post, Put, Query, UseGuards, BadRequestException } from '@nestjs/common';
import { createZodDto } from 'nestjs-zod';
import { schoolHolidayCountryRequestSchema, schoolHolidayRegionRequestSchema } from '@trek/shared';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { AdminGuard } from '../auth/admin.guard';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { AdminGuard } from '../auth-core/admin.guard';
import { SchoolHolidaysService } from './school-holidays.service';
export class SchoolHolidayCountryDto extends createZodDto(schoolHolidayCountryRequestSchema) {}
diff --git a/server/src/nest/sessions/sessions.service.ts b/server/src/nest/sessions/sessions.service.ts
index c8f1d0312..3841f1140 100644
--- a/server/src/nest/sessions/sessions.service.ts
+++ b/server/src/nest/sessions/sessions.service.ts
@@ -53,7 +53,7 @@ export function sessionClientFrom(req: Pick<Request, 'headers'>): SessionClient
* Session tokens and the `user_sessions` rows behind them.
*
* Every token issued here carries a random `jti` naming its row, and
- * `verifyJwtAndLoadUser` (auth/jwt-verify.ts) refuses a token whose row is
+ * `verifyJwtAndLoadUser` (auth-core/jwt-verify.ts) refuses a token whose row is
* revoked, expired or gone. That is what lets a logout end the token instead
* of only clearing the cookie, and lets a user sign out a device. A token
* without a `jti` was issued before sessions were tracked: it is never looked
@@ -146,7 +146,7 @@ export class SessionsService {
/**
* The active session a token names, for the session check in
- * `verifyJwtAndLoadUser` (auth/jwt-verify.ts, its `SessionLookup`): null
+ * `verifyJwtAndLoadUser` (auth-core/jwt-verify.ts, its `SessionLookup`): null
* when it is revoked, expired, gone or another user's.
*/
async findActive(id: string, userId: number, now: string): Promise<{ id: string; last_seen_at: string } | null> {
diff --git a/server/src/nest/settings/settings.controller.ts b/server/src/nest/settings/settings.controller.ts
index 10a314a66..90c664c02 100644
--- a/server/src/nest/settings/settings.controller.ts
+++ b/server/src/nest/settings/settings.controller.ts
@@ -5,11 +5,11 @@ import type { User } from '../../types';
import { SettingsService, isAdminOnlyEndpointSetting } from './settings.service';
import { SettingUpsertDto, SettingsBulkDto } from './settings.dto';
import { AdminDefaultUserSettingsDto } from '../admin/admin.dto';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { AdminGuard } from '../auth/admin.guard';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { AdminGuard } from '../auth-core/admin.guard';
import { AuditService } from '../audit/audit.service';
import { getClientIp } from '../audit/client-ip';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { RuntimeEnvService } from '../app-config/runtime-env.service';
import { isManagedLockedKey, splitManagedKeys } from '../common/managed';
diff --git a/server/src/nest/share/share.controller.ts b/server/src/nest/share/share.controller.ts
index 73eed80d5..c05d48cfd 100644
--- a/server/src/nest/share/share.controller.ts
+++ b/server/src/nest/share/share.controller.ts
@@ -7,9 +7,9 @@ import { ShareService } from './share.service';
import { StorageService } from '../storage/storage.service';
import { isClientAbortError } from '../storage/storage.types';
import { ShareLinkDto } from './share.dto';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
-import { Public } from '../auth/public.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
+import { Public } from '../auth-core/public.decorator';
/**
* /api/trips/:tripId/share-link — manage a trip's public read-only share token.
diff --git a/server/src/nest/storage/storage-admin.controller.ts b/server/src/nest/storage/storage-admin.controller.ts
index 89640ac0d..2f144c95b 100644
--- a/server/src/nest/storage/storage-admin.controller.ts
+++ b/server/src/nest/storage/storage-admin.controller.ts
@@ -3,9 +3,9 @@ import type { Request } from 'express';
import type { StorageUsage } from '@trek/shared';
import { redactStorageSecrets } from './storage-secrets';
import type { User } from '../../types';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { AdminGuard } from '../auth/admin.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { AdminGuard } from '../auth-core/admin.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { AuditService } from '../audit/audit.service';
import { getClientIp } from '../audit/client-ip';
import { ManagedForbidden } from '../common/managed';
diff --git a/server/src/nest/system-notices/system-notices.controller.ts b/server/src/nest/system-notices/system-notices.controller.ts
index 9c5d70017..a7b70f3e1 100644
--- a/server/src/nest/system-notices/system-notices.controller.ts
+++ b/server/src/nest/system-notices/system-notices.controller.ts
@@ -2,8 +2,8 @@ import { Controller, Get, HttpCode, HttpException, Param, Post, Query, UseGuards
import type { SystemNoticeDto } from '@trek/shared';
import type { User } from '../../types';
import { SystemNoticesService } from './system-notices.service';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
/**
* `?supports=release` names the layouts the calling bundle can draw, comma separated,
diff --git a/server/src/nest/tags/tags.controller.ts b/server/src/nest/tags/tags.controller.ts
index e755691d6..5dcfabe18 100644
--- a/server/src/nest/tags/tags.controller.ts
+++ b/server/src/nest/tags/tags.controller.ts
@@ -2,8 +2,8 @@ import { Body, Controller, Delete, Get, HttpException, Param, Post, Put, UseGuar
import type { Tag, TagListResponse } from '@trek/shared';
import type { User } from '../../types';
import { TagsService } from './tags.service';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { TagCreateDto, TagUpdateDto } from './tags.dto';
/**
diff --git a/server/src/nest/todo/todo.controller.ts b/server/src/nest/todo/todo.controller.ts
index eb410304d..4c7216fe7 100644
--- a/server/src/nest/todo/todo.controller.ts
+++ b/server/src/nest/todo/todo.controller.ts
@@ -13,8 +13,8 @@ import {
import type { User } from '../../types';
import { TodoService } from './todo.service';
import { TodoCreateItemDto, TodoUpdateItemDto, TodoReorderDto, TodoCategoryAssigneesDto } from './todo.dto';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { RequirePermission, TripAccessGuard } from '../permissions/trip-access.guard';
import { toRowId } from '../common/row-id';
diff --git a/server/src/nest/tokens/token.service.ts b/server/src/nest/tokens/token.service.ts
index efd66ea6f..fa5d5e214 100644
--- a/server/src/nest/tokens/token.service.ts
+++ b/server/src/nest/tokens/token.service.ts
@@ -10,7 +10,7 @@ import { McpTokens } from '../../db/entities/McpTokens.entity';
import type { McpTokensRepository, McpTokenBasicRow } from '../../db/repositories/McpTokens.repository';
import { Users } from '../../db/entities/Users.entity';
import type { UsersRepository } from '../../db/repositories/Users.repository';
-import { EphemeralTokenService } from '../auth/ephemeral-token.service';
+import { EphemeralTokenService } from '../auth-core/ephemeral-token.service';
import { toRowId } from '../common/row-id';
// Import from sessionManager directly, NOT the ../../mcp barrel: the barrel pulls
// the whole tools fan-out (and via the domain bridges, the Nest services) into
diff --git a/server/src/nest/tokens/tokens.module.ts b/server/src/nest/tokens/tokens.module.ts
index 470693939..01b157198 100644
--- a/server/src/nest/tokens/tokens.module.ts
+++ b/server/src/nest/tokens/tokens.module.ts
@@ -3,7 +3,7 @@ import { MikroOrmModule } from '@mikro-orm/nestjs';
import { McpTokens } from '../../db/entities/McpTokens.entity';
import { Users } from '../../db/entities/Users.entity';
import { TokenService } from './token.service';
-import { EphemeralTokenModule } from '../auth/ephemeral-token.module';
+import { EphemeralTokenModule } from '../auth-core/ephemeral-token.module';
/**
* Tokens that are not the login JWT: the long-lived MCP tokens a user manages
diff --git a/server/src/nest/tours/tours-import.controller.ts b/server/src/nest/tours/tours-import.controller.ts
index 6e9642c4b..7a8e7a9d3 100644
--- a/server/src/nest/tours/tours-import.controller.ts
+++ b/server/src/nest/tours/tours-import.controller.ts
@@ -4,8 +4,8 @@ import { memoryStorage } from 'multer';
import type { User } from '../../types';
import { ADDON_IDS } from '../../addons';
import { AddonsService } from '../addons/addons.service';
-import { CurrentUser } from '../auth/current-user.decorator';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
import { PlacesService } from '../places/places.service';
import { ToursService } from './tours.service';
diff --git a/server/src/nest/tours/tours.controller.ts b/server/src/nest/tours/tours.controller.ts
index a72f06e52..197f9c6a0 100644
--- a/server/src/nest/tours/tours.controller.ts
+++ b/server/src/nest/tours/tours.controller.ts
@@ -1,6 +1,6 @@
import { Body, Controller, Get, Headers, Param, Post, Put, UseGuards } from '@nestjs/common';
import { ToursService } from './tours.service';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
import { RequirePermission, TripAccessGuard } from '../permissions/trip-access.guard';
import { AddonGuard } from '../addons/addon.guard';
import { RequireAddon } from '../addons/require-addon.decorator';
diff --git a/server/src/nest/transit/transit.controller.ts b/server/src/nest/transit/transit.controller.ts
index 981ce71ba..e5b9e9c25 100644
--- a/server/src/nest/transit/transit.controller.ts
+++ b/server/src/nest/transit/transit.controller.ts
@@ -1,7 +1,7 @@
import { Controller, Get, HttpException, Query, Req, UseGuards } from '@nestjs/common';
import type { Request } from 'express';
-import { CurrentUser } from '../auth/current-user.decorator';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
import { RateLimitService } from '../common/rate-limit.service';
import { TransitService } from './transit.service';
import type { User } from '../../types';
diff --git a/server/src/nest/trip-invite/trip-invite.controller.ts b/server/src/nest/trip-invite/trip-invite.controller.ts
index 2a7b8e801..d5ce9d246 100644
--- a/server/src/nest/trip-invite/trip-invite.controller.ts
+++ b/server/src/nest/trip-invite/trip-invite.controller.ts
@@ -2,8 +2,8 @@ import { Body, Controller, Delete, Get, HttpCode, HttpException, Param, Post, Re
import type { Request } from 'express';
import type { User } from '../../types';
import { TripInviteService } from './trip-invite.service';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { RateLimitService } from '../common/rate-limit.service';
import { TripInviteLinkCreateDto } from './trip-invite.dto';
import { getClientIp } from '../audit/client-ip';
diff --git a/server/src/nest/trip-members/trip-members.controller.ts b/server/src/nest/trip-members/trip-members.controller.ts
index d99f9b157..5e6867943 100644
--- a/server/src/nest/trip-members/trip-members.controller.ts
+++ b/server/src/nest/trip-members/trip-members.controller.ts
@@ -15,8 +15,8 @@ import {
import type { Request } from 'express';
import type { User } from '../../types';
import { TripMembersService } from './trip-members.service';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { RequireTripOwner, TripOwnerGuard } from '../permissions/trip-owner.guard';
import { getClientIp } from '../audit/client-ip';
import { AuditService } from '../audit/audit.service';
diff --git a/server/src/nest/trips/trips.controller.ts b/server/src/nest/trips/trips.controller.ts
index b91c4c982..2fba2db01 100644
--- a/server/src/nest/trips/trips.controller.ts
+++ b/server/src/nest/trips/trips.controller.ts
@@ -27,8 +27,8 @@ import { MAX_TRIP_DAYS, type ActiveTripResponse, type TripSearchResponse } from
import { StorageService } from '../storage/storage.service';
import type { User } from '../../types';
import { TripsService } from './trips.service';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
import { getClientIp } from '../audit/client-ip';
import { logInfo } from '../audit/audit-log.logger';
import { AuditService } from '../audit/audit.service';
diff --git a/server/src/nest/vacay/vacay.controller.ts b/server/src/nest/vacay/vacay.controller.ts
index 9af8a1910..9e21fcd2c 100644
--- a/server/src/nest/vacay/vacay.controller.ts
+++ b/server/src/nest/vacay/vacay.controller.ts
@@ -29,8 +29,8 @@ import {
VacayUpdateStatsDto,
VacayYearSettingsDto,
} from './vacay.dto';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
-import { CurrentUser } from '../auth/current-user.decorator';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
+import { CurrentUser } from '../auth-core/current-user.decorator';
/**
* /api/addons/vacay — shared vacation-day planner.
diff --git a/server/src/nest/weather/weather.controller.ts b/server/src/nest/weather/weather.controller.ts
index fe07451f1..adc2be33a 100644
--- a/server/src/nest/weather/weather.controller.ts
+++ b/server/src/nest/weather/weather.controller.ts
@@ -1,7 +1,7 @@
import { Controller, Get, HttpException, Query, UseGuards } from '@nestjs/common';
import type { WeatherResult } from '@trek/shared';
import { WeatherService } from './weather.service';
-import { JwtAuthGuard } from '../auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../auth-core/jwt-auth.guard';
import { ApiError } from './weather.impl';
/**
diff --git a/server/tests/helpers/mcp-test-controllers.ts b/server/tests/helpers/mcp-test-controllers.ts
index e21b39c3f..ce465bfcb 100644
--- a/server/tests/helpers/mcp-test-controllers.ts
+++ b/server/tests/helpers/mcp-test-controllers.ts
@@ -95,7 +95,7 @@ import { RoadtripPreferencesMcp } from '../../src/nest/roadtrip/roadtrip-prefere
import { RoadtripPreferencesService } from '../../src/nest/roadtrip/roadtrip-preferences.service';
import { RoadtripService } from '../../src/nest/roadtrip/roadtrip.service';
import { notificationsStub } from './notifications';
-import { EphemeralTokenService } from '../../src/nest/auth/ephemeral-token.service';
+import { EphemeralTokenService } from '../../src/nest/auth-core/ephemeral-token.service';
import { AllowedFileTypesService } from '../../src/nest/files/allowed-file-types.service';
import { MemoriesMcp } from '../../src/nest/memories/memories.mcp';
import { ImmichService } from '../../src/nest/memories/immich.service';
diff --git a/server/tests/helpers/plugin-host.ts b/server/tests/helpers/plugin-host.ts
index b4e1573e0..f930402e6 100644
--- a/server/tests/helpers/plugin-host.ts
+++ b/server/tests/helpers/plugin-host.ts
@@ -67,7 +67,7 @@ import { DemoService } from '../../src/nest/common/demo.service';
import { CollectionsRpc } from '../../src/nest/collections/collections.rpc';
import { makeNotificationsService } from './notifications';
import { notificationsStub } from './notifications';
-import { EphemeralTokenService } from '../../src/nest/auth/ephemeral-token.service';
+import { EphemeralTokenService } from '../../src/nest/auth-core/ephemeral-token.service';
import { UserCleanupService } from '../../src/nest/auth/user-cleanup.service';
import { UnsplashService } from '../../src/nest/unsplash/unsplash.service';
import { PlacePhotoCacheService } from '../../src/nest/place-photos/place-photo-cache.service';
diff --git a/server/tests/unit/demo/demo-reset-sessions.test.ts b/server/tests/unit/demo/demo-reset-sessions.test.ts
index b09b8fe13..687e38a95 100644
--- a/server/tests/unit/demo/demo-reset-sessions.test.ts
+++ b/server/tests/unit/demo/demo-reset-sessions.test.ts
@@ -23,7 +23,7 @@ import { withRequestContext } from '../../../src/nest/database/request-context';
import type { DatabaseBackupStrategy } from '../../../src/nest/database/database-backup.interface';
import { resetDemoUser } from '../../../src/demo/demo-reset';
import { SessionsService } from '../../../src/nest/sessions/sessions.service';
-import { verifyJwtAndLoadUser } from '../../../src/nest/auth/jwt-verify';
+import { verifyJwtAndLoadUser } from '../../../src/nest/auth-core/jwt-verify';
import { Users } from '../../../src/db/entities/Users.entity';
import { UserSessions } from '../../../src/db/entities/UserSessions.entity';
diff --git a/server/tests/unit/nest/admin.service.test.ts b/server/tests/unit/nest/admin.service.test.ts
index a3f7c5287..43a8e7133 100644
--- a/server/tests/unit/nest/admin.service.test.ts
+++ b/server/tests/unit/nest/admin.service.test.ts
@@ -81,7 +81,7 @@ import type { CronRegistrarService } from '../../../src/nest/scheduling/cron-reg
import type { RuntimeEnvService } from '../../../src/nest/app-config/runtime-env.service';
import { __clearVersionCacheForTests } from '../../../src/nest/admin/admin.helpers';
import { makeNotificationsService, makeNotificationPreferencesService } from '../../helpers/notifications';
-import { EphemeralTokenService } from '../../../src/nest/auth/ephemeral-token.service';
+import { EphemeralTokenService } from '../../../src/nest/auth-core/ephemeral-token.service';
import { AllowedFileTypesService } from '../../../src/nest/files/allowed-file-types.service';
import {
createTestUnitOfWork,
diff --git a/server/tests/unit/nest/admin.version-notification.test.ts b/server/tests/unit/nest/admin.version-notification.test.ts
index 2668d2a25..d601f30b0 100644
--- a/server/tests/unit/nest/admin.version-notification.test.ts
+++ b/server/tests/unit/nest/admin.version-notification.test.ts
@@ -56,7 +56,7 @@ import { NotificationsService } from '../../../src/nest/notifications/notificati
import { AdminService } from '../../../src/nest/admin/admin.service';
import { DataPathsService } from '../../../src/nest/app-config/data-paths.service';
import { makeNotificationsService, makeNotificationPreferencesService } from '../../helpers/notifications';
-import { EphemeralTokenService } from '../../../src/nest/auth/ephemeral-token.service';
+import { EphemeralTokenService } from '../../../src/nest/auth-core/ephemeral-token.service';
import { AllowedFileTypesService } from '../../../src/nest/files/allowed-file-types.service';
import {
createTestUnitOfWork,
diff --git a/server/tests/unit/nest/atlas.controller.test.ts b/server/tests/unit/nest/atlas.controller.test.ts
index 6d6e53aac..cefcaa89d 100644
--- a/server/tests/unit/nest/atlas.controller.test.ts
+++ b/server/tests/unit/nest/atlas.controller.test.ts
@@ -3,7 +3,7 @@ import { HttpException, RequestMethod } from '@nestjs/common';
import type { Response } from 'express';
import { AtlasController } from '../../../src/nest/atlas/atlas.controller';
import { TravelStatsController } from '../../../src/nest/atlas/travel-stats.controller';
-import { JwtAuthGuard } from '../../../src/nest/auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../../../src/nest/auth-core/jwt-auth.guard';
import { BucketItemExistsError } from '../../../src/nest/atlas/atlas.service';
import type { AtlasService } from '../../../src/nest/atlas/atlas.service';
import type { User } from '../../../src/types';
diff --git a/server/tests/unit/nest/auth-guard.test.ts b/server/tests/unit/nest/auth-core/auth-guard.test.ts
similarity index 89%
rename from server/tests/unit/nest/auth-guard.test.ts
rename to server/tests/unit/nest/auth-core/auth-guard.test.ts
index 0748465b3..3d89b7cf9 100644
--- a/server/tests/unit/nest/auth-guard.test.ts
+++ b/server/tests/unit/nest/auth-core/auth-guard.test.ts
@@ -2,19 +2,19 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';
import { HttpException } from '@nestjs/common';
import type { Request } from 'express';
-vi.mock('../../../src/nest/auth/jwt-verify', () => ({ extractToken: vi.fn(), verifyJwtAndLoadUser: vi.fn() }));
-vi.mock('../../../src/nest/common/cookie', () => ({ setAuthCookie: vi.fn() }));
-vi.mock('../../../src/nest/audit/client-ip', () => ({ getClientIp: vi.fn(() => '1.2.3.4') }));
-vi.mock('../../../src/nest/audit/audit-log.logger', () => ({ LOG_LEVEL: 'error', logInfo: vi.fn(), logDebug: vi.fn(), logError: vi.fn(), logWarn: vi.fn() }));
+vi.mock('../../../../src/nest/auth-core/jwt-verify', () => ({ extractToken: vi.fn(), verifyJwtAndLoadUser: vi.fn() }));
+vi.mock('../../../../src/nest/common/cookie', () => ({ setAuthCookie: vi.fn() }));
+vi.mock('../../../../src/nest/audit/client-ip', () => ({ getClientIp: vi.fn(() => '1.2.3.4') }));
+vi.mock('../../../../src/nest/audit/audit-log.logger', () => ({ LOG_LEVEL: 'error', logInfo: vi.fn(), logDebug: vi.fn(), logError: vi.fn(), logWarn: vi.fn() }));
import type { EntityManager } from '@mikro-orm/core';
-import { JwtAuthGuard } from '../../../src/nest/auth/jwt-auth.guard';
-import { CookieAuthGuard } from '../../../src/nest/auth/cookie-auth.guard';
-import { OptionalJwtGuard } from '../../../src/nest/auth/optional-jwt.guard';
-import { AdminGuard } from '../../../src/nest/auth/admin.guard';
-import { PasskeyEnabledGuard } from '../../../src/nest/auth/passkey-enabled.guard';
-import { PasskeyController } from '../../../src/nest/auth/passkey.controller';
-import { RateLimitService } from '../../../src/nest/common/rate-limit.service';
+import { JwtAuthGuard } from '../../../../src/nest/auth-core/jwt-auth.guard';
+import { CookieAuthGuard } from '../../../../src/nest/auth-core/cookie-auth.guard';
+import { OptionalJwtGuard } from '../../../../src/nest/auth-core/optional-jwt.guard';
+import { AdminGuard } from '../../../../src/nest/auth-core/admin.guard';
+import { PasskeyEnabledGuard } from '../../../../src/nest/auth/passkey-enabled.guard';
+import { PasskeyController } from '../../../../src/nest/auth/passkey.controller';
+import { RateLimitService } from '../../../../src/nest/common/rate-limit.service';
// AuditService is constructor-injected since the auditLog DI migration; the
// wrapper keeps the historical construction sites positional.
@@ -32,13 +32,13 @@ const passkey = {
deletePasskey: vi.fn(),
};
const pc = (limiter: RateLimitService) => new PasskeyController(limiter, audit, passkey as unknown as PasskeyService);
-import { CurrentUser } from '../../../src/nest/auth/current-user.decorator';
-import { extractToken, verifyJwtAndLoadUser } from '../../../src/nest/auth/jwt-verify';
-import type { AuthService } from '../../../src/nest/auth/auth.service';
-import type { PasskeyService } from '../../../src/nest/auth/passkey.service';
-import { setAuthCookie } from '../../../src/nest/common/cookie';
-import type { AuditService } from '../../../src/nest/audit/audit.service';
-import type { User } from '../../../src/types';
+import { CurrentUser } from '../../../../src/nest/auth-core/current-user.decorator';
+import { extractToken, verifyJwtAndLoadUser } from '../../../../src/nest/auth-core/jwt-verify';
+import type { AuthService } from '../../../../src/nest/auth/auth.service';
+import type { PasskeyService } from '../../../../src/nest/auth/passkey.service';
+import { setAuthCookie } from '../../../../src/nest/common/cookie';
+import type { AuditService } from '../../../../src/nest/audit/audit.service';
+import type { User } from '../../../../src/types';
const user = { id: 1, username: 'u', role: 'user', email: '[email protected]' } as User;
diff --git a/server/tests/unit/nest/auth/ephemeral-tokens.test.ts b/server/tests/unit/nest/auth-core/ephemeral-tokens.test.ts
similarity index 98%
rename from server/tests/unit/nest/auth/ephemeral-tokens.test.ts
rename to server/tests/unit/nest/auth-core/ephemeral-tokens.test.ts
index d92e477b8..81a2acea5 100644
--- a/server/tests/unit/nest/auth/ephemeral-tokens.test.ts
+++ b/server/tests/unit/nest/auth-core/ephemeral-tokens.test.ts
@@ -7,7 +7,7 @@ beforeEach(() => {
describe('ephemeralTokens', () => {
async function getModule() {
- return import('../../../../src/nest/auth/ephemeral-tokens');
+ return import('../../../../src/nest/auth-core/ephemeral-tokens');
}
// AUTH-030 — Resource token creation (single-use)
diff --git a/server/tests/unit/nest/auth/jwt-verify.test.ts b/server/tests/unit/nest/auth-core/jwt-verify.test.ts
similarity index 99%
rename from server/tests/unit/nest/auth/jwt-verify.test.ts
rename to server/tests/unit/nest/auth-core/jwt-verify.test.ts
index 2d08b7538..d0b5754cc 100644
--- a/server/tests/unit/nest/auth/jwt-verify.test.ts
+++ b/server/tests/unit/nest/auth-core/jwt-verify.test.ts
@@ -29,7 +29,7 @@ import {
extractToken,
verifiedSessionClaims,
verifyJwtAndLoadUser,
-} from '../../../../src/nest/auth/jwt-verify';
+} from '../../../../src/nest/auth-core/jwt-verify';
import type { UsersRepository, UserWithPasswordVersion } from '../../../../src/db/repositories/Users.repository';
import type { UserSessionsRepository } from '../../../../src/db/repositories/UserSessions.repository';
import { dbNow } from '../../../../src/db/types';
diff --git a/server/tests/unit/nest/mfa-policy.guard.test.ts b/server/tests/unit/nest/auth-core/mfa-policy.guard.test.ts
similarity index 91%
rename from server/tests/unit/nest/mfa-policy.guard.test.ts
rename to server/tests/unit/nest/auth-core/mfa-policy.guard.test.ts
index 62684f23d..3a7fdb9ac 100644
--- a/server/tests/unit/nest/mfa-policy.guard.test.ts
+++ b/server/tests/unit/nest/auth-core/mfa-policy.guard.test.ts
@@ -17,14 +17,14 @@
import { describe, it, expect, vi } from 'vitest';
import { HttpException } from '@nestjs/common';
import { Reflector } from '@nestjs/core';
-import { MfaExempt, MFA_EXEMPT, MfaPolicyGuard } from '../../../src/nest/auth/mfa-policy.guard';
-import { Public, IS_PUBLIC } from '../../../src/nest/auth/public.decorator';
-import type { AppSettingsRepository } from '../../../src/db/repositories/AppSettings.repository';
-import type { UsersRepository } from '../../../src/db/repositories/Users.repository';
-import type { WebauthnCredentialsRepository } from '../../../src/db/repositories/WebauthnCredentials.repository';
-import type { RuntimeEnvService } from '../../../src/nest/app-config/runtime-env.service';
-import { DEMO_EMAIL_PRIMARY } from '../../../src/nest/common/demo';
-import type { User } from '../../../src/types';
+import { MfaExempt, MFA_EXEMPT, MfaPolicyGuard } from '../../../../src/nest/auth-core/mfa-policy.guard';
+import { Public, IS_PUBLIC } from '../../../../src/nest/auth-core/public.decorator';
+import type { AppSettingsRepository } from '../../../../src/db/repositories/AppSettings.repository';
+import type { UsersRepository } from '../../../../src/db/repositories/Users.repository';
+import type { WebauthnCredentialsRepository } from '../../../../src/db/repositories/WebauthnCredentials.repository';
+import type { RuntimeEnvService } from '../../../../src/nest/app-config/runtime-env.service';
+import { DEMO_EMAIL_PRIMARY } from '../../../../src/nest/common/demo';
+import type { User } from '../../../../src/types';
const user = { id: 7, email: '[email protected]', role: 'user' } as User;
diff --git a/server/tests/unit/nest/auth.service.test.ts b/server/tests/unit/nest/auth.service.test.ts
index 388eed607..6f3a62630 100644
--- a/server/tests/unit/nest/auth.service.test.ts
+++ b/server/tests/unit/nest/auth.service.test.ts
@@ -43,7 +43,7 @@ vi.mock('../../../src/nest/common/crypto/apiKeyCrypto', () => ({
mask_stored_api_key: vi.fn((v: string | null | undefined) => (v ? '••••••••' : null)),
encrypt_api_key: vi.fn((v) => v),
}));
-vi.mock('../../../src/nest/auth/ephemeral-tokens', () => ({ createEphemeralToken: vi.fn() }));
+vi.mock('../../../src/nest/auth-core/ephemeral-tokens', () => ({ createEphemeralToken: vi.fn() }));
vi.mock('../../../src/mcp/sessionManager', () => ({ revokeUserSessions: vi.fn() }));
// ---------------------------------------------------------------------------
@@ -61,16 +61,16 @@ import { PermissionsService } from '../../../src/nest/permissions/permissions.se
import { BudgetService } from '../../../src/nest/budget/budget.service';
import { ExchangeRatesService } from '../../../src/nest/budget/exchange-rates.service';
import { RealtimeService } from '../../../src/nest/realtime/realtime.service';
-import { verifyJwtAndLoadUser } from '../../../src/nest/auth/jwt-verify';
+import { verifyJwtAndLoadUser } from '../../../src/nest/auth-core/jwt-verify';
import { authenticator } from 'otplib';
import { hashBackupCode } from '../../../src/nest/auth/auth.helpers';
-import { createEphemeralToken } from '../../../src/nest/auth/ephemeral-tokens';
+import { createEphemeralToken } from '../../../src/nest/auth-core/ephemeral-tokens';
import { TripMembershipService } from '../../../src/nest/trip-membership/trip-membership.service';
import { UserCleanupService } from '../../../src/nest/auth/user-cleanup.service';
import { WebauthnConfigService } from '../../../src/nest/auth/webauthn-config.service';
import { revokeUserSessions } from '../../../src/mcp/sessionManager';
import { MailerService } from '../../../src/nest/notifications/mailer/mailer.service';
-import { EphemeralTokenService } from '../../../src/nest/auth/ephemeral-token.service';
+import { EphemeralTokenService } from '../../../src/nest/auth-core/ephemeral-token.service';
import { AllowedFileTypesService } from '../../../src/nest/files/allowed-file-types.service';
import { DEFAULT_ALLOWED_EXTENSIONS } from '../../../src/nest/files/files.constants';
import { createTestPushSubscriptionsRepo } from '../../helpers/notifications-repos';
diff --git a/server/tests/unit/nest/backup.controller.test.ts b/server/tests/unit/nest/backup.controller.test.ts
index afe0f97b4..20ba8ce03 100644
--- a/server/tests/unit/nest/backup.controller.test.ts
+++ b/server/tests/unit/nest/backup.controller.test.ts
@@ -24,7 +24,7 @@ vi.mock('../../../src/nest/backup/backup.impl', () => ({
import { BackupController } from '../../../src/nest/backup/backup.controller';
import { StorageNotFoundError } from '../../../src/nest/storage/storage.types';
import { BackupService as RealBackupService } from '../../../src/nest/backup/backup.service';
-import { AdminGuard } from '../../../src/nest/auth/admin.guard';
+import { AdminGuard } from '../../../src/nest/auth-core/admin.guard';
import type { BackupService } from '../../../src/nest/backup/backup.service';
import type { AutoBackupJob } from '../../../src/nest/backup/auto-backup.job';
import type { AuditService } from '../../../src/nest/audit/audit.service';
diff --git a/server/tests/unit/nest/collab.controller.test.ts b/server/tests/unit/nest/collab.controller.test.ts
index 7ad9f4db7..7fecc927f 100644
--- a/server/tests/unit/nest/collab.controller.test.ts
+++ b/server/tests/unit/nest/collab.controller.test.ts
@@ -6,7 +6,7 @@ import path from 'path';
import { CollabController, collabChatImageFilter, collabNoteFileFilter } from '../../../src/nest/collab/collab.controller';
import { TripAccessGuard, TRIP_PERMISSION_KEY } from '../../../src/nest/permissions/trip-access.guard';
-import { JwtAuthGuard } from '../../../src/nest/auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../../../src/nest/auth-core/jwt-auth.guard';
import type { CollabService } from '../../../src/nest/collab/collab.service';
import type { StorageService } from '../../../src/nest/storage/storage.service';
import type { User } from '../../../src/types';
diff --git a/server/tests/unit/nest/dawarich.controller.test.ts b/server/tests/unit/nest/dawarich.controller.test.ts
index 3c71d8e6a..5186969eb 100644
--- a/server/tests/unit/nest/dawarich.controller.test.ts
+++ b/server/tests/unit/nest/dawarich.controller.test.ts
@@ -24,7 +24,7 @@ import type { DawarichErrorCode } from '@trek/shared';
import { DawarichController } from '../../../src/nest/integrations/dawarich.controller';
import { AcceptError } from '../../../src/nest/integrations/dawarich-suggestions.service';
import { DawarichError } from '../../../src/nest/integrations/dawarich.client';
-import { JwtAuthGuard } from '../../../src/nest/auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../../../src/nest/auth-core/jwt-auth.guard';
import { AddonGuard } from '../../../src/nest/addons/addon.guard';
import { REQUIRE_ADDON } from '../../../src/nest/addons/require-addon.decorator';
import { ADDON_IDS } from '../../../src/addons';
diff --git a/server/tests/unit/nest/files.service.test.ts b/server/tests/unit/nest/files.service.test.ts
index bdba219a3..f7121364e 100644
--- a/server/tests/unit/nest/files.service.test.ts
+++ b/server/tests/unit/nest/files.service.test.ts
@@ -41,10 +41,10 @@ const checkPermission = vi.fn(() => true);
const permissionsStub = { checkPermission } as unknown as PermissionsService;
const { verifyJwtAndLoadUser } = vi.hoisted(() => ({ verifyJwtAndLoadUser: vi.fn() }));
-vi.mock('../../../src/nest/auth/jwt-verify', () => ({ verifyJwtAndLoadUser }));
+vi.mock('../../../src/nest/auth-core/jwt-verify', () => ({ verifyJwtAndLoadUser }));
const { consumeEphemeralToken } = vi.hoisted(() => ({ consumeEphemeralToken: vi.fn() }));
-vi.mock('../../../src/nest/auth/ephemeral-tokens', () => ({ consumeEphemeralToken }));
+vi.mock('../../../src/nest/auth-core/ephemeral-tokens', () => ({ consumeEphemeralToken }));
import type { Request } from 'express';
import { resetTestDb } from '../../helpers/test-db';
@@ -75,7 +75,7 @@ import {
} from '../../../src/nest/files/files.constants';
import type { User } from '../../../src/types';
import { RealtimeService } from '../../../src/nest/realtime/realtime.service';
-import { EphemeralTokenService } from '../../../src/nest/auth/ephemeral-token.service';
+import { EphemeralTokenService } from '../../../src/nest/auth-core/ephemeral-token.service';
import type { EntityManager } from '@mikro-orm/core';
import { Users } from '../../../src/db/entities/Users.entity';
import { UserSessions } from '../../../src/db/entities/UserSessions.entity';
diff --git a/server/tests/unit/nest/llm-parse/llm-capabilities.controller.test.ts b/server/tests/unit/nest/llm-parse/llm-capabilities.controller.test.ts
index 238313c9c..acd15d3c4 100644
--- a/server/tests/unit/nest/llm-parse/llm-capabilities.controller.test.ts
+++ b/server/tests/unit/nest/llm-parse/llm-capabilities.controller.test.ts
@@ -1,7 +1,7 @@
import { describe, it, expect, vi } from 'vitest';
import { GUARDS_METADATA } from '@nestjs/common/constants';
import { LlmCapabilitiesController } from '../../../../src/nest/llm-parse/llm-capabilities.controller';
-import { JwtAuthGuard } from '../../../../src/nest/auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../../../../src/nest/auth-core/jwt-auth.guard';
import type { LlmParseService } from '../../../../src/nest/llm-parse/llm-parse.service';
import type { User } from '../../../../src/types';
diff --git a/server/tests/unit/nest/mcp-transport.service.test.ts b/server/tests/unit/nest/mcp-transport.service.test.ts
index 09bfb3333..4d7bfa8e6 100644
--- a/server/tests/unit/nest/mcp-transport.service.test.ts
+++ b/server/tests/unit/nest/mcp-transport.service.test.ts
@@ -27,7 +27,7 @@ import type { OauthService } from '../../../src/nest/oauth/oauth.service';
import type { AddonsService } from '../../../src/nest/addons/addons.service';
import type { AuditService } from '../../../src/nest/audit/audit.service';
import type { McpRegistryService } from '../../../src/nest-mcp';
-import { IS_PUBLIC } from '../../../src/nest/auth/public.decorator';
+import { IS_PUBLIC } from '../../../src/nest/auth-core/public.decorator';
const user = { id: 7, username: 'u', email: '[email protected]', role: 'user' as const };
diff --git a/server/tests/unit/nest/oidc.service.test.ts b/server/tests/unit/nest/oidc.service.test.ts
index f96ed1501..cb9b55cec 100644
--- a/server/tests/unit/nest/oidc.service.test.ts
+++ b/server/tests/unit/nest/oidc.service.test.ts
@@ -46,7 +46,7 @@ vi.mock('../../../src/nest/common/crypto/apiKeyCrypto', () => ({
mask_stored_api_key: vi.fn((v: string | null | undefined) => (v ? '••••••••' : null)),
encrypt_api_key: vi.fn((v) => v),
}));
-vi.mock('../../../src/nest/auth/ephemeral-tokens', () => ({ createEphemeralToken: vi.fn() }));
+vi.mock('../../../src/nest/auth-core/ephemeral-tokens', () => ({ createEphemeralToken: vi.fn() }));
vi.mock('../../../src/mcp/sessionManager', () => ({ revokeUserSessions: vi.fn() }));
// The four provider calls go through the SSRF guard now (link-local and the
// cloud-metadata range are refused, every redirect hop re-checked). These tests
@@ -84,7 +84,7 @@ import { TripMembershipService } from '../../../src/nest/trip-membership/trip-me
import { AuthService } from '../../../src/nest/auth/auth.service';
import { WebauthnConfigService } from '../../../src/nest/auth/webauthn-config.service';
import { UserCleanupService } from '../../../src/nest/auth/user-cleanup.service';
-import { EphemeralTokenService } from '../../../src/nest/auth/ephemeral-token.service';
+import { EphemeralTokenService } from '../../../src/nest/auth-core/ephemeral-token.service';
import { AllowedFileTypesService } from '../../../src/nest/files/allowed-file-types.service';
import { OidcService } from '../../../src/nest/oidc/oidc.service';
import { InMemoryOidcFlowStore } from '../../../src/nest/oidc/oidc-flow.store';
diff --git a/server/tests/unit/nest/passkey.service.test.ts b/server/tests/unit/nest/passkey.service.test.ts
index 7e6fefc65..e5f81f871 100644
--- a/server/tests/unit/nest/passkey.service.test.ts
+++ b/server/tests/unit/nest/passkey.service.test.ts
@@ -54,7 +54,7 @@ vi.mock('../../../src/nest/common/crypto/apiKeyCrypto', () => ({
mask_stored_api_key: vi.fn((v: string | null | undefined) => (v ? '••••••••' : null)),
encrypt_api_key: vi.fn((v) => v),
}));
-vi.mock('../../../src/nest/auth/ephemeral-tokens', () => ({ createEphemeralToken: vi.fn() }));
+vi.mock('../../../src/nest/auth-core/ephemeral-tokens', () => ({ createEphemeralToken: vi.fn() }));
vi.mock('../../../src/mcp/sessionManager', () => ({ revokeUserSessions: vi.fn() }));
// The WebAuthn ceremony verdicts are the mock boundary — the service must
@@ -82,7 +82,7 @@ import { AuthService } from '../../../src/nest/auth/auth.service';
import { PasskeyService } from '../../../src/nest/auth/passkey.service';
import { WebauthnConfigService } from '../../../src/nest/auth/webauthn-config.service';
import { UserCleanupService } from '../../../src/nest/auth/user-cleanup.service';
-import { EphemeralTokenService } from '../../../src/nest/auth/ephemeral-token.service';
+import { EphemeralTokenService } from '../../../src/nest/auth-core/ephemeral-token.service';
import { AllowedFileTypesService } from '../../../src/nest/files/allowed-file-types.service';
import { MailerService } from '../../../src/nest/notifications/mailer/mailer.service';
import {
diff --git a/server/tests/unit/nest/platform.controller.test.ts b/server/tests/unit/nest/platform.controller.test.ts
index 8f8062812..986193d17 100644
--- a/server/tests/unit/nest/platform.controller.test.ts
+++ b/server/tests/unit/nest/platform.controller.test.ts
@@ -9,7 +9,7 @@ const h = vi.hoisted(() => ({
sendToResponse: vi.fn(),
}));
-vi.mock('../../../src/nest/auth/jwt-verify', () => ({ verifyJwtAndLoadUser: h.verifyJwtAndLoadUser }));
+vi.mock('../../../src/nest/auth-core/jwt-verify', () => ({ verifyJwtAndLoadUser: h.verifyJwtAndLoadUser }));
vi.mock('../../../src/db/database', () => ({ db: { prepare: h.dbPrepare } }));
import {
diff --git a/server/tests/unit/nest/public-api-scopes.test.ts b/server/tests/unit/nest/public-api-scopes.test.ts
index 1c64da638..8402f2321 100644
--- a/server/tests/unit/nest/public-api-scopes.test.ts
+++ b/server/tests/unit/nest/public-api-scopes.test.ts
@@ -35,7 +35,7 @@ vi.mock('../../../src/db/database', async () => {
isOwner: () => false,
};
});
-vi.mock('../../../src/nest/auth/ephemeral-tokens', () => ({ createEphemeralToken: vi.fn() }));
+vi.mock('../../../src/nest/auth-core/ephemeral-tokens', () => ({ createEphemeralToken: vi.fn() }));
vi.mock('../../../src/mcp/sessionManager', () => ({ revokeUserSessions: vi.fn() }));
vi.mock('../../../src/nest/audit/client-ip', () => ({ getClientIp: vi.fn(() => '1.2.3.4') }));
vi.mock('../../../src/nest/audit/audit-log.logger', () => ({
@@ -67,7 +67,7 @@ import type { UsersRepository } from '../../../src/db/repositories/Users.reposit
import { createTestMcpTokensRepo, createTestUsersRepo, sharedTestOrm } from '../../helpers/test-uow';
import { findRow, updateRows } from '../../helpers/factories/rows';
import { McpTokens } from '../../../src/db/entities/McpTokens.entity';
-import { EphemeralTokenService } from '../../../src/nest/auth/ephemeral-token.service';
+import { EphemeralTokenService } from '../../../src/nest/auth-core/ephemeral-token.service';
import { ApiTokenGuard } from '../../../src/nest/public-api/api-token.guard';
import { PublicApiController } from '../../../src/nest/public-api/public-api.controller';
import type { PublicApiService } from '../../../src/nest/public-api/public-api.service';
diff --git a/server/tests/unit/nest/realtime.gateway.test.ts b/server/tests/unit/nest/realtime.gateway.test.ts
index 6f4b76dc0..52a0b686b 100644
--- a/server/tests/unit/nest/realtime.gateway.test.ts
+++ b/server/tests/unit/nest/realtime.gateway.test.ts
@@ -38,7 +38,7 @@ import {
} from '../../../src/nest/realtime/ws-state';
import { emitPluginEvent } from '../../../src/plugin-event-sink';
import type { TripsRepository } from '../../../src/db/repositories/Trips.repository';
-import type { EphemeralTokenService } from '../../../src/nest/auth/ephemeral-token.service';
+import type { EphemeralTokenService } from '../../../src/nest/auth-core/ephemeral-token.service';
import type { JourneyDomainService } from '../../../src/nest/journey/journey-domain.service';
import type { UsersRepository } from '../../../src/db/repositories/Users.repository';
import type { AppSettingsRepository } from '../../../src/db/repositories/AppSettings.repository';
diff --git a/server/tests/unit/nest/roadtrip.controller.test.ts b/server/tests/unit/nest/roadtrip.controller.test.ts
index 9ce4131ef..22857d412 100644
--- a/server/tests/unit/nest/roadtrip.controller.test.ts
+++ b/server/tests/unit/nest/roadtrip.controller.test.ts
@@ -20,7 +20,7 @@ import { GUARDS_METADATA } from '@nestjs/common/constants';
import { RoadtripController } from '../../../src/nest/roadtrip/roadtrip.controller';
import type { RoadtripService } from '../../../src/nest/roadtrip/roadtrip.service';
import { AddonGuard } from '../../../src/nest/addons/addon.guard';
-import { JwtAuthGuard } from '../../../src/nest/auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../../../src/nest/auth-core/jwt-auth.guard';
import { TripAccessGuard } from '../../../src/nest/permissions/trip-access.guard';
const VIA = { id: 5, day_id: 4, after_order_index: 0, sequence: 0, lat: 53, lng: 10 };
diff --git a/server/tests/unit/nest/sessions/sessions.service.test.ts b/server/tests/unit/nest/sessions/sessions.service.test.ts
index c167e647b..6ecbd3565 100644
--- a/server/tests/unit/nest/sessions/sessions.service.test.ts
+++ b/server/tests/unit/nest/sessions/sessions.service.test.ts
@@ -9,7 +9,7 @@ import { countRows, findRow, findRows } from '../../../helpers/factories/rows';
import { UserSessions } from '../../../../src/db/entities/UserSessions.entity';
import { SessionsService, USER_AGENT_MAX_LENGTH, legacySessionId, sessionClientFrom } from '../../../../src/nest/sessions/sessions.service';
import { userSessionIdSchema } from '@trek/shared';
-import { verifyJwtAndLoadUser } from '../../../../src/nest/auth/jwt-verify';
+import { verifyJwtAndLoadUser } from '../../../../src/nest/auth-core/jwt-verify';
import { Users } from '../../../../src/db/entities/Users.entity';
import type { Request } from 'express';
import { JWT_SECRET, SESSION_DURATION_REMEMBER_SECONDS, SESSION_DURATION_SECONDS } from '../../../../src/config';
diff --git a/server/tests/unit/nest/token.service.test.ts b/server/tests/unit/nest/token.service.test.ts
index 81ed3daf8..bbe6fff74 100644
--- a/server/tests/unit/nest/token.service.test.ts
+++ b/server/tests/unit/nest/token.service.test.ts
@@ -26,7 +26,7 @@ vi.mock('../../../src/db/database', async () => {
});
-vi.mock('../../../src/nest/auth/ephemeral-tokens', () => ({ createEphemeralToken: vi.fn() }));
+vi.mock('../../../src/nest/auth-core/ephemeral-tokens', () => ({ createEphemeralToken: vi.fn() }));
vi.mock('../../../src/mcp/sessionManager', () => ({ revokeUserSessions: vi.fn() }));
// ---------------------------------------------------------------------------
@@ -39,10 +39,10 @@ import { resetTestDb } from '../../helpers/test-db';
import { createUser } from '../../helpers/factories';
import { TokenService } from '../../../src/nest/tokens/token.service';
import { TokensModule } from '../../../src/nest/tokens/tokens.module';
-import { createEphemeralToken } from '../../../src/nest/auth/ephemeral-tokens';
+import { createEphemeralToken } from '../../../src/nest/auth-core/ephemeral-tokens';
import { revokeUserSessions } from '../../../src/mcp/sessionManager';
import { expectRegisteredProvider } from '../../helpers/module-providers';
-import { EphemeralTokenService } from '../../../src/nest/auth/ephemeral-token.service';
+import { EphemeralTokenService } from '../../../src/nest/auth-core/ephemeral-token.service';
import { createTestMcpTokensRepo, createTestUsersRepo } from '../../helpers/test-uow';
import { sharedTestOrm } from '../../helpers/test-uow';
import { countRows, findRow, insertRow, updateRows } from '../../helpers/factories/rows';
diff --git a/server/tests/unit/nest/tours.controller.test.ts b/server/tests/unit/nest/tours.controller.test.ts
index d550232f5..b840e9627 100644
--- a/server/tests/unit/nest/tours.controller.test.ts
+++ b/server/tests/unit/nest/tours.controller.test.ts
@@ -31,7 +31,7 @@ vi.mock('../../../src/nest/permissions/permissions.service', () => ({ Permission
vi.mock('../../../src/nest/addons/addons.service', () => ({ AddonsService: class {} }));
vi.mock('../../../src/nest/places/places.service', () => ({ PlacesService: class {} }));
vi.mock('../../../src/nest/tours/tours.service', () => ({ ToursService: class {} }));
-vi.mock('../../../src/nest/auth/jwt-verify', () => ({ extractToken: vi.fn(), verifyJwtAndLoadUser: vi.fn() }));
+vi.mock('../../../src/nest/auth-core/jwt-verify', () => ({ extractToken: vi.fn(), verifyJwtAndLoadUser: vi.fn() }));
import type { TourCreateRequest } from '@trek/shared';
import { ToursController } from '../../../src/nest/tours/tours.controller';
@@ -40,7 +40,7 @@ import type { ToursService } from '../../../src/nest/tours/tours.service';
import type { PlacesService } from '../../../src/nest/places/places.service';
import type { AddonsService } from '../../../src/nest/addons/addons.service';
import { AddonGuard } from '../../../src/nest/addons/addon.guard';
-import { JwtAuthGuard } from '../../../src/nest/auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../../../src/nest/auth-core/jwt-auth.guard';
import { TRIP_PERMISSION_KEY, TripAccessGuard } from '../../../src/nest/permissions/trip-access.guard';
import { REQUIRE_ADDON } from '../../../src/nest/addons/require-addon.decorator';
import type { User } from '../../../src/types';
diff --git a/server/tests/unit/nest/tours.permissions.boundaries.mock-only.test.ts b/server/tests/unit/nest/tours.permissions.boundaries.mock-only.test.ts
index f2c17a66f..071d785e2 100644
--- a/server/tests/unit/nest/tours.permissions.boundaries.mock-only.test.ts
+++ b/server/tests/unit/nest/tours.permissions.boundaries.mock-only.test.ts
@@ -35,12 +35,12 @@ vi.mock('../../../src/nest/places/places.service', () => ({ PlacesService: class
vi.mock('../../../src/nest/assignments/assignments.service', () => ({ AssignmentsService: class {} }));
vi.mock('../../../src/nest/app-config/runtime-env.service', () => ({ RuntimeEnvService: class {} }));
vi.mock('../../../src/nest/storage/storage.service', () => ({ StorageService: class {} }));
-vi.mock('../../../src/nest/auth/jwt-verify', () => ({ extractToken: vi.fn(), verifyJwtAndLoadUser: vi.fn() }));
+vi.mock('../../../src/nest/auth-core/jwt-verify', () => ({ extractToken: vi.fn(), verifyJwtAndLoadUser: vi.fn() }));
import { PlacesController } from '../../../src/nest/places/places.controller';
import { DayAssignmentsController } from '../../../src/nest/assignments/assignments.controller';
import { ToursService } from '../../../src/nest/tours/tours.service';
-import { JwtAuthGuard } from '../../../src/nest/auth/jwt-auth.guard';
+import { JwtAuthGuard } from '../../../src/nest/auth-core/jwt-auth.guard';
import { TripAccessGuard, TRIP_PERMISSION_KEY } from '../../../src/nest/permissions/trip-access.guard';
import type { PermissionsService } from '../../../src/nest/permissions/permissions.service';
import type { PlacesService } from '../../../src/nest/places/places.service';
diff --git a/server/tests/unit/nest/tours.permissions.test.ts b/server/tests/unit/nest/tours.permissions.test.ts
index 5f616d53b..969c93593 100644
--- a/server/tests/unit/nest/tours.permissions.test.ts
+++ b/server/tests/unit/nest/tours.permissions.test.ts
@@ -32,7 +32,7 @@ vi.mock('../../../src/nest/permissions/permissions.service', () => ({ Permission
vi.mock('../../../src/nest/addons/addons.service', () => ({ AddonsService: class {} }));
vi.mock('../../../src/nest/places/places.service', () => ({ PlacesService: class {} }));
vi.mock('../../../src/nest/tours/tours.service', () => ({ ToursService: class {} }));
-vi.mock('../../../src/nest/auth/jwt-verify', () => ({ extractToken: vi.fn(), verifyJwtAndLoadUser: vi.fn() }));
+vi.mock('../../../src/nest/auth-core/jwt-verify', () => ({ extractToken: vi.fn(), verifyJwtAndLoadUser: vi.fn() }));
import { ToursController } from '../../../src/nest/tours/tours.controller';
import { ToursImportController } from '../../../src/nest/tours/tours-import.controller';
@@ -42,8 +42,8 @@ import type { PlacesService } from '../../../src/nest/places/places.service';
import type { AddonsService } from '../../../src/nest/addons/addons.service';
import type { ToursService } from '../../../src/nest/tours/tours.service';
import { AddonGuard } from '../../../src/nest/addons/addon.guard';
-import { JwtAuthGuard } from '../../../src/nest/auth/jwt-auth.guard';
-import { extractToken, verifyJwtAndLoadUser } from '../../../src/nest/auth/jwt-verify';
+import { JwtAuthGuard } from '../../../src/nest/auth-core/jwt-auth.guard';
+import { extractToken, verifyJwtAndLoadUser } from '../../../src/nest/auth-core/jwt-verify';
import type { User } from '../../../src/types';
const matrix = [[false, false], [true, false], [false, true], [true, true]] as const;
diff --git a/server/tests/unit/nest/trip-read-model.service.test.ts b/server/tests/unit/nest/trip-read-model.service.test.ts
index 83f691e9e..40d578070 100644
--- a/server/tests/unit/nest/trip-read-model.service.test.ts
+++ b/server/tests/unit/nest/trip-read-model.service.test.ts
@@ -59,7 +59,7 @@ import { MapsService } from '../../../src/nest/maps/maps.service';
import { QueryHelpersService } from '../../../src/nest/query-helpers/query-helpers.service';
import { notificationsStub } from '../../helpers/notifications';
import { accommodationsOver } from '../../helpers/accommodations-service';
-import { EphemeralTokenService } from '../../../src/nest/auth/ephemeral-token.service';
+import { EphemeralTokenService } from '../../../src/nest/auth-core/ephemeral-token.service';
import { UnsplashService } from '../../../src/nest/unsplash/unsplash.service';
import { PlacePhotoCacheService } from '../../../src/nest/place-photos/place-photo-cache.service';
import { RuntimeEnvService } from '../../../src/nest/app-config/runtime-env.service';
diff --git a/server/tests/unit/nest/trips.service.test.ts b/server/tests/unit/nest/trips.service.test.ts
index 20aa9df02..0e8cb68e3 100644
--- a/server/tests/unit/nest/trips.service.test.ts
+++ b/server/tests/unit/nest/trips.service.test.ts
@@ -79,7 +79,7 @@ import { QueryHelpersService } from '../../../src/nest/query-helpers/query-helpe
import fs from 'fs';
import path from 'path';
import { notificationsStub } from '../../helpers/notifications';
-import { EphemeralTokenService } from '../../../src/nest/auth/ephemeral-token.service';
+import { EphemeralTokenService } from '../../../src/nest/auth-core/ephemeral-token.service';
import {
createTestUnitOfWork, createTestAppSettingsRepo, createTestUsersRepo, sharedTestOrm,
createTestDaysRepo, createTestDayAssignmentsRepo, createTestDayNotesRepo, createTestTripsRepo,
diff --git a/server/tests/unit/nest/wiring.test.ts b/server/tests/unit/nest/wiring.test.ts
index 816ed6b0a..dcc30a346 100644
--- a/server/tests/unit/nest/wiring.test.ts
+++ b/server/tests/unit/nest/wiring.test.ts
@@ -3,7 +3,7 @@ import { HttpException } from '@nestjs/common';
import { Test } from '@nestjs/testing';
import { AppModule } from '../../../src/nest/app.module';
import { FeaturesController } from '../../../src/nest/health/features.controller';
-import { AdminGuard } from '../../../src/nest/auth/admin.guard';
+import { AdminGuard } from '../../../src/nest/auth-core/admin.guard';
vi.mock('../../../src/config', async () => {
const { readEnv } = await import('../../../src/app-config');
diff --git a/server/tests/unit/plugins/plugins-proxy.test.ts b/server/tests/unit/plugins/plugins-proxy.test.ts
index 5f81e46d6..6e07a5a1b 100644
--- a/server/tests/unit/plugins/plugins-proxy.test.ts
+++ b/server/tests/unit/plugins/plugins-proxy.test.ts
@@ -11,7 +11,7 @@ const { pluginsEnabledMock, extractTokenMock, verifyMock } = vi.hoisted(() => ({
verifyMock: vi.fn(() => ({ id: 5, username: 'ada', role: 'user' })),
}));
vi.mock('../../../src/nest/plugins/kill-switch', () => ({ pluginsEnabled: pluginsEnabledMock }));
-vi.mock('../../../src/nest/auth/jwt-verify', () => ({ extractToken: extractTokenMock, verifyJwtAndLoadUser: verifyMock }));
+vi.mock('../../../src/nest/auth-core/jwt-verify', () => ({ extractToken: extractTokenMock, verifyJwtAndLoadUser: verifyMock }));
import type { EntityManager } from '@mikro-orm/core';
import { PluginsProxyController } from '../../../src/nest/plugins/plugins-proxy.controller';
diff --git a/server/tests/websocket/connection.test.ts b/server/tests/websocket/connection.test.ts
index 5212f7b78..2a6c34b7d 100644
--- a/server/tests/websocket/connection.test.ts
+++ b/server/tests/websocket/connection.test.ts
@@ -32,9 +32,9 @@ import { db as testDb } from '../../src/db/database';
import { resetTestDb, resetRateLimits } from '../helpers/test-db';
import { createUser, createTrip } from '../helpers/factories';
import { authCookie } from '../helpers/auth';
-import { createEphemeralToken } from '../../src/nest/auth/ephemeral-tokens';
+import { createEphemeralToken } from '../../src/nest/auth-core/ephemeral-tokens';
import { TokenService } from '../../src/nest/tokens/token.service';
-import { EphemeralTokenService } from '../../src/nest/auth/ephemeral-token.service';
+import { EphemeralTokenService } from '../../src/nest/auth-core/ephemeral-token.service';
import { createTestMcpTokensRepo, createTestUsersRepo } from '../helpers/test-uow';
import { MikroORM } from '@mikro-orm/core';
import { Users } from '../../src/db/entities/Users.entity';
diff --git a/server/tests/websocket/wire-envelope.test.ts b/server/tests/websocket/wire-envelope.test.ts
index 115e52cec..1cc40c630 100644
--- a/server/tests/websocket/wire-envelope.test.ts
+++ b/server/tests/websocket/wire-envelope.test.ts
@@ -39,7 +39,7 @@ import { db as testDb } from '../../src/db/database';
import { resetTestDb } from '../helpers/test-db';
import { createUser, createTrip } from '../helpers/factories';
import { broadcast, broadcastToUser } from '../../src/websocket';
-import { createEphemeralToken } from '../../src/nest/auth/ephemeral-tokens';
+import { createEphemeralToken } from '../../src/nest/auth-core/ephemeral-tokens';
let server: http.Server;
let wsUrl: string;
diff --git a/server/vitest.config.ts b/server/vitest.config.ts
index be2bed604..335513852 100644
--- a/server/vitest.config.ts
+++ b/server/vitest.config.ts
@@ -92,6 +92,7 @@ export default defineConfig({
'src/nest/atlas/**/*.ts': { statements: 92, branches: 82, functions: 96, lines: 94 },
'src/nest/audit/**/*.ts': { statements: 93, branches: 80, functions: 99, lines: 96 },
'src/nest/auth/**/*.ts': { statements: 93, branches: 85, functions: 95, lines: 96 },
+ 'src/nest/auth-core/**/*.ts': { statements: 89, branches: 83, functions: 94, lines: 89 },
'src/nest/backup/**/*.ts': { statements: 97, branches: 93, functions: 99, lines: 98 },
'src/nest/booking-import/**/*.ts': { statements: 50, branches: 28, functions: 64, lines: 53 },
'src/nest/budget/**/*.ts': { statements: 91, branches: 77, functions: 97, lines: 95 },