Robin (the AI sidekick)

PythonAWSDockerMongoDBLangChainOpenAIReact.js

Architecture Overview

Hover over the highlighted elements in the diagram to reveal additional details.

Backend Architecture

APIs
This API is only accessed if a valid JWT token is present in the headerThis API is only accessed if a valid JWT token is present in the header
Chats
Robin
robin.osamaaref.com
HTTPS Listener (443)
HTTP Listener (80)
Redirect
Port 8000
The container binds to the host's port 8000The container binds to the host's port 8000
    FastAPI Container     
Consists of:
Amazon ALB
A JWT token is passed in the Authorization header, if user already connected their Google account.
API Request
robin-api.osamaaref.com
If Google OAuth flow was successful, a JWT token is generated and sent back to the browser, to be passed in future requests.If Google OAuth flow was successful, a JWT token is generated and sent back to the browser, to be passed in future requests.
Auth
This is done once, when the user first connects using their Google account. An access token & a refresh token are returned, and saved in MongoDB.This is done once, when the user first connects using their Google account. An access token & a refresh token are returned, and saved in MongoDB.
Exchange OAuth code for token  
  Calendar APIs
Example document: { "_id": ....., "email": "osama.aref.dev@gmail.com", "access_token_expires_at": "2025-08-07T12:41:45.035Z", "google_access_token": "........", "google_refresh_token": "......", "refresh_token_expires_at": "2025-08-14T11:41:45.035Z" }Example document: { "_id": ....., "email": "osama.aref.dev@gmail.com", "access_token_expires_at": "2025-08-07T12:41:45.035Z", "google_access_token": "........", "google_refresh_token": "......", "refresh_token_expires_at": "2025-08-14T11:41:45.035Z" }
Collection: userTokens
Save Google token
Get Google tokem
The agent has the following components: - LLM: The model which will act as an agent. In this case it's gpt-4.1-mini, provided through OpenAI. - System prompt: instructions for the LLM on how to execute it's tasks. - Tools: functions with clear documentation. These functions provided through langchain_google_community library. E.g. CalendarSearchEvents, CalendarCreateEvent, CalendarDeleteEvent.
LangChain Agent
  OpenAI API
Domains & subdomains DNS records are managed on CloudFlare
CNAME
robin-be.osamaaref.com
AWS ELB address
DNS Records:
SSL Certificates are provided by AWS Certificate manager, once domain ownership is verified.
AWS Certificate Manager
Certificate A
osamaaref.com
Certificate B
robin.osamaaref.com
Use SSL Certificate

Frontend Architecture

Request page
robin.osamaaref.com
Robin
robin.osamaaref.com
Domains & subdomains DNS records are managed on CloudFlare
CNAME
robin.osamaaref.com
AWS CloudFront
DNS Records:
AWS S3
The bucket blocks public access, and uses OAC to allow CloudFront access.The bucket blocks public access, and uses OAC to allow CloudFront access.The bucket blocks public access, and uses OAC to allow CloudFront access.The bucket blocks public access, and uses OAC to allow CloudFront access.
Robin FE Bucket
index.html
assets/
....
AWS CloudFront
Distribution A
robin.osamaaref.com
Robin FE S3 Bucket
SSL Certificates are provided by AWS Certificate manager, once domain ownership is verified.
AWS Certificate Manager
Certificate A
osamaaref.com
Certificate B
robin.osamaaref.com
Use SSL Certificate

Project Details

Robin is a full-stack architecture demonstration showcasing modern cloud infrastructure and AI integration patterns. While the application functionality is focused and straightforward (i.e. allowing users to authenticate via Google and manage their calendar through AI-powered conversations), the primary value lies in the sophisticated backend architecture and deployment strategy implemented using AWS services and modern development practices.

Key Features

  • Google OAuth 2.0 authentication for secure user login
  • AI-powered conversational interface for calendar management
  • Natural language processing for calendar event operations (add, remove, update, search)
  • Real-time chat interface with conversation history
  • Session management with secure token handling

Technical Highlights

  • AWS Application Load Balancer (ALB) with SSL termination and traffic routing
  • VPC networking with proper security group configurations
  • FastAPI backend containerized and deployed on AWS EC2
  • AWS CloudFront CDN for frontend static asset delivery
  • OAuth 2.0 integration with Google for secure authentication
  • LangChain agent architecture for intelligent chat conversations
  • OpenAI API integration with custom prompt engineering
  • MongoDB for user token management and conversation history
  • RESTful API design with comprehensive endpoint documentation
  • JWT-based authentication with refresh token rotation

Future Improvements

  • Integrate with Telegram chatbot for easier chatting experience
  • Explore integration with other productivity tools beyond Google Calendar
  • Add logging of conversations to learn from previous patterns and provide customized suggestions