CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/flask-best-practices

Flask patterns -- application factory, blueprints, error handlers, extensions, request lifecycle, configuration, logging, CLI commands

98

1.28x
Quality

98%

Does it follow best practices?

Impact

98%

1.28x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-2/

Event Registration Platform

Problem/Feature Description

A community center needs a Flask API for managing events and registrations. They host workshops, meetups, and classes. The API should handle events (title, description, date, max_attendees, location) and registrations (attendee_name, attendee_email, event_id, registered_at).

Requirements:

  1. Create, list, and get events.
  2. Register attendees for an event -- reject if the event is full (registrations >= max_attendees).
  3. List registrations for a specific event.
  4. Cancel a registration (DELETE).
  5. A GET /api/events?upcoming=true filter to show only future events.
  6. Each request should have a unique request ID (X-Request-ID header), generated if not provided by the client, and returned in the response.
  7. All timestamps should be ISO 8601 format.
  8. Proper logging -- each request should be logged with its request ID.

The system should be well-structured so that a junior developer can understand and extend it.

Output Specification

Produce Python source files in a event-platform/ directory:

  • app/__init__.py -- application factory
  • app/extensions.py -- extension instances
  • app/errors.py -- custom exceptions and error handlers
  • app/db.py -- data store (in-memory or SQLite)
  • app/routes/events.py -- events blueprint
  • app/routes/registrations.py -- registrations blueprint
  • tests/conftest.py -- test fixtures
  • run.py -- entry point
  • requirements.txt

Do not run pip install or start the server.

evals

tile.json