CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/separation-of-concerns

Enforce strict three-layer architecture: thin HTTP routes, pure service logic with domain errors, isolated data access with dependency injection.

94

1.08x
Quality

93%

Does it follow best practices?

Impact

97%

1.08x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-5/

User Registration Flow

Problem/Feature Description

A fintech startup is launching a consumer app that requires users to register with their name, email address, date of birth, and an initial deposit amount. The registration flow has several requirements: the company is regulated and must send a welcome email to every new user, emit an analytics event for their growth team, and notify a compliance webhook when a user's initial deposit exceeds $10,000.

The backend engineer needs to implement the registration endpoint. Past implementations at the company have had bugs where welcome emails were accidentally sent twice (once in the route, once in the service), or where the analytics event was skipped if an error occurred mid-route. The tech lead wants a clean separation so that these post-registration side effects are reliable and testable.

The business rules are:

  • Email must be a valid email format (contains @ and a domain)
  • Date of birth must make the user at least 18 years old
  • Initial deposit must be between $1 and $1,000,000
  • A user with the same email cannot be registered twice

Output Specification

Produce TypeScript files:

  • src/routes/users.ts — HTTP route handler for POST /api/users
  • src/services/userService.ts — Business logic for registration
  • src/repositories/userRepo.ts — Data access (in-memory stub is fine)
  • src/errors/domain.ts — Domain error types

Also produce side-effects-notes.md that documents which side effects are triggered, where in the code they are triggered, and why they are placed there.

evals

tile.json