Skip to main content

w3-web-services

Purpose

Apollo Federation subgraph that provides email summaries, GitHub repository operations, and user profile data.

Architecture

  • Apollo subgraph using @apollo/server + @apollo/subgraph.
  • Loads config from AWS SSM Parameter Store then .env.
  • Verifies Cognito JWTs when Authorization: Bearer <token> is present.
  • MongoDB (MONGODB_CONNECTION_STRING) stores user tokens and profile data.
  • SQS consumer reads signup events and creates users in MongoDB.
  • Gmail: uses Google OAuth tokens + Gmail API; summarization uses Google GenAI.
  • Microsoft: uses Microsoft Graph API for email list/detail and summary.
  • GitHub: uses GitHub API to list repos/orgs and clones repos to /tmp/github-repos for git grep search.

GraphQL API

Queries:

  • summaryEmail(input: SummaryEmailInput): EmailSummaryResponse! (provider: gmail or microsoft)
  • agentSummaryEmail(emailContent: String!): AgentSummaryEmailResponse!
  • me(input: MeInput): User
  • getGcpListEmail(limit: Int, pageToken: String): EmailListResponse
  • getGcpEmailDetail(input: GetGcpEmailDetailInput): EmailDetail
  • getMicrosoftListEmail(limit: Int, offset: Int): EmailListResponse
  • getMicrosoftEmailDetail(input: GetMicrosoftEmailDetailInput): EmailDetail
  • getUserRepositories: [GitHubRepository!]!
  • getUserOrganizations: [GitHubOrganization!]!
  • getOrganizationRepositories(input: GetOrganizationRepositoriesInput!): [GitHubRepository!]!
  • searchInRepositories(input: SearchInRepositoriesInput!): SearchInRepositoriesResponse!

Mutations:

  • generateGcpAuthUrl: GenerateGcpAuthUrlResponse
  • generateMicrosoftAuthUrl: GenerateMicrosoftAuthUrlResponse
  • generateGithubAuthUrl: GenerateGithubAuthUrlResponse
  • revokeGmailToken: RevokeTokenResponse
  • revokeMicrosoftToken: RevokeTokenResponse
  • revokeGithubToken: RevokeGithubTokenResponse
  • syncRepository(repoName: String!, branch: String): SyncRepositoryResponse!

Configuration highlights

  • AWS_REGION, COGNITO_USER_POOL_ID, COGNITO_CLIENT_ID
  • MONGODB_CONNECTION_STRING, MONGODB_MAX_POOL_SIZE
  • SQS_SIGN_UP_HANDLER_QUEUE
  • GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET, GITHUB_REDIRECT_URI