Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT: Project Refactoring #357

Open
gcharest opened this issue Jan 11, 2024 · 3 comments
Open

FEAT: Project Refactoring #357

gcharest opened this issue Jan 11, 2024 · 3 comments
Assignees

Comments

@gcharest
Copy link
Contributor

gcharest commented Jan 11, 2024

In order to make the management of the bot easier and more scalable in terms of feature development, a project refactoring might be beneficial.

Proposed future state:

.
├── api                      # API endpoints
│   ├── __init__.py
│   ├── auth.py              # Authentication and authorization
│   ├── geolocation.py       # Geolocation API
│   ├── utils.py             # Utility functions and classes for APIs
│   └── tests                # Tests for the APIs
│       ├── __init__.py
│       ├── test_auth.py
│       ├── test_geolocation.py
│       └── test_utils.py
├── bot                     # Main bot application
│   ├── __init__.py
│   ├── main.py             # Entry point
│   ├── settings.py         # Configuration settings
│   ├── commands            # Bot commands
│   ├── events              # Event handlers
│   ├── middleware          # Middleware components
│   └── utils               # Utility functions and classes
├── integrations            # Integrations with external services
│   ├── __init__.py
│   ├── service1            # Integration with Service 1
│   │   ├── __init__.py
│   │   ├── auth.py         # Authentication with Service 1
│   │   ├── permissions.py  # Permissions handling for Service 1
│   │   ├── requests.py     # Requests to Service 1
│   │   └── utils.py        # Utility functions and classes for Service 1
│   ├── service2            # Integration with Service 2
│   │   ├── __init__.py
│   │   ├── auth.py         # Authentication with Service 2
│   │   ├── permissions.py  # Permissions handling for Service 2
│   │   ├── requests.py     # Requests to Service 2
│   │   └── utils.py        # Utility functions and classes for Service 2
│   └── ...
├── locales                  # Localization files
│   ├── en                   # English
│   │   └── messages.po      # English translations
│   ├── fr                   # French
│   │   └── messages.po      # French translations
│   ├── de                   # German
│   │   └── messages.po      # German translations
│   └── ...
├── plugins                 # Individual plugins
│   ├── plugin1
│   │   ├── __init__.py
│   │   ├── commands.py
│   │   ├── events.py
│   │   └── utils.py
│   ├── plugin2
│   │   ├── __init__.py
│   │   ├── commands.py
│   │   ├── events.py
│   │   └── utils.py
│   └── ...
├── tests                   # Unit tests
│   ├── __init__.py
│   ├── test_commands.py
│   ├── test_events.py
│   ├── test_middleware.py
│   ├── test_utils.py
│   ├── plugins             # Tests for plugins
│   │   ├── test_plugin1.py
│   │   ├── test_plugin2.py
│   │   └── ...
│   └── integrations        # Tests for integrations
│       ├── test_service1.py
│       ├── test_service2.py
│       └── ...
├── .env                    # Environment variables
├── .gitignore              # Specifies intentionally untracked files to ignore
├── Dockerfile              # Dockerfile
├── Makefile                # Makefile
├── README.md               # Project description
├── requirements.txt        # Python dependencies
└── requirements_dev.txt    # Python dependencies for development
@gcharest gcharest self-assigned this Jan 11, 2024
@gcharest
Copy link
Contributor Author

Actually, this is pretty much the architecture I'd like to be able to achieve:

image

https://backstage.io/docs/backend-system/architecture/index

@gcharest
Copy link
Contributor Author

Additionally, we could introduce health checks at integration level so that we can more easily manage the possible errors

@patheard
Copy link
Member

patheard commented Jan 17, 2024

Had a look and I like the architecture you've proposed! My only comment would be around the test structure. How would you feel about moving the api tests under the root test folder so you ended up with:

├── tests                   # Unit tests
│   ├── __init__.py
│   ├── test_commands.py
│   ├── test_events.py
│   ├── test_middleware.py
│   ├── test_utils.py
│   ├── api                # Tests for the APIs
│   │   ├── __init__.py
│   │   ├── test_auth.py
│   │   ├── test_geolocation.py
│   │   └── test_utils.py
│   ├── plugins             # Tests for plugins
│   │   ├── test_plugin1.py
│   │   ├── test_plugin2.py
│   │   └── ...
│   └── integrations        # Tests for integrations
│       ├── test_service1.py
│       ├── test_service2.py
│       └── ...

Would just keep all the tests nice and grouped in one spot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants