{"id":15564320,"url":"https://github.com/pointerish/ashurbanipal","last_synced_at":"2025-03-29T05:13:48.221Z","repository":{"id":73432616,"uuid":"473051695","full_name":"pointerish/ashurbanipal","owner":"pointerish","description":"An Elixir aggregator for Hacker News' top 50 stories","archived":false,"fork":false,"pushed_at":"2022-03-28T07:02:50.000Z","size":28,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T00:58:01.386Z","etag":null,"topics":["elixir","hacker-news","otp"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"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/pointerish.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,"publiccode":null,"codemeta":null}},"created_at":"2022-03-23T05:42:11.000Z","updated_at":"2022-03-28T07:05:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"39eb0fd5-c8e1-4057-b912-d60e108acb6a","html_url":"https://github.com/pointerish/ashurbanipal","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pointerish%2Fashurbanipal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pointerish%2Fashurbanipal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pointerish%2Fashurbanipal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pointerish%2Fashurbanipal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pointerish","download_url":"https://codeload.github.com/pointerish/ashurbanipal/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246140594,"owners_count":20729802,"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":["elixir","hacker-news","otp"],"created_at":"2024-10-02T16:40:33.211Z","updated_at":"2025-03-29T05:13:48.202Z","avatar_url":"https://github.com/pointerish.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](https://img.shields.io/badge/Elixir/OTP-purple)\n![](https://img.shields.io/badge/Erlang-blue)\n# Ashurbanipal\n\n[Ashurbanipal](https://en.wikipedia.org/wiki/Ashurbanipal) is an aggregator API that serves Hacker News' top 50 stories. It is built using Elixir/OTP and without using [Phoenix](https://www.phoenixframework.org/) or a database to store data. It uses ETS to store Hacker News' stories in memory.\n\nIt was named after the last great Assyrian king who was fond of collecting clay tablets in his library. He is the reason why we still have the [Epic of Gilgamesh](https://en.wikipedia.org/wiki/Epic_of_Gilgamesh).\n\n## Features\n\n* JSON API over HTTP\n\n## Usage\n\nClone the repository and run the following commands:\n\nIf you're running a Unix-like system:\u003cbr/\u003e\u003cbr/\u003e\n`export MIX_ENV=prod` \n\u003cbr/\u003e\u003cbr/\u003e\nIf you're running Windows:\u003cbr/\u003e\u003cbr/\u003e\n`setx MIX_ENV \"prod\"`\n\nAfter the environment variable is set, run the following:\n\n`mix release`\n\nFinally, run:\n\n`_build/prod/rel/ashurbanipal/bin/ashurbanipal start`\n\n## Tests\n\nTo run the test suite, run the following command:\n\n`mix test`\n\n## Approach\n\nThis projects inteds to use pure OTP, no databases or Phoenix. When the application starts, the Supervisor will initialize the `Ashurbanipal.Stories` and the `Ashurbanipal.Scheduler` GenServers.\n\nIt will also start a `Cowboy` server that will handle requests via the `Ashurbanipal.Router` module.\n\nThe `Scheduler` will mainly do two things: \n\n* It will interact with the `Stories` GenServer in order to populate the `:stories` ETS table with data harvested with the `Ashurbanipal.HNClient` module.\n* It will schedule itself to run in 5 minutes.\n\nThe ideas is to refresh the ETS `:stories` table every 5 minutes with fresh data from the Hacker News Stories API.\n\n### What happens if the Hacker News API is down?\n\nI'm glad you ask. The application will update the ETS table with `nil`.\n\n### Yes, yes, give me the JSON already!\n\nThe HTTP JSON API is available at `localhost:4000/stories`. A `GET` request to that endpoint will get you Hacker News Top 50 stories as JSON.\n\nYou can also get single stories by specifying the story ID like this:\n\n`GET localhost:4000/stories/\u003cID\u003e`\n\nYou can also paginate! Like this:\n\n`GET localhost:4000/stories?page=1`\n\nThat will get you 10 stories as the first page. There are 5 pages in total. If you pass an invalid page number the endpoint will return all stories by default.\n\n## Author\n\n👤 **Josias Alvarado**\n\n- GitHub: [@pointerish](https://github.com/pointerish)\n- Twitter: [@pointerish](https://twitter.com/pointerish)\n- LinkedIn: [LinkedIn](https://www.linkedin.com/in/josias-alvarado/)\n\n## Contributing\n\nContributions, issues, and feature requests are welcome!\n\nFeel free to check the [issues page](https://github.com/pointerish/ashurbanipal/issues).\n## Final Comments\n\nI had a lot of fun writing this simple application. I was originally set to implement a WebSockets API, but I was unable to implement this due to my inexperience with WebSockets and time constraints. I will add it in the following days, mainly because of the educational value of it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpointerish%2Fashurbanipal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpointerish%2Fashurbanipal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpointerish%2Fashurbanipal/lists"}