{"id":21540489,"url":"https://github.com/othercodes/technical-assessment-console-twitter","last_synced_at":"2025-03-17T21:45:50.829Z","repository":{"id":78684528,"uuid":"247561867","full_name":"othercodes/technical-assessment-console-twitter","owner":"othercodes","description":"Small twitter-like cli app for technical interview propose.","archived":false,"fork":false,"pushed_at":"2020-04-02T15:55:16.000Z","size":102,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-24T08:12:30.293Z","etag":null,"topics":["ddd","hexagonal-architecture","technical-interviews"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/othercodes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-03-15T22:23:17.000Z","updated_at":"2024-02-12T08:55:06.000Z","dependencies_parsed_at":"2023-07-11T15:15:58.398Z","dependency_job_id":null,"html_url":"https://github.com/othercodes/technical-assessment-console-twitter","commit_stats":null,"previous_names":["othercodes/technical-assessment-console-twitter"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/othercodes%2Ftechnical-assessment-console-twitter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/othercodes%2Ftechnical-assessment-console-twitter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/othercodes%2Ftechnical-assessment-console-twitter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/othercodes%2Ftechnical-assessment-console-twitter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/othercodes","download_url":"https://codeload.github.com/othercodes/technical-assessment-console-twitter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244117094,"owners_count":20400739,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ddd","hexagonal-architecture","technical-interviews"],"created_at":"2024-11-24T04:19:06.845Z","updated_at":"2025-03-17T21:45:50.800Z","avatar_url":"https://github.com/othercodes.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ConsoleTwitter \n\nImplement a console-based social networking application (similar to Twitter) satisfying the scenarios below.\n\n## Architecture \n\nThis application has been refactored to follow the hexagonal architecture. \n\n 1. **Infrastructure**: Database specific connectors all 3th part dependant goes here.\n 2. **Application**: Entry point of the application, receives the input data and calls the domain logic.\n 3. **Domain**: all the business logic goes here. \n\n## Life Cycle\n\n 1. [Infrastructure] The application receives the I/O (InputArguments and OutputWriter).\n 2. [Infrastructure] The application load the Kernel and pass the I/O to it.\n 3. [Infrastructure] The kernel retrieves the input commands and parses it into a pair of command name and arguments list.\n 4. [Infrastructure] The kernel load the command and pass the arguments to it.\n 5. [Application] The command call the different Application Services.\n 6. [Domain] The Application Services executes Domain logic.\n\n## Directory Structure\n\nThe repo contains two main directories:\n\n- **applications/**: Contains the CLI specific application.\n- **src/**: Holds the business logic.\n\n```bash\nsrc/\n├── Shared\n│   ├── Application\n│   │   ├── Container.php\n│   │   ├── Contracts\n│   │   │   ├── Container.php\n│   │   │   ├── Input.php\n│   │   │   ├── Kernel.php\n│   │   │   └── Output.php\n│   │   └── Provider.php\n│   ├── Domain\n│   │   ├── Collection.php\n│   │   ├── functions.php\n│   │   └── ValueObject\n│   │       └── StringValueObject.php\n│   └── Infrastructure\n│       └── Persistence\n│           └── DatabaseSQLite\n│               ├── Connector.php\n│               ├── Exceptions\n│               └── Query.php\n└── SocialNetwork\n    ├── Messages\n    │   ├── Domain\n    │   │   ├── Contracts\n    │   │   │   └── MessagesRepository.php\n    │   │   ├── MessageCreated.php\n    │   │   ├── MessageId.php\n    │   │   ├── MessageOwnerId.php\n    │   │   ├── Message.php\n    │   │   ├── MessageText.php\n    │   │   └── Services\n    │   │       ├── MessageCreator.php\n    │   │       └── MessageFinder.php\n    │   └── Infrastructure\n    │       └── Persistence\n    │           └── DatabaseSQLiteMessagesRepository.php\n    ├── Shared\n    │   └── Application\n    │       ├── Contracts\n    │       │   └── Formatter.php\n    │       ├── Formatter.php\n    │       ├── Subscriber.php\n    │       ├── TimelinePublisher.php\n    │       ├── TimelineReader.php\n    │       └── WallReader.php\n    ├── Subscriptions\n    │   ├── Application\n    │   │   ├── SubscriptionCreator.php\n    │   │   └── SubscriptionFinder.php\n    │   ├── Domain\n    │   │   ├── Contracts\n    │   │   │   └── SubscriptionsRepository.php\n    │   │   ├── Exceptions\n    │   │   │   ├── InvalidSubscribeToException.php\n    │   │   │   ├── SubscriberAlreadySubscribedException.php\n    │   │   │   └── SubscriptionNotFoundException.php\n    │   │   ├── SubscribedId.php\n    │   │   ├── SubscriberId.php\n    │   │   ├── SubscriptionId.php\n    │   │   └── Subscription.php\n    │   └── Infrastructure\n    │       └── Persistence\n    │           └── DatabaseSQLiteSubscriptionsRepository.php\n    └── Users\n        ├── Domain\n        │   ├── Contracts\n        │   │   └── UserRepository.php\n        │   ├── Exceptions\n        │   │   └── UserNotFoundException.php\n        │   ├── Services\n        │   │   └── UserFinder.php\n        │   ├── UserId.php\n        │   ├── UserName.php\n        │   └── User.php\n        └── Infrastructure\n            └── Persistence\n                └── DatabaseSQLiteUsersRepository.php\n```\n\n## Running the application \n\nTo run image just build the docker image and run a new container:\n\n ```bash\n# build the image\ndocker build . -t othercode/console-twitter:latest\n\n# cleanup the intermediate images\ndocker rmi $(sudo docker images -f dangling=true -q)\n\n# run the container \ndocker run -it --rm othercode/console-twitter:latest\n```\n\n## Scenarios\n\nQuit: Any user can exit the application.\n\n```\n\u003e alice quit\n``` \n\nPosting: Alice can publish messages to a personal timeline\n \n```\n\u003e Alice -\u003e I love the weather today\n\u003e Bob -\u003e Damn! We lost!\n\u003e Bob -\u003e Good game though.\n```\n\nReading: Bob can view Alice’s timeline\n \n```\n\u003e Alice\nI love the weather today (5 minutes ago)\n\u003e Bob\nGood game though. (1 minute ago)\nDamn! We lost! (2 minutes ago)\n```\n\nFollowing: Charlie can subscribe to Alice’s and Bob’s timelines, and view an aggregated list of all subscriptions\n \n```\n\u003e Charlie -\u003e I'm in New York today! Anyone want to have a coffee?\n\u003e Charlie follows Alice\n\u003e Charlie wall\nCharlie - I'm in New York today! Anyone want to have a coffee? (2 seconds ago)\nAlice - I love the weather today (5 minutes ago)\n\n\u003e Charlie follows Bob\n\u003e Charlie wall\nCharlie - I'm in New York today! Anyone wants to have a coffee? (15 seconds ago)\nBob - Good game though. (1 minute ago)\nBob - Damn! We lost! (2 minutes ago)\nAlice - I love the weather today (5 minutes ago)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fothercodes%2Ftechnical-assessment-console-twitter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fothercodes%2Ftechnical-assessment-console-twitter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fothercodes%2Ftechnical-assessment-console-twitter/lists"}