How adeebmirza/intellihelper-backend works
Project type and purpose
• This is a backend-only web service (monolithic API) offering features like AI-powered chat (Chatbot), news aggregation (Intelli_News), user profiles (registration, login, JWT, email/OTP verification, profile pic), plus ancillary modules (notes, todo, resume builder, websearch, livebot).
• It exposes HTTP endpoints (in src/routes/*.py), orchestrates business logic in src/Chatbot, src/Intelli_News, src/profile, and persists data via src/database.py.
File structure
• Top-level:
– main.py: application entrypoint (starts web server, loads logger.py, database connection, mounts routers)
– logger.py: centralized logging configuration
– requirements.txt: Python dependencies (e.g., FastAPI, SQLAlchemy, external API SDKs)
• src/routes: groups HTTP route definitions by domain (auth, chat, news, profile, notes, todo, resume, websearch, livebot)
• src/Chatbot & src/Intelli_News: domain services implementing core AI logic (LLM prompts, chat definitions, news-fetching functions)
• src/profile: sub-modules for user management (email_service, otp, password hashing, JWT tokens, profile_pic uploads)
• src/database.py: handles database session setup and ORM models or raw queries
README
• README is empty—architecture hints come purely from code layout and naming.
a. Main components:
1. API Layer (main.py + route modules)
2. Business Logic Layer (Chatbot, Intelli_News, profile, notes, todo, resume, websearch, livebot modules)
3. Data Layer (database)
4. Infrastructure / External Services (SMTP/email provider, LLM service, News API, Web Search API, Cloud Storage for profile pics)
b. Relationships & interactions:
• Incoming HTTP Request → API Layer Route → invokes Business Logic → interacts with Database or External Service → returns HTTP Response
• Business Logic modules may call each other (e.g., profile module invoked by auth route)
c. Architectural patterns & design principles:
• Layered architecture: clear separation of API, domain logic, and data persistence
• Single monolith vs. microservices: although modularized, everything runs in one process
• Dependency inversion: route handlers depend on domain interfaces (e.g., Chatbot.prompt) rather than concrete HTTP code
d. Technologies, frameworks & libraries:
• FastAPI or Flask (web framework)
• SQLAlchemy or another ORM for database.py
• JWT library for token_jwt.py
• SMTP/SendGrid for email_service
• External LLM SDK (OpenAI, etc.) for Chatbot
• NewsAPI or custom HTTP client for Intelli_News
• File storage or S3 for profile_pic
Elements
– Rectangles for internal components: main.py, auth route, chat route, Chatbot module, etc.
• Blue for API components
• Green for business logic modules
• Orange for database
• Gray for external services
• main.py (entrypoint)
5. On the far right, place clouds for:
• LLM Provider (Chatbot)
• News API (Intelli_News)
• SMTP/Email provider (profile.email_service)
• Web Search API (websearch)
• Object Storage (profile_pic)
• Client → HTTP → Routes → Service modules
• Service modules → Database or External Cloud Services → back to Routes → Client