Skip to content

[ARCHITECTURE][API DRIFT] Consolidate duplicate serverless and Express domain handlers #184

Description

@BigDella

Summary

Prompt Hash implements overlapping prompt, version, webhook, and marketplace behavior in both root api/ functions and server/src/ controllers/routes. Security and validation fixes can land in one path while deployments continue serving the other, creating behavior drift.

Repository evidence

  • api/prompts/version.ts and server/src/controllers/versioningControllers.ts independently implement prompt-version behavior.
  • api/webhooks/* and server/src/routes/webhooks.ts expose parallel webhook stacks.
  • Root serverless handlers and the Express application use separate middleware, error mapping, and runtime configuration.

Scope

  • Inventory duplicate production entrypoints and select one authoritative domain service per capability.
  • Make each deployment adapter call shared validation, authorization, and business logic.
  • Add parity tests or remove unsupported duplicate routes with an explicit compatibility plan.

Acceptance criteria

  • A security or validation rule has one authoritative implementation regardless of deployment adapter.
  • Supported serverless and Express endpoints pass the same contract fixtures.
  • Deprecated duplicate routes have documented migration and cannot remain silently deployed.

Tests

  • Cross-adapter contract tests for prompt versioning and webhooks, auth/error parity, and a CI check that detects new duplicated domain logic.

Non-goals

  • Forcing a hosting-platform migration or rewriting unrelated frontend code.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third Campaign

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions