# techwithemmayt/lemon-ai-socialmedia-scheduling-saas architecture

> Architecture diagram of the GitHub repository techwithemmayt/lemon-ai-socialmedia-scheduling-saas, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas
- Repository: https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas

## Overview

Lemon AI is a social-media content planning and scheduling platform. Users connect social accounts, draft or generate posts, preview and schedule them, then manage them in calendar/list views; scheduled publishing runs asynchronously. A separate ideas workflow generates and organizes content on a Kanban board. The graph reflects documented capabilities and the supplied source excerpts/index; several route implementations and UI modules were not sampled, so their internal links are omitted or marked unverified.

Main entry points: [`lib/insforge-server.ts`](https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/lib/insforge-server.ts) (Insforge client), [`inngest/functions/publish-scheduled-posts.ts`](https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/inngest/functions/publish-scheduled-posts.ts) (Scheduled publisher), [`components/schedule/create-post-dialog.tsx`](https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/components/schedule/create-post-dialog.tsx) (Post editor), [`app/api/post/route.ts`](https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/app/api/post/route.ts) (Post API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Product interface"]
  node_dashboard["Dashboard<br/>[layout.tsx]"]
  node_schedule_page["Schedule page<br/>[page.tsx]"]
  node_schedule_views["Calendar and list<br/>[calendar-view.tsx]"]
end

subgraph group_content["Content planning"]
  node_post_editor["Post editor"]
  node_ai_assistant["AI post assistant<br/>[ai-assitant.tsx]"]
  node_channel_previews["Channel previews<br/>[index.tsx]"]
  node_ideas_board["Ideas Kanban<br/>[idea-kanban.tsx]"]
  node_idea_generator["Idea generator"]
end

subgraph group_channels["Social channels"]
  node_channel_settings["Channel settings<br/>[channels-tab.tsx]"]
  node_channel_routes["Channel API<br/>[route.ts]"]
  node_oauth_connect["OAuth connect<br/>[route.ts]"]
  node_oauth_callback["OAuth callback<br/>[route.ts]"]
  node_oauth_provider["OAuth providers<br/>[index.ts]"]
end

subgraph group_services["Application services"]
  node_posts_api["Post API<br/>[route.ts]"]
  node_post_generation["Post generation API<br/>[route.ts]"]
  node_idea_api["Ideas API<br/>[route.ts]"]
  node_idea_generation["Idea generation API<br/>[route.ts]"]
  node_backend_client["Insforge client<br/>[insforge-server.ts]"]
end

subgraph group_publishing["Scheduled publishing"]
  node_post_scheduler["Scheduled publisher"]
end

node_user(("User"))
node_insforge[("Insforge data service")]
node_clerk["Clerk authentication"]
node_social_networks["Social platforms"]
node_ai_models["Gemini models"]
node_inngest["Inngest"]

node_user -->|"uses"| node_dashboard
node_dashboard -->|"opens"| node_schedule_page
node_schedule_page -->|"renders"| node_schedule_views
node_schedule_page -->|"opens"| node_post_editor
node_post_editor -->|"renders"| node_channel_previews
node_post_editor -.->|"submits posts"| node_posts_api
node_post_editor -.->|"uses"| node_ai_assistant
node_ai_assistant -.->|"requests generation"| node_post_generation
node_post_generation -.->|"generates content"| node_ai_models
node_user -->|"organizes ideas"| node_ideas_board
node_ideas_board -->|"fetches ideas"| node_idea_api
node_ideas_board -->|"renders"| node_idea_generator
node_idea_generator -.->|"requests ideas"| node_idea_generation
node_idea_generation -.->|"generates ideas"| node_ai_models
node_user -->|"manages channels"| node_channel_settings
node_channel_settings -.->|"loads channels"| node_channel_routes
node_channel_settings -->|"starts connection"| node_oauth_connect
node_oauth_connect -->|"selects provider"| node_oauth_provider
node_oauth_callback -->|"exchanges code"| node_oauth_provider
node_oauth_provider -.->|"exchanges tokens"| node_social_networks
node_posts_api -->|"gets client"| node_backend_client
node_posts_api -->|"reads and writes posts"| node_insforge
node_idea_api -->|"uses client"| node_backend_client
node_idea_generation -->|"uses client"| node_backend_client
node_channel_routes -->|"uses client"| node_backend_client
node_backend_client -->|"gets user session"| node_clerk
node_backend_client -->|"creates client"| node_insforge
node_posts_api -->|"checks plan"| node_clerk
node_post_scheduler -->|"uses client"| node_backend_client
node_post_scheduler -.->|"loads scheduled posts"| node_insforge
node_post_scheduler -.->|"refreshes tokens"| node_oauth_provider
node_post_scheduler -.->|"publishes posts"| node_social_networks
node_inngest -.->|"dispatches"| node_post_scheduler

click node_dashboard "https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/app/(routes)/(dashboard)/layout.tsx"
click node_schedule_page "https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/app/(routes)/(dashboard)/schedule/page.tsx"
click node_schedule_views "https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/components/schedule/calendar-view.tsx"
click node_post_editor "https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/components/schedule/create-post-dialog.tsx"
click node_ai_assistant "https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/components/schedule/ai-assitant.tsx"
click node_channel_previews "https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/components/schedule/preview/index.tsx"
click node_ideas_board "https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/components/idea/idea-kanban.tsx"
click node_idea_generator "https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/components/idea/generate-ideas-popover.tsx"
click node_channel_settings "https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/components/settings/channels-tab.tsx"
click node_channel_routes "https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/app/api/channel/route.ts"
click node_oauth_connect "https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/app/api/channel/connect/route.ts"
click node_oauth_callback "https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/app/api/channel/callback/route.ts"
click node_oauth_provider "https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/lib/social-oauth/index.ts"
click node_posts_api "https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/app/api/post/route.ts"
click node_post_generation "https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/app/api/post/generate-post/route.ts"
click node_idea_api "https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/app/api/idea/route.ts"
click node_idea_generation "https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/app/api/idea/generate-ideas/route.ts"
click node_backend_client "https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/lib/insforge-server.ts"
click node_post_scheduler "https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/inngest/functions/publish-scheduled-posts.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dashboard,node_schedule_page,node_schedule_views,node_user toneBlue
class node_post_editor,node_ai_assistant,node_channel_previews,node_ideas_board,node_idea_generator,node_insforge toneAmber
class node_channel_settings,node_channel_routes,node_oauth_connect,node_oauth_callback,node_oauth_provider toneMint
class node_posts_api,node_post_generation,node_idea_api,node_idea_generation,node_backend_client toneRose
class node_post_scheduler,node_clerk,node_social_networks,node_ai_models,node_inngest toneIndigo
```

## Components

### Product interface

- [Dashboard](https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/app/(routes)/(dashboard)/layout.tsx): `app/(routes)/(dashboard)/layout.tsx`
- [Schedule page](https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/app/(routes)/(dashboard)/schedule/page.tsx): `app/(routes)/(dashboard)/schedule/page.tsx`
- [Calendar and list](https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/components/schedule/calendar-view.tsx): `components/schedule/calendar-view.tsx`

### Content planning

- [Post editor](https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/components/schedule/create-post-dialog.tsx): `components/schedule/create-post-dialog.tsx`
- [AI post assistant](https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/components/schedule/ai-assitant.tsx): `components/schedule/ai-assitant.tsx`
- [Channel previews](https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/components/schedule/preview/index.tsx): `components/schedule/preview/index.tsx`
- [Ideas Kanban](https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/components/idea/idea-kanban.tsx): `components/idea/idea-kanban.tsx`
- [Idea generator](https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/components/idea/generate-ideas-popover.tsx): `components/idea/generate-ideas-popover.tsx`

### Social channels

- [Channel settings](https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/components/settings/channels-tab.tsx): `components/settings/channels-tab.tsx`
- [Channel API](https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/app/api/channel/route.ts): `app/api/channel/route.ts`
- [OAuth connect](https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/app/api/channel/connect/route.ts): `app/api/channel/connect/route.ts`
- [OAuth callback](https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/app/api/channel/callback/route.ts): `app/api/channel/callback/route.ts`
- [OAuth providers](https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/lib/social-oauth/index.ts): `lib/social-oauth/index.ts`

### Application services

- [Post API](https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/app/api/post/route.ts): `app/api/post/route.ts`
- [Post generation API](https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/app/api/post/generate-post/route.ts): `app/api/post/generate-post/route.ts`
- [Ideas API](https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/app/api/idea/route.ts): `app/api/idea/route.ts`
- [Idea generation API](https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/app/api/idea/generate-ideas/route.ts): `app/api/idea/generate-ideas/route.ts`
- [Insforge client](https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/lib/insforge-server.ts): `lib/insforge-server.ts`

### Scheduled publishing

- [Scheduled publisher](https://github.com/techwithemmayt/lemon-ai-socialmedia-scheduling-saas/blob/main/inngest/functions/publish-scheduled-posts.ts): `inngest/functions/publish-scheduled-posts.ts`

### Other components

- **User**
- **Insforge data service**
- **Clerk authentication**
- **Social platforms**
- **Gemini models**
- **Inngest**

## Connections

- User → Dashboard: uses
- Dashboard → Schedule page: opens (evidence: `app/(routes)/(dashboard)/schedule/page.tsx`)
- Schedule page → Calendar and list: renders (evidence: `app/(routes)/(dashboard)/schedule/page.tsx`)
- Schedule page → Post editor: opens (evidence: `app/(routes)/(dashboard)/schedule/page.tsx`)
- Post editor → Channel previews: renders (evidence: `components/schedule/create-post-dialog.tsx`)
- Post editor → Post API: submits posts
- Post editor → AI post assistant: uses (evidence: `components/schedule/create-post-dialog.tsx`)
- AI post assistant → Post generation API: requests generation
- Post generation API → Gemini models: generates content
- User → Ideas Kanban: organizes ideas
- Ideas Kanban → Ideas API: fetches ideas (evidence: `components/idea/idea-kanban.tsx`)
- Ideas Kanban → Idea generator: renders (evidence: `components/idea/idea-kanban.tsx`)
- Idea generator → Idea generation API: requests ideas
- Idea generation API → Gemini models: generates ideas
- User → Channel settings: manages channels
- Channel settings → Channel API: loads channels
- Channel settings → OAuth connect: starts connection (evidence: `components/settings/channels-tab.tsx`)
- OAuth connect → OAuth providers: selects provider (evidence: `app/api/channel/connect/route.ts`)
- OAuth callback → OAuth providers: exchanges code (evidence: `app/api/channel/callback/route.ts`)
- OAuth providers → Social platforms: exchanges tokens
- Post API → Insforge client: gets client (evidence: `app/api/post/route.ts`)
- Post API → Insforge data service: reads and writes posts (evidence: `app/api/post/route.ts`)
- Ideas API → Insforge client: uses client (evidence: `app/api/idea/route.ts`)
- Idea generation API → Insforge client: uses client (evidence: `app/api/idea/generate-ideas/route.ts`)
- Channel API → Insforge client: uses client (evidence: `app/api/channel/route.ts`)
- Insforge client → Clerk authentication: gets user session (evidence: `lib/insforge-server.ts`)
- Insforge client → Insforge data service: creates client (evidence: `lib/insforge-server.ts`)
- Post API → Clerk authentication: checks plan (evidence: `app/api/post/route.ts`)
- Scheduled publisher → Insforge client: uses client (evidence: `inngest/functions/publish-scheduled-posts.ts`)
- Scheduled publisher → Insforge data service: loads scheduled posts
- Scheduled publisher → OAuth providers: refreshes tokens (evidence: `inngest/functions/publish-scheduled-posts.ts`)
- Scheduled publisher → Social platforms: publishes posts
- Inngest → Scheduled publisher: dispatches
