# morpheu5/unijobs-api architecture

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

- Interactive diagram: https://gitdiagram.com/morpheu5/unijobs-api
- Repository: https://github.com/morpheu5/unijobs-api

## Overview

UniJobs.it is a Rails JSON API for user accounts, organizations, content publishing, and social-post handling. Clients enter through versioned routes; controllers perform the requested operation, authorize protected actions, and return JSON backed by Active Record models. Content can include ordered blocks and is associated with an organization; creating content also creates a social-post record. Users can register, verify email, log in, and log out; the sampled controller sends verification mail and manages authentication tokens. The README gives little product detail, so capabilities are based mainly on routes and sampled controllers; model and policy internals were not sampled.

Main entry points: [`config/routes.rb`](https://github.com/morpheu5/unijobs-api/blob/master/config/routes.rb) (API routes), [`db/schema.rb`](https://github.com/morpheu5/unijobs-api/blob/master/db/schema.rb) (PostgreSQL), [`app/controllers/api/v1/users_controller.rb`](https://github.com/morpheu5/unijobs-api/blob/master/app/controllers/api/v1/users_controller.rb) (Users API), [`app/controllers/api/v1/contents_controller.rb`](https://github.com/morpheu5/unijobs-api/blob/master/app/controllers/api/v1/contents_controller.rb) (Contents API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API entry"]
  node_routes["API routes<br/>[routes.rb]"]
end

subgraph group_identity["Accounts"]
  node_users_controller["Users API"]
  node_auth_concern["Authentication<br/>[authenticatable.rb]"]
  node_user["User accounts<br/>[user.rb]"]
  node_auth_token["Auth tokens"]
  node_user_policy["User policy<br/>[user_policy.rb]"]
  node_mailer["Verification mail<br/>[user_mailer.rb]"]
end

subgraph group_publishing["Content publishing"]
  node_organizations_controller["Organizations API"]
  node_organization["Organizations<br/>[organization.rb]"]
  node_organization_policy["Organization policy"]
  node_contents_controller["Contents API"]
  node_content["Content<br/>[content.rb]"]
  node_blocks_controller["Content blocks API"]
  node_content_block["Content blocks<br/>[content_block.rb]"]
  node_content_policy["Content policy<br/>[content_policy.rb]"]
end

subgraph group_social["Social publishing"]
  node_social_controller["Social posts API"]
  node_social_post["Social posts<br/>[social_post.rb]"]
  node_social_policy["Social policy"]
end

subgraph group_persistence["Persistence"]
  node_database[("PostgreSQL<br/>[schema.rb]")]
end

node_client(("API client"))
node_email_service(("Email service"))
node_twitter(("Twitter service"))

node_client -->|"sends requests"| node_routes
node_routes -->|"dispatches"| node_users_controller
node_routes -->|"dispatches"| node_organizations_controller
node_routes -->|"dispatches"| node_contents_controller
node_routes -->|"dispatches"| node_blocks_controller
node_routes -->|"dispatches"| node_social_controller
node_users_controller -->|"reads and writes"| node_user
node_users_controller -->|"manages tokens"| node_auth_token
node_users_controller -->|"sends verification"| node_mailer
node_mailer -->|"delivers email"| node_email_service
node_users_controller -->|"authorizes"| node_user_policy
node_organizations_controller -->|"reads and writes"| node_organization
node_organizations_controller -->|"authorizes"| node_organization_policy
node_contents_controller -->|"reads and writes"| node_content
node_contents_controller -->|"authorizes"| node_content_policy
node_contents_controller -->|"creates post"| node_social_post
node_blocks_controller -->|"reads and writes"| node_content_block
node_blocks_controller -->|"authorizes"| node_content_policy
node_social_controller -->|"reads and writes"| node_social_post
node_social_controller -->|"authorizes"| node_social_policy
node_social_controller -.->|"publishes tweets"| node_twitter
node_user -->|"persists"| node_database
node_auth_token -->|"persists"| node_database
node_organization -->|"persists"| node_database
node_content -->|"persists"| node_database
node_content_block -->|"persists"| node_database
node_social_post -->|"persists"| node_database

click node_routes "https://github.com/morpheu5/unijobs-api/blob/master/config/routes.rb"
click node_users_controller "https://github.com/morpheu5/unijobs-api/blob/master/app/controllers/api/v1/users_controller.rb"
click node_auth_concern "https://github.com/morpheu5/unijobs-api/blob/master/app/controllers/concerns/v1/authenticatable.rb"
click node_user "https://github.com/morpheu5/unijobs-api/blob/master/app/models/user.rb"
click node_auth_token "https://github.com/morpheu5/unijobs-api/blob/master/app/models/authentication_token.rb"
click node_user_policy "https://github.com/morpheu5/unijobs-api/blob/master/app/policies/user_policy.rb"
click node_mailer "https://github.com/morpheu5/unijobs-api/blob/master/app/mailers/user_mailer.rb"
click node_organizations_controller "https://github.com/morpheu5/unijobs-api/blob/master/app/controllers/api/v1/organizations_controller.rb"
click node_organization "https://github.com/morpheu5/unijobs-api/blob/master/app/models/organization.rb"
click node_organization_policy "https://github.com/morpheu5/unijobs-api/blob/master/app/policies/organization_policy.rb"
click node_contents_controller "https://github.com/morpheu5/unijobs-api/blob/master/app/controllers/api/v1/contents_controller.rb"
click node_content "https://github.com/morpheu5/unijobs-api/blob/master/app/models/content.rb"
click node_blocks_controller "https://github.com/morpheu5/unijobs-api/blob/master/app/controllers/api/v1/content_blocks_controller.rb"
click node_content_block "https://github.com/morpheu5/unijobs-api/blob/master/app/models/content_block.rb"
click node_content_policy "https://github.com/morpheu5/unijobs-api/blob/master/app/policies/content_policy.rb"
click node_social_controller "https://github.com/morpheu5/unijobs-api/blob/master/app/controllers/api/v1/social_posts_controller.rb"
click node_social_post "https://github.com/morpheu5/unijobs-api/blob/master/app/models/social_post.rb"
click node_social_policy "https://github.com/morpheu5/unijobs-api/blob/master/app/policies/social_post_policy.rb"
click node_database "https://github.com/morpheu5/unijobs-api/blob/master/db/schema.rb"

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_routes,node_client toneBlue
class node_users_controller,node_auth_concern,node_user,node_auth_token,node_user_policy,node_mailer toneAmber
class node_organizations_controller,node_organization,node_organization_policy,node_contents_controller,node_content,node_blocks_controller,node_content_block,node_content_policy toneMint
class node_social_controller,node_social_post,node_social_policy toneRose
class node_database,node_email_service,node_twitter toneIndigo
```

## Components

### API entry

- [API routes](https://github.com/morpheu5/unijobs-api/blob/master/config/routes.rb): `config/routes.rb`

### Accounts

- [Users API](https://github.com/morpheu5/unijobs-api/blob/master/app/controllers/api/v1/users_controller.rb): `app/controllers/api/v1/users_controller.rb`
- [Authentication](https://github.com/morpheu5/unijobs-api/blob/master/app/controllers/concerns/v1/authenticatable.rb): `app/controllers/concerns/v1/authenticatable.rb`
- [User accounts](https://github.com/morpheu5/unijobs-api/blob/master/app/models/user.rb): `app/models/user.rb`
- [Auth tokens](https://github.com/morpheu5/unijobs-api/blob/master/app/models/authentication_token.rb): `app/models/authentication_token.rb`
- [User policy](https://github.com/morpheu5/unijobs-api/blob/master/app/policies/user_policy.rb): `app/policies/user_policy.rb`
- [Verification mail](https://github.com/morpheu5/unijobs-api/blob/master/app/mailers/user_mailer.rb): `app/mailers/user_mailer.rb`

### Content publishing

- [Organizations API](https://github.com/morpheu5/unijobs-api/blob/master/app/controllers/api/v1/organizations_controller.rb): `app/controllers/api/v1/organizations_controller.rb`
- [Organizations](https://github.com/morpheu5/unijobs-api/blob/master/app/models/organization.rb): `app/models/organization.rb`
- [Organization policy](https://github.com/morpheu5/unijobs-api/blob/master/app/policies/organization_policy.rb): `app/policies/organization_policy.rb`
- [Contents API](https://github.com/morpheu5/unijobs-api/blob/master/app/controllers/api/v1/contents_controller.rb): `app/controllers/api/v1/contents_controller.rb`
- [Content](https://github.com/morpheu5/unijobs-api/blob/master/app/models/content.rb): `app/models/content.rb`
- [Content blocks API](https://github.com/morpheu5/unijobs-api/blob/master/app/controllers/api/v1/content_blocks_controller.rb): `app/controllers/api/v1/content_blocks_controller.rb`
- [Content blocks](https://github.com/morpheu5/unijobs-api/blob/master/app/models/content_block.rb): `app/models/content_block.rb`
- [Content policy](https://github.com/morpheu5/unijobs-api/blob/master/app/policies/content_policy.rb): `app/policies/content_policy.rb`

### Social publishing

- [Social posts API](https://github.com/morpheu5/unijobs-api/blob/master/app/controllers/api/v1/social_posts_controller.rb): `app/controllers/api/v1/social_posts_controller.rb`
- [Social posts](https://github.com/morpheu5/unijobs-api/blob/master/app/models/social_post.rb): `app/models/social_post.rb`
- [Social policy](https://github.com/morpheu5/unijobs-api/blob/master/app/policies/social_post_policy.rb): `app/policies/social_post_policy.rb`

### Persistence

- [PostgreSQL](https://github.com/morpheu5/unijobs-api/blob/master/db/schema.rb): `db/schema.rb`

### Other components

- **API client**
- **Email service**
- **Twitter service**

## Connections

- API client → API routes: sends requests
- API routes → Users API: dispatches
- API routes → Organizations API: dispatches
- API routes → Contents API: dispatches
- API routes → Content blocks API: dispatches
- API routes → Social posts API: dispatches
- Users API → User accounts: reads and writes
- Users API → Auth tokens: manages tokens
- Users API → Verification mail: sends verification
- Verification mail → Email service: delivers email
- Users API → User policy: authorizes
- Organizations API → Organizations: reads and writes
- Organizations API → Organization policy: authorizes
- Contents API → Content: reads and writes
- Contents API → Content policy: authorizes
- Contents API → Social posts: creates post
- Content blocks API → Content blocks: reads and writes
- Content blocks API → Content policy: authorizes
- Social posts API → Social posts: reads and writes
- Social posts API → Social policy: authorizes
- Social posts API → Twitter service: publishes tweets
- User accounts → PostgreSQL: persists
- Auth tokens → PostgreSQL: persists
- Organizations → PostgreSQL: persists
- Content → PostgreSQL: persists
- Content blocks → PostgreSQL: persists
- Social posts → PostgreSQL: persists
