{"id":16656366,"url":"https://github.com/kociamber/sketch","last_synced_at":"2026-05-26T09:31:06.756Z","repository":{"id":71721229,"uuid":"311726255","full_name":"Kociamber/sketch","owner":"Kociamber","description":"Client-server system representing an ASCII art drawing canvas.","archived":false,"fork":false,"pushed_at":"2020-11-16T09:56:34.000Z","size":162,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-12-26T20:57:49.378Z","etag":null,"topics":["ascii","drawing","elixir","flood-fill-algorithm","floodfill","forest-fire","liveview","phoenix","rectangle"],"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/Kociamber.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":"2020-11-10T16:54:04.000Z","updated_at":"2024-07-19T14:14:20.000Z","dependencies_parsed_at":"2023-07-08T15:30:35.784Z","dependency_job_id":null,"html_url":"https://github.com/Kociamber/sketch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Kociamber/sketch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kociamber%2Fsketch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kociamber%2Fsketch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kociamber%2Fsketch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kociamber%2Fsketch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kociamber","download_url":"https://codeload.github.com/Kociamber/sketch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kociamber%2Fsketch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33513840,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T03:12:49.672Z","status":"ssl_error","status_checked_at":"2026-05-26T03:12:47.976Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["ascii","drawing","elixir","flood-fill-algorithm","floodfill","forest-fire","liveview","phoenix","rectangle"],"created_at":"2024-10-12T09:57:09.793Z","updated_at":"2026-05-26T09:31:06.740Z","avatar_url":"https://github.com/Kociamber.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sketch\n\nClient-server system representing an ASCII art drawing canvas. It implements:\n\n*   JSON based RESTful endpoint\n*   Two canvas operations - rectangle drawing and flood-fill\n*   Erlang [`DETS`](https://erlang.org/doc/man/dets.html) based canvas persistence mechanism (no DB needed!)\n*   [`Phenix LiveView`](https://github.com/phoenixframework/phoenix_live_view) based client (read only)\n\n## Install and run locally\n  * Clone repo with `git clone https://github.com/Kociamber/sketch.git` (or unzip the package if you got it from Joanna ;])\n  * Enter the folder (`cd sketch`) and perform required setup with `mix setup`\n  * Start the endpoint with `mix run` or `iex -S mix phx.server` (with interactive console)\n\n## Usage\n\nTo access LiveView based client visit [`localhost:4000`](http://localhost:4000) from your browser.    \n\nAfter the setup your local storage is empty - you can quickly create (an assignment test fixture based) canvas you can run the seedfile with `mix seed`.  \n\nTo \"clear\" your storage run `mix clear_storage` or simply delete `sketch_storage` file from the project's root directory.\n\nBrowser's routes:\n```\n    /      - shows all locally stored canvases\n    /:id   - shows a specific canvas\n```\n\nJSON endpoint requests routes:\n* `post` `/canvas`: creates, persists and returns empty canvas, no body params required\n* `get` `/canvas`: returns a list of currently stored canvases\n* `get` `/canvas/:id`: returns canvas by id, no body params required\n* `put` `/canvas/:id`: performs flood or rectangle draw operation, returns \"updated\" canvas (requred body params below)\n* `delete` `/canvas/:id` - removes canvas and returns deleted structure, no body params required\n\nBody params required for `put` (canvas drawing operation) - drawing rectangle:\n\n```json\n{\"operation\":\"rectangle\",\"x\":7, \"y\":10,\"width\":40,\"height\":15,\"fill_char\":\"#\", \"outline_char\":\"+\"}\n```\n* all params are mandatory (besides `fill_char` and `outline_char` - only one of them must be present)\n* all numeric values must be integers greater than or equal 0\n* `fill_char` and `outline_char` can be only strings of length 1\n\nFlood operation required params:\n```json\n{\"operation\":\"flood\",\"x\":3, \"y\":3,\"fill_char\":\"7\"}\n```\n* all params are mandatory\n* all numeric values must be integers greater than or equal 0\n* `fill_char` can be only a strings of length 1\n\nThe server is performing request parameters validation and in case of missing or incorrect values json error message is being returned.\n\n### Sample API calls\nGet a list of all stored canvases:  \n```bash\ncurl -H \"Content-Type: application/json\" -X GET http://localhost:4000/api/canvas/\n```\nCreate new canvas:\n```bash\ncurl -H \"Content-Type: application/json\" -X POST http://localhost:4000/api/canvas/\n```\nGet canvas by id:\n```bash\ncurl -H \"Content-Type: application/json\" -X GET http://localhost:4000/api/canvas/:canvas_id\n```\nPerform rectangle drawing operation:\n```bash\ncurl -H \"Content-Type: application/json\" -X PUT -d '{\"operation\":\"rectangle\",\"x\":1, \"y\":2,\"width\":5,\"height\":5,\"fill_char\":\"#\"}' http://localhost:4000/api/canvas/:canvas_id\n```\nPerform fill-flood operation:\n```bash\ncurl -H \"Content-Type: application/json\" -X PUT -d '{\"operation\":\"flood\",\"x\":3, \"y\":2,\"fill_char\":\"^\"}' http://localhost:4000/api/canvas/:canvas_id\n```\nRemove canvas from the storage:\n```bash\ncurl -H \"Content-Type: application/json\" -X DELETE http://localhost:4000/api/canvas/:canvas_id\n```\n### Return JSON structure\nAll operations are returning a canvas of following structure:\n```json\n{\"canvas\":{\"content\":{\"0\":{\"0\":\"-\",\"1\":\"-\",\"2\":\"-\",\"3\":\"-\",\"4\"},...,\"id\":\"ee25fbec-2767-11eb-8a6f-784f436f155b\"}}}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkociamber%2Fsketch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkociamber%2Fsketch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkociamber%2Fsketch/lists"}