Skip to content

Major refactor: remove GraphQL surface and consolidate REST/Swagger architecture#4

Merged
digitalnomad91 merged 7 commits intomainfrom
refactor/remove-graphql-rest-consolidation
Feb 18, 2026
Merged

Major refactor: remove GraphQL surface and consolidate REST/Swagger architecture#4
digitalnomad91 merged 7 commits intomainfrom
refactor/remove-graphql-rest-consolidation

Conversation

@digitalnomad91
Copy link
Member

Overview

This PR captures a broad architectural refactor that removes the remaining GraphQL-facing surface area and consolidates the API around REST + Swagger DTOs/decorators. It also includes runtime/bootstrap hardening and provider/module cleanup.

The work was split into 4 major commits to keep review focused:

  1. refactor(graphql): remove GraphQL stack and related dependencies
  2. refactor(api): migrate DTOs and decorators to REST/Swagger
  3. refactor(notifications): move providers into dedicated folder
  4. chore(runtime): update env/bootstrap, db logging, and platform wiring

Detailed changelog

1) GraphQL decommissioning

  • Removed GraphQL resolver files and related legacy GraphQL-only models:
    • src/app.resolver.ts
    • src/auth/auth.resolver.ts
    • src/jobs/job.resolver.ts
    • src/users/user.resolver.ts
    • src/jobs/models/* (legacy GraphQL-oriented models)
  • Removed GraphQL auth guard and GraphQL config service:
    • src/auth/gql-auth.guard.ts
    • src/gql-config.service.ts
  • Removed GraphQL config surface from app config and defaults:
    • default.json GraphQL blocks removed
    • src/common/configs/config.ts / related typing updates
  • Removed GraphQL plugin from Nest CLI build plugins (nest-cli.json).
  • Removed GraphQL/Apollo dependencies from runtime lockset (package.json, pnpm-lock.yaml).
  • Removed generated JobSource DTO artifacts no longer needed.

2) REST/Swagger DTO + decorator migration

  • Converted auth/job/user DTOs and models away from GraphQL decorators toward Swagger/class-validator metadata.
  • Added/updated Swagger API metadata for request/response contracts and parameter docs.
  • Updated shared decorators/utilities:
    • src/common/decorators/api.decorator.ts
    • src/common/decorators/field.decorator.ts
    • src/common/decorators/user.decorator.ts
  • Updated pagination/model types under src/common/pagination/* and src/common/models/*.
  • Added src/auth/dto/oauth-google.dto.ts and switched auth controller to it.
  • Updated jobs DTOs/controllers to align with REST-driven typing.

3) Notifications provider/module cleanup

  • Moved notification providers into dedicated folder:
    • from src/notifications/*.provider.ts
    • to src/notifications/providers/*.provider.ts
  • Updated imports in notifications module/service accordingly.
  • Removed src/notifications/index.ts barrel.

4) Runtime / platform hardening

  • Entrypoint improvements:
    • Build DATABASE_URL / SHADOW_DATABASE_URL when only component env vars are present.
    • Explicit Prisma schema path for migration deploy.
    • Added migration-time env diagnostics.
  • App/bootstrap updates:
    • Config module bootstrap/env file behavior updates.
    • URL prefix compatibility middleware for /api routing in main.ts.
  • Database/redis/runtime quality-of-life changes:
    • Redacted DB password in connection logging.
    • Redis option handling tweaks and cleanup.
    • Minor WS logging/import cleanup.
  • TS/compiler config adjustments in tsconfig.json.

Notes for reviewers

  • This is intentionally broad and structural; reviewing commit-by-commit is recommended.
  • Local-only files were intentionally not included:
    • .nogic/
    • tsconfig.build.tsbuildinfo

Validation

  • Workspace diagnostics were checked after grouping and commit creation; no IDE-reported errors were found at commit time.

Copilot AI review requested due to automatic review settings February 18, 2026 05:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR represents a major architectural shift from GraphQL to a pure REST/Swagger API architecture. The refactor removes all GraphQL resolvers, models, and dependencies while consolidating the API surface around REST controllers with Swagger documentation. The work also includes runtime hardening improvements and code organization enhancements.

Changes:

  • Removed GraphQL stack including resolvers, auth guards, config service, and all Apollo/GraphQL dependencies from package.json
  • Migrated DTOs and models from GraphQL decorators (@Field, @ObjectType) to Swagger decorators (@ApiProperty, @ApiPropertyOptional)
  • Reorganized notification providers into dedicated providers/ subdirectory for better code organization
  • Enhanced runtime bootstrap with DATABASE_URL construction from components, password redaction in logs, and improved Redis password handling

Reviewed changes

Copilot reviewed 66 out of 75 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
tsconfig.json Added TypeScript compiler options to suppress deprecations and disable strict property initialization
src/wss/wss.gateway.ts Minor whitespace formatting fix
src/wss/wss.adapter.ts Commented out unused error imports
src/users/user.resolver.ts Deleted GraphQL resolver (removed file)
src/users/user.module.ts Removed UserResolver from providers
src/users/user.controller.ts Removed placeholder secured endpoint
src/users/models/user.model.ts Migrated from GraphQL to Swagger decorators
src/users/dto/update-user.input.ts Added Swagger decorators and validation
src/users/dto/change-password.input.ts Migrated to Swagger decorators
src/notifications/providers/webpush.provider.ts Moved provider to dedicated subdirectory
src/notifications/providers/firebase.provider.ts Removed debug logging and moved to subdirectory
src/notifications/notifications.service.ts Updated imports for moved providers
src/notifications/notifications.module.ts Updated imports for moved providers
src/notifications/index.ts Deleted barrel export file
src/metadata.ts Removed user.model import and cleaned up GraphQL plugin metadata
src/main.ts Added URL prefix middleware for /api compatibility
src/jobs/models/*.ts Deleted GraphQL model files
src/jobs/job.resolver.ts Deleted GraphQL resolver
src/jobs/job.module.ts Removed resolver reference and updated comments
src/jobs/job.controller.ts Updated imports, commented out unused guards, improved logging
src/jobs/dto/*.ts Migrated all DTOs from GraphQL to Swagger decorators
src/jobs/args/job.args.ts Converted from GraphQL ArgsType to REST query parameters
src/gql-config.service.ts Deleted GraphQL config service
src/generated/nestjs-dto/*.ts Removed JobSource-related DTOs
src/generated/nestjs-dto/company.entity.ts Formatting inconsistencies in generated file
src/common/redis/redis.service.ts Removed unused capitalize utility function
src/common/redis/redis.providers.ts Improved password handling with length check
src/common/pagination/*.ts Migrated from GraphQL to Swagger decorators
src/common/order/*.ts Deleted GraphQL-specific ordering files
src/common/models/*.ts Migrated base models to Swagger, removed ApiResponse interface
src/common/decorators/user.decorator.ts Changed from GraphQL context extraction to HTTP request
src/common/decorators/field.decorator.ts Removed GraphQL Field decorator usage
src/common/decorators/api.decorator.ts Commented out RedisAuthGuard usage
src/common/decorators/api-nested-query.decorator.ts Deleted unused decorator file
src/common/database/pagination/*.ts Deleted unused pagination interceptor and models
src/common/database/mongo-database.service.ts Deleted unused MongoDB service
src/common/database/database.service.ts Added password redaction in connection logging
src/common/configs/*.ts Removed GraphQL config, moved UnflattenApplicationConfig, changed env override behavior
src/auth/models/*.ts Migrated token and auth models from GraphQL to Swagger
src/auth/gql-auth.guard.ts Deleted GraphQL auth guard
src/auth/dto/*.ts Migrated all auth DTOs from GraphQL to Swagger
src/auth/auth.resolver.ts Deleted GraphQL resolver
src/auth/auth.module.ts Removed resolver and GqlAuthGuard from providers
src/auth/auth.controller.ts Updated import path for GoogleAuthInput
src/app.resolver.ts Deleted GraphQL resolver
src/app.module.ts Switched to @nestjs/config ConfigModule, added debug logging
pnpm-lock.yaml Removed all GraphQL and Apollo dependencies
package.json Removed GraphQL dependencies, added dev script
nest-cli.json Removed GraphQL plugin from build plugins
docker-entrypoint.sh Added DATABASE_URL construction and enhanced migration debugging
default.json Removed GraphQL configuration blocks
.gitignore Added google-services.json and bak/ directory
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +22 to +24
//import { RedisAuthGuard } from '../auth/redis-auth.guard';
import { UserEntity as User } from '../common/decorators/user.decorator';
import { ApiPaginationQuery } from './../common/decorators/api-nested-query.decorator';
//import { ApiPaginationQuery } from './../common/decorators/api-nested-query.decorator';
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented-out imports on lines 22 and 24 should be removed entirely. If RedisAuthGuard and ApiPaginationQuery are no longer needed after the GraphQL removal, delete these commented lines rather than leaving them as dead code.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to 11
//import { Field, ObjectType } from '@nestjs/graphql';
//import { GraphQLJWT } from 'graphql-scalars';
//const J = require('joi');

@ObjectType()
//@ObjectType()
export class Token {
@Field(() => GraphQLJWT, { description: 'JWT access token' })
//@Field(() => GraphQLJWT, { description: 'JWT access token' })
accessToken: string;

@Field(() => GraphQLJWT, { description: 'JWT refresh token' })
//@Field(() => GraphQLJWT, { description: 'JWT refresh token' })
refreshToken: string;
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented-out GraphQL decorators and imports should be removed entirely from this file. Lines 1-3, 5, 7, and 10 contain dead code that serves no purpose after the GraphQL removal. Clean removal would improve code clarity.

Copilot uses AI. Check for mistakes.
import { verify } from 'jsonwebtoken';

import { access_denied, account_blocked, access_token_expired_signature, authorization_failed } from '../common/errors';
//import { access_denied, account_blocked, access_token_expired_signature, authorization_failed } from '../common/errors';
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commented-out import on line 11 should be removed entirely rather than left as a comment. Dead code in comments reduces code clarity and can confuse future developers about whether this import is needed.

Copilot uses AI. Check for mistakes.
// Routes are registered under /api/* via RouterModule, so this lets both
// `/jobs` and `/api/jobs` work without changing controllers.
// NOTE: We exclude Swagger paths from rewriting.
const swaggerPath = swaggerConfig.path || 'api';
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The swaggerPath variable is defined on line 87 but never used. The middleware doesn't actually exclude Swagger paths from rewriting, despite the comment on line 86 stating that it does. This could cause issues if Swagger paths are meant to be excluded. Either implement the Swagger path exclusion logic or remove the misleading comment and unused variable.

Copilot uses AI. Check for mistakes.
Comment on lines +39 to 44
// Inject parsed values into process.env. Values from the selected env file
// OVERRIDE existing process.env values to ensure .env.local takes precedence
// over .env (which Prisma/dotenv may have auto-loaded).
for (const [k, v] of Object.entries(dotenvConfig)) {
if (process.env[k] === undefined) {
process.env[k] = v;
}
process.env[k] = v;
}
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The config helper now unconditionally overrides all process.env values with values from the .env file (line 43). This is a breaking change from the previous behavior where process.env values took precedence if already set. This could cause issues in container environments where environment variables are set externally (e.g., Kubernetes secrets, Docker Compose). Consider documenting this behavior change prominently, or reverting to only setting values when they don't already exist in process.env.

Copilot uses AI. Check for mistakes.
digitalnomad91 and others added 3 commits February 17, 2026 23:22
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@digitalnomad91 digitalnomad91 merged commit b7ad543 into main Feb 18, 2026
@digitalnomad91 digitalnomad91 deleted the refactor/remove-graphql-rest-consolidation branch February 18, 2026 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants