-
Notifications
You must be signed in to change notification settings - Fork 53
[refactor]: restructure backend for improved modularity and separation of concerns #85
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
Merged
chandansgowda
merged 10 commits into
AOSSIE-Org:main
from
smokeyScraper:codebase_restructuring
Jun 29, 2025
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3238449
[refactor]: restructure agents system architecture
smokeyScraper a6ee095
[refactor]: restructure database layer (db → database)
smokeyScraper 3efb58d
[refactor]: restructure models layer
smokeyScraper 3f842a1
[refactor]: reorganize configuration management
smokeyScraper d634726
[feat]: create services layer architecture
smokeyScraper d050114
[refactor]: restructure platform integrations (bots → integrations)
smokeyScraper 388d860
[feat]: modernize API layer structure
smokeyScraper 092b1a5
[cleanup]: remove legacy components
smokeyScraper fcc46c6
[fix]: update integration points after restructuring
smokeyScraper d5e7f84
coderabbit fixes
smokeyScraper File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...gents/devrel/nodes/gather_context_node.py → ...app/agents/devrel/nodes/gather_context.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...pp/agents/devrel/nodes/handle_faq_node.py → ...d/app/agents/devrel/nodes/handlers/faq.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ts/devrel/nodes/handle_onboarding_node.py → ...gents/devrel/nodes/handlers/onboarding.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...el/nodes/handle_technical_support_node.py → ...evrel/nodes/handlers/technical_support.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
""" | ||
API package for the Devr.AI backend. | ||
|
||
This package contains all API-related components: | ||
- router: Main API router with all endpoints | ||
- v1: Version 1 API endpoints | ||
""" | ||
|
||
from .router import api_router | ||
|
||
__all__ = ["api_router"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from fastapi import APIRouter | ||
from .v1.auth import router as auth_router | ||
from .v1.health import router as health_router | ||
|
||
api_router = APIRouter() | ||
|
||
api_router.include_router( | ||
auth_router, | ||
prefix="/v1/auth", | ||
tags=["Authentication"] | ||
) | ||
|
||
api_router.include_router( | ||
health_router, | ||
prefix="/v1", | ||
tags=["Health"] | ||
) | ||
|
||
__all__ = ["api_router"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import logging | ||
from fastapi import APIRouter, HTTPException, Depends | ||
from app.database.weaviate.client import get_weaviate_client | ||
from app.core.dependencies import get_app_instance | ||
from typing import TYPE_CHECKING | ||
|
||
if TYPE_CHECKING: | ||
from main import DevRAIApplication | ||
|
||
router = APIRouter() | ||
logger = logging.getLogger(__name__) | ||
|
||
|
||
@router.get("/health") | ||
async def health_check(app_instance: "DevRAIApplication" = Depends(get_app_instance)): | ||
""" | ||
General health check endpoint to verify services are running. | ||
|
||
Returns: | ||
dict: Status of the application and its services | ||
""" | ||
try: | ||
async with get_weaviate_client() as client: | ||
weaviate_ready = await client.is_ready() | ||
|
||
return { | ||
"status": "healthy", | ||
"services": { | ||
"weaviate": "ready" if weaviate_ready else "not_ready", | ||
"discord_bot": "running" if app_instance.discord_bot and not app_instance.discord_bot.is_closed() else "stopped" | ||
} | ||
} | ||
except Exception as e: | ||
logger.error(f"Health check failed: {e}") | ||
raise HTTPException( | ||
status_code=503, | ||
detail={ | ||
"status": "unhealthy", | ||
"error": str(e) | ||
} | ||
) from e | ||
|
||
|
||
@router.get("/health/weaviate") | ||
async def weaviate_health(): | ||
"""Check specifically Weaviate service health.""" | ||
try: | ||
async with get_weaviate_client() as client: | ||
is_ready = await client.is_ready() | ||
|
||
return { | ||
"service": "weaviate", | ||
"status": "ready" if is_ready else "not_ready" | ||
} | ||
except Exception as e: | ||
logger.error(f"Weaviate health check failed: {e}") | ||
raise HTTPException( | ||
status_code=503, | ||
detail={ | ||
"service": "weaviate", | ||
"status": "unhealthy", | ||
"error": str(e) | ||
} | ||
) from e | ||
|
||
|
||
@router.get("/health/discord") | ||
async def discord_health(app_instance: "DevRAIApplication" = Depends(get_app_instance)): | ||
"""Check specifically Discord bot health.""" | ||
try: | ||
bot_status = "running" if app_instance.discord_bot and not app_instance.discord_bot.is_closed() else "stopped" | ||
|
||
return { | ||
"service": "discord_bot", | ||
"status": bot_status | ||
} | ||
except Exception as e: | ||
logger.error(f"Discord bot health check failed: {e}") | ||
raise HTTPException( | ||
status_code=503, | ||
detail={ | ||
"service": "discord_bot", | ||
"status": "unhealthy", | ||
"error": str(e) | ||
} | ||
) from e |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .settings import settings | ||
|
||
__all__ = ["settings"] |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from fastapi import Request | ||
from typing import TYPE_CHECKING | ||
|
||
if TYPE_CHECKING: | ||
from main import DevRAIApplication | ||
|
||
async def get_app_instance(request: Request) -> "DevRAIApplication": | ||
""" | ||
Dependency to get the application instance from FastAPI's state. | ||
This avoids circular imports by using dependency injection. | ||
""" | ||
return request.app.state.app_instance |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.