Trace an execution path from entry to database

Map out the complete end-to-end execution path of a single user request across layers in an unfamiliar codebase.

You getExecution Chain, data Mutations & Validations and external Side Effects & Persistence

Prompt

Prompt
Act as a senior software architect explaining an execution path through a legacy codebase.
- Trace the flow of the requested user action sequentially from routing entry point down to data persistence.
- List every method, class, or service boundary crossed, highlighting where data transforms or validations occur.
- Call out side effects such as asynchronous events, cache writes, or external API calls.
- Identify implicit assumptions, potential failure points, or hidden dependencies.
Output format:
1. Execution Chain (numbered step-by-step list showing file, method, and action)
2. Data Mutations & Validations (bulleted summary of how the payload changes)
3. External Side Effects & Persistence (database queries, message queues, network calls)
4. Architectural Risk Flags (fragile coupling or undocumented assumptions)
Here are the relevant source files and entry point:

Example output

Example for: User password reset flow in an Express/TypeORM service

1. Execution Chain
  1. routes/auth.ts (POST /api/v1/auth/reset-password): Matches HTTP route and passes payload to AuthController.resetPassword.
  2. controllers/AuthController.ts (resetPassword): Invokes validation schema against request body and forwards email to PasswordResetService.requestReset.
  3. services/PasswordResetService.ts (requestReset): Queries UserRepository.findByEmail to confirm user existence.
  4. services/TokenService.ts (generateSecureToken): Generates a 64-character crypto token with a 15-minute TTL.
  5. repositories/PasswordResetRepository.ts (saveToken): Persists hashed token record to PostgreSQL.
  6. jobs/EmailQueue.ts (dispatch): Pushes reset email event to Redis queue.
2. Data Mutations & Validations
  • Email normalized to lowercase in AuthController.
  • Raw token is hashed using SHA-256 before database insertion; plaintext is only passed to the email payload.
  • Expiry timestamp computed as Date.now() + 900000 inside PasswordResetService.
3. External Side Effects & Persistence
  • Read: SELECT * FROM users WHERE email = ? on PostgreSQL.
  • Write: INSERT INTO password_resets (user_id, token_hash, expires_at) VALUES (?, ?, ?).
  • Side Effect: Redis RPUSH to queue:notifications.
4. Architectural Risk Flags
  • No database transaction wraps the token creation and queue dispatch; an email can be queued even if the DB write fails.
  • The route does not rate-limit by IP, leaving it vulnerable to mass email triggers.
Written by AI from this prompt. Your results will vary.

Paste the relevant router, controller, service, and database repository files into Claude, ChatGPT, or Gemini along with the trigger endpoint. Ask the model to suggest integration test boundaries based on the trace.

Make it repeatable

Keep using this prompt without pasting it in every time.

Keep exploring

More in Coding