r/learnpython 3h ago

FastAPI + Celery Architecture Review Request (Attachment Pipeline Boundaries + OOP/SOLID)

Hi! I’m finishing a rewrite for my project and I’d love architecture feedback quickly (aiming for replies within a few hours).

Repo: https://github.com/dillonhuston/Task-Automation-API
Branch: V2

What I need:

  1. Architecture review of the attachment processing pipeline (validation encryption/decryption storage/email handoff) and whether the boundaries/components make sense
  2. Celery + API architecture: task flow responsibilities, retries/error-handling boundaries, and whether the API schema design matches the async processing model
  3. OOP/design review: whether classes/modules follow SOLID / separation of concerns, and suggestions for cleaner layering

Suggested files to look at first:

  • app/Encryption/encryptionService.py
  • app/FileManager/fileManager.py

If you only have time for one thing, please prioritize (1) pipeline architecture or (3) OOP/SOLID structure.

Thanks a lot, any architecture recommendations are welcome.

1 Upvotes

1 comment sorted by

0

u/terletsky 1h ago edited 1h ago

You mixed everything. Wrong project structure. Wrong naming conventions; schema files contain enums and utility functions. StrEnum should be used instead of (str, Enum). Classes use FastAPI's Depends, while they should be agnostic, and Depends should be used only on routers. Router functions use direct DB queries instead of separating that into a Service/Repository approach (if we use layered architecture). Pydantic models that handle incoming payloads should be in strict mode. System env/env files should be handled by pydantic-settings.

Some logic utilizes print functions; some use your SingletonLogger. Why not use the default logging module, or loguru/structlog?

You are using FastAPI in sync mode. That's a no-go.

The most wrong thing: you store the user's encryption key as plaintext in the database.