{"id":15010317,"url":"https://github.com/varugasu/todo-api","last_synced_at":"2026-01-07T11:48:33.394Z","repository":{"id":237551161,"uuid":"794717372","full_name":"varugasu/todo-api","owner":"varugasu","description":"TODO API done with Compojure + XTDB v2","archived":false,"fork":false,"pushed_at":"2024-06-02T17:35:39.000Z","size":15,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-15T12:36:08.982Z","etag":null,"topics":["clojure","compojure","rest-api","todo","xtdb"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/varugasu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-05-01T20:00:50.000Z","updated_at":"2024-06-03T07:22:17.000Z","dependencies_parsed_at":"2024-05-02T13:59:09.581Z","dependency_job_id":"bd067bd4-21c0-4625-aecb-9783819735f2","html_url":"https://github.com/varugasu/todo-api","commit_stats":null,"previous_names":["varugasu/todo-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varugasu%2Ftodo-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varugasu%2Ftodo-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varugasu%2Ftodo-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varugasu%2Ftodo-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/varugasu","download_url":"https://codeload.github.com/varugasu/todo-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246009954,"owners_count":20709035,"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":["clojure","compojure","rest-api","todo","xtdb"],"created_at":"2024-09-24T19:33:30.850Z","updated_at":"2026-01-07T11:48:33.366Z","avatar_url":"https://github.com/varugasu.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ToDo API in Clojure\n\nThe intent of this project is to familiarize myself with Clojure. Not only the language, but also the development process.\n\n## Running\n\n1. Start docker `docker compose up -d`\n2. Run `make run`\n3. It will run on `localhost:3000`\n\n## REPL Development\n\nIn `deps.edn` there is an alias `dev` that allow to run the application and interacts with XTDB.\n\nStart the REPL with the `dev` alias and run:\n\n```clj\n(start)\n```\n\nIt will start the server on port `3000` and hot-reload. However, the hot reload doesn't not work so well so some changes require restarting the REPL.\n\nTo stop the server, run:\n\n```clj\n(stop)\n```\n\n### XTDB\n\nAlso, you can interact with the XTDB node using\n\n`xt/submit-tx` and `xt/q`. They are already imported in the namespace and there is a global `node`.\n\nQuerying all TODOs:\n\n```clj\n(xt/q node '(from :todos [*]))\n```\n\n## API\n\nThis API is composed of the following endpoints:\n- `GET /todos`\n- `GET /todos/:id`\n- `POST /todos`\n- `DELETE /todos/:id`\n- `PATCH /todos/:id`\n\n### GET /todos/:id\n\nAn TODO object looks like:\n\n```json\n{\n  \"description\": \"my description\",\n  \"completed\": false,\n  \"title\": \"My task 2\",\n  \"xt/id\": \"d57087f9-a23f-4e0c-bc9b-1e166dcf75c1\"\n}\n```\n\n### POST /todos\n\nIt excepts a payload with `title` and `description`:\n\n```json\n{\n  \"title\": \"My task 5\",\n  \"description\": \"my description\"\n}\n```\n\nIt creates an object in the `todos` table with `completed = false` and random UUID to `xt/id`\n\n### PATCH /todos/:id\n\nThis endpoint allow to update the `title`, `description`, and the `completed` flag:\n\n```json\n{\n  \"completed\": false,\n  \"title\": \"My new task title\",\n  \"description\": \"My new task description\" \n}\n```\n\n## Decisions\n\nI opted for `deps.edn` over `lein` to keep things simple. Lein reminds me a lot of Java projects and after having great DX with Node ecosystem, I want things at least simple.\n\nUsing Compojure because seems the most straightforward way of building web applications. However, the reload on file change was tricky to make it work. `ring.middleware.reload` favors variable references and I didn' want to have global variables.\n\nXTDB v2 was used only because of XTQL. I could manage to do all operations with it instead SQL.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarugasu%2Ftodo-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvarugasu%2Ftodo-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarugasu%2Ftodo-api/lists"}