# tiodwisatrio/sosmedhub architecture

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

- Interactive diagram: https://gitdiagram.com/tiodwisatrio/sosmedhub
- Repository: https://github.com/tiodwisatrio/sosmedhub

## Overview

Sosmedhub is a Laravel application for scheduling Instagram posts. Its main workflow is account registration and approval, connecting an Instagram Business account through Facebook, composing and scheduling media with a caption, then automatic publication and failure notification. The graph also preserves account administration, post history, and the shared user/account/post data layer. Relationships for unsampled publishing, Facebook OAuth, and notification internals are shown only where the README documents the behavior; their implementation details were not inspected.

Main entry points: [`Modules/Scheduler/app/Http/Controllers/Admin/ScheduledPostController.php`](https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/Scheduler/app/Http/Controllers/Admin/ScheduledPostController.php) (Post composer), [`Modules/Scheduler/app/Services/ScheduledPostService.php`](https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/Scheduler/app/Services/ScheduledPostService.php) (Post service), [`Modules/Scheduler/app/Jobs/PublishScheduledPostJob.php`](https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/Scheduler/app/Jobs/PublishScheduledPostJob.php) (Publish job), [`Modules/SocialAccount/app/Models/SocialAccount.php`](https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/SocialAccount/app/Models/SocialAccount.php) (Connected account)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Access &amp; accounts"]
  node_user["User<br/>[User.php]"]
  node_auth["Registration &amp; login<br/>[auth.php]"]
  node_approval["Approval gate"]
  node_account_admin["Account management"]
  node_facebook_oauth["Facebook connect"]
  node_instagram_graph["Instagram API"]
end

subgraph group_composition["Post scheduling"]
  node_post_admin["Post composer"]
  node_post_validation["Post validation"]
  node_slot_rule["Schedule slots<br/>[OnScheduleSlot.php]"]
  node_post_service["Post service"]
  node_media_processor["Media processing<br/>[MediaProcessor.php]"]
end

subgraph group_delivery["Publishing"]
  node_due_dispatch["Due-post dispatch"]
  node_publish_job["Publish job"]
  node_publication_runner["Publication runner"]
  node_instagram_publisher["Instagram publisher"]
  node_failure_notice["Failure notification"]
end

subgraph group_foundation["Shared data"]
  node_social_account[("Connected account<br/>[SocialAccount.php]")]
  node_scheduled_post[("Scheduled post<br/>[ScheduledPost.php]")]
  node_post_media[("Post media")]
  node_publication[("Publication records")]
end

node_creator(("Post creator"))
node_scheduler(("Laravel scheduler"))
node_instagram["Instagram"]
node_facebook["Facebook"]

node_creator -->|"registers / signs in"| node_auth
node_auth -.->|"enters gated app"| node_approval
node_creator -->|"connects account"| node_facebook_oauth
node_facebook_oauth -->|"authorizes through"| node_facebook
node_account_admin -->|"requests profile / tokens"| node_instagram_graph
node_account_admin -->|"persists account"| node_social_account
node_user -->|"owns"| node_social_account
node_creator -->|"composes and schedules"| node_post_admin
node_post_admin -->|"validates formats"| node_post_validation
node_post_admin -->|"checks schedule slot"| node_slot_rule
node_post_admin -->|"stores or updates"| node_post_service
node_post_admin -->|"selects account"| node_social_account
node_post_service -->|"writes post"| node_scheduled_post
node_post_service -->|"manages media"| node_post_media
node_post_service -->|"manages formats"| node_publication
node_post_service -->|"processes uploads"| node_media_processor
node_scheduler -.->|"runs due checks"| node_due_dispatch
node_due_dispatch -.->|"dispatches due posts"| node_publish_job
node_publish_job -.->|"runs publication"| node_publication_runner
node_publication_runner -.->|"publishes media"| node_instagram_publisher
node_instagram_publisher -->|"publishes to"| node_instagram
node_publish_job -.->|"notifies on failure"| node_failure_notice

click node_user "https://github.com/tiodwisatrio/sosmedhub/blob/main/app/Models/User.php"
click node_auth "https://github.com/tiodwisatrio/sosmedhub/blob/main/routes/auth.php"
click node_approval "https://github.com/tiodwisatrio/sosmedhub/blob/main/app/Http/Middleware/EnsureUserIsApproved.php"
click node_account_admin "https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/SocialAccount/app/Http/Controllers/Admin/SocialAccountController.php"
click node_facebook_oauth "https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/SocialAccount/app/Http/Controllers/Admin/FacebookConnectController.php"
click node_instagram_graph "https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/SocialAccount/app/Services/InstagramGraphService.php"
click node_social_account "https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/SocialAccount/app/Models/SocialAccount.php"
click node_post_admin "https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/Scheduler/app/Http/Controllers/Admin/ScheduledPostController.php"
click node_post_validation "https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/Scheduler/app/Http/Requests/Concerns/ValidatesPostFormats.php"
click node_slot_rule "https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/Scheduler/app/Rules/OnScheduleSlot.php"
click node_post_service "https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/Scheduler/app/Services/ScheduledPostService.php"
click node_media_processor "https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/Scheduler/app/Services/MediaProcessor.php"
click node_scheduled_post "https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/Scheduler/app/Models/ScheduledPost.php"
click node_post_media "https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/Scheduler/app/Models/ScheduledPostMedia.php"
click node_publication "https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/Scheduler/app/Models/ScheduledPostPublication.php"
click node_due_dispatch "https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/Scheduler/app/Console/DispatchDuePostsCommand.php"
click node_publish_job "https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/Scheduler/app/Jobs/PublishScheduledPostJob.php"
click node_publication_runner "https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/Scheduler/app/Services/PublicationRunner.php"
click node_instagram_publisher "https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/SocialAccount/app/Services/InstagramPublisher.php"
click node_failure_notice "https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/Scheduler/app/Notifications/PostFailedNotification.php"

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_user,node_auth,node_approval,node_account_admin,node_facebook_oauth,node_instagram_graph toneBlue
class node_post_admin,node_post_validation,node_slot_rule,node_post_service,node_media_processor toneAmber
class node_due_dispatch,node_publish_job,node_publication_runner,node_instagram_publisher,node_failure_notice toneMint
class node_social_account,node_scheduled_post,node_post_media,node_publication,node_scheduler toneRose
class node_creator,node_instagram,node_facebook toneIndigo
```

## Components

### Access & accounts

- [User](https://github.com/tiodwisatrio/sosmedhub/blob/main/app/Models/User.php): `app/Models/User.php`
- [Registration & login](https://github.com/tiodwisatrio/sosmedhub/blob/main/routes/auth.php): `routes/auth.php`
- [Approval gate](https://github.com/tiodwisatrio/sosmedhub/blob/main/app/Http/Middleware/EnsureUserIsApproved.php): `app/Http/Middleware/EnsureUserIsApproved.php`
- [Account management](https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/SocialAccount/app/Http/Controllers/Admin/SocialAccountController.php): `Modules/SocialAccount/app/Http/Controllers/Admin/SocialAccountController.php`
- [Facebook connect](https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/SocialAccount/app/Http/Controllers/Admin/FacebookConnectController.php): `Modules/SocialAccount/app/Http/Controllers/Admin/FacebookConnectController.php`
- [Instagram API](https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/SocialAccount/app/Services/InstagramGraphService.php): `Modules/SocialAccount/app/Services/InstagramGraphService.php`

### Post scheduling

- [Post composer](https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/Scheduler/app/Http/Controllers/Admin/ScheduledPostController.php): `Modules/Scheduler/app/Http/Controllers/Admin/ScheduledPostController.php`
- [Post validation](https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/Scheduler/app/Http/Requests/Concerns/ValidatesPostFormats.php): `Modules/Scheduler/app/Http/Requests/Concerns/ValidatesPostFormats.php`
- [Schedule slots](https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/Scheduler/app/Rules/OnScheduleSlot.php): `Modules/Scheduler/app/Rules/OnScheduleSlot.php`
- [Post service](https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/Scheduler/app/Services/ScheduledPostService.php): `Modules/Scheduler/app/Services/ScheduledPostService.php`
- [Media processing](https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/Scheduler/app/Services/MediaProcessor.php): `Modules/Scheduler/app/Services/MediaProcessor.php`

### Publishing

- [Due-post dispatch](https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/Scheduler/app/Console/DispatchDuePostsCommand.php): `Modules/Scheduler/app/Console/DispatchDuePostsCommand.php`
- [Publish job](https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/Scheduler/app/Jobs/PublishScheduledPostJob.php): `Modules/Scheduler/app/Jobs/PublishScheduledPostJob.php`
- [Publication runner](https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/Scheduler/app/Services/PublicationRunner.php): `Modules/Scheduler/app/Services/PublicationRunner.php`
- [Instagram publisher](https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/SocialAccount/app/Services/InstagramPublisher.php): `Modules/SocialAccount/app/Services/InstagramPublisher.php`
- [Failure notification](https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/Scheduler/app/Notifications/PostFailedNotification.php): `Modules/Scheduler/app/Notifications/PostFailedNotification.php`

### Shared data

- [Connected account](https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/SocialAccount/app/Models/SocialAccount.php): `Modules/SocialAccount/app/Models/SocialAccount.php`
- [Scheduled post](https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/Scheduler/app/Models/ScheduledPost.php): `Modules/Scheduler/app/Models/ScheduledPost.php`
- [Post media](https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/Scheduler/app/Models/ScheduledPostMedia.php): `Modules/Scheduler/app/Models/ScheduledPostMedia.php`
- [Publication records](https://github.com/tiodwisatrio/sosmedhub/blob/main/Modules/Scheduler/app/Models/ScheduledPostPublication.php): `Modules/Scheduler/app/Models/ScheduledPostPublication.php`

### Other components

- **Post creator**
- **Laravel scheduler**
- **Instagram**
- **Facebook**

## Connections

- Post creator → Registration & login: registers / signs in (evidence: `README.md`)
- Registration & login → Approval gate: enters gated app
- Post creator → Facebook connect: connects account (evidence: `README.md`)
- Facebook connect → Facebook: authorizes through (evidence: `README.md`)
- Account management → Instagram API: requests profile / tokens (evidence: `Modules/SocialAccount/app/Http/Controllers/Admin/SocialAccountController.php`)
- Account management → Connected account: persists account (evidence: `Modules/SocialAccount/app/Http/Controllers/Admin/SocialAccountController.php`)
- User → Connected account: owns (evidence: `Modules/SocialAccount/app/Models/SocialAccount.php`)
- Post creator → Post composer: composes and schedules (evidence: `README.md`)
- Post composer → Post validation: validates formats
- Post composer → Schedule slots: checks schedule slot
- Post composer → Post service: stores or updates (evidence: `Modules/Scheduler/app/Http/Controllers/Admin/ScheduledPostController.php`)
- Post composer → Connected account: selects account (evidence: `Modules/Scheduler/app/Http/Controllers/Admin/ScheduledPostController.php`)
- Post service → Scheduled post: writes post (evidence: `Modules/Scheduler/app/Services/ScheduledPostService.php`)
- Post service → Post media: manages media (evidence: `Modules/Scheduler/app/Services/ScheduledPostService.php`)
- Post service → Publication records: manages formats (evidence: `Modules/Scheduler/app/Services/ScheduledPostService.php`)
- Post service → Media processing: processes uploads (evidence: `Modules/Scheduler/app/Services/ScheduledPostService.php`)
- Laravel scheduler → Due-post dispatch: runs due checks
- Due-post dispatch → Publish job: dispatches due posts
- Publish job → Publication runner: runs publication
- Publication runner → Instagram publisher: publishes media
- Instagram publisher → Instagram: publishes to (evidence: `README.md`)
- Publish job → Failure notification: notifies on failure (evidence: `README.md`)
