{"id":13687731,"url":"https://github.com/andorp/order-taking","last_synced_at":"2025-10-09T13:36:11.748Z","repository":{"id":48034168,"uuid":"354937253","full_name":"andorp/order-taking","owner":"andorp","description":"Idris version of Domain Modeling Made Functional Book.","archived":false,"fork":false,"pushed_at":"2021-10-25T17:59:55.000Z","size":407,"stargazers_count":135,"open_issues_count":0,"forks_count":11,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-04-07T20:03:12.691Z","etag":null,"topics":["ddd","depedent-types","fp","idris"],"latest_commit_sha":null,"homepage":"","language":"Idris","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andorp.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}},"created_at":"2021-04-05T18:45:21.000Z","updated_at":"2025-04-03T13:42:45.000Z","dependencies_parsed_at":"2022-08-12T17:10:54.136Z","dependency_job_id":null,"html_url":"https://github.com/andorp/order-taking","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/andorp/order-taking","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andorp%2Forder-taking","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andorp%2Forder-taking/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andorp%2Forder-taking/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andorp%2Forder-taking/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andorp","download_url":"https://codeload.github.com/andorp/order-taking/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andorp%2Forder-taking/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001487,"owners_count":26083102,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["ddd","depedent-types","fp","idris"],"created_at":"2024-08-02T15:00:59.567Z","updated_at":"2025-10-09T13:36:11.701Z","avatar_url":"https://github.com/andorp.png","language":"Idris","funding_links":["https://www.patreon.com/AndOrP"],"categories":["Idris"],"sub_categories":[],"readme":"# Idris Full Stack DDD NodeJS example\n\n## Order Taking Service\n\nIdris version of Domain Modeling Made Functional Book.\n\n The [Domain Modeling Made Functional by Scott Wlaschin](https://www.amazon.co.uk/Domain-Modeling-Made-Functional-Domain-Driven/dp/1680502549)\nintroduces domain driven design and shows how well it fits to the world of functional programming via the lens of\nthe F# programming language. As Scott showed us that DDD is indeed a nice fit for functional programming,\nquestions arise naturally; could we push further the abstractions if we use a dependently typed programming language, like Idris?\nWhere are the sweet spots of depedent types in the world of everyday programming?\n Everyday programming needs to be focused on delivery, maintanability, reliability, and being correct.\nThe sad truth is that many applications needs to be more maintanable than correct.\nBeing correct is not a clear concept because its meaning changes as the software evolves.\nIn many cases, stakeholders only get a deeper understanding of the domain as the software solution/product evolves over time.\nIn this setting, depedent typed programming helps us achieve maintanability rather than being correct.\n In this repository I show a simple layered architecture and I show how to use simple dependent types\nto draw explicit connections between the high level design of a service and its NodeJS deployed implementation.\nIdeas and practices originated, but reshuffled from the [Type Driven Development with Idris by Edwin Brady](https://www.amazon.co.uk/Type-driven-Development-Idris-Edwin-Brady/dp/1617293024)\nand the [Domain Modeling Made Functional by Scott Wlaschin](https://www.amazon.co.uk/Domain-Modeling-Made-Functional-Domain-Driven/dp/1680502549).\nThis architecture includes; An abstraction to talk about Bounded Context and Workflow, type safe description of a state transition system,\na free monad approach for domain implementation, and an actual implementation of the domain on NodeJS back-end.\n Because of dependent types, this architecture becomes explicit, rather than implicit, meaning that\nconnections between the high level design and the low level implementation are done via functions, changing\nthe code anywhere requires to think at the whole, as possible type errors propagates to top or to bottom.\n Idris could immensely benefit from simple FFIs for NodeJS libraries. The FFIs would grant access to thousands\nof libraries from the NodeJS ecosystem almost for free. This approach would position Idris to be used even\nin production settings and the Idris userbase could be bootstrapped, later the Idris version of these\nlibraries could be written.\n\nRequest: Please consider buying both of the books mentioned above. Boths are excellent resources for\nfurther studying of the applied subject.\n\n## Work In Progress parts:\n\n- The documentation is still under development. Please come back regurarly to see what changed.\n- Client needs lots of improvements.\n- Better error Handling around workflow runners.\n- Dependently driven testing needs to be implemented.\n\n## Financial Support\n\n\u003ca href=\"https://www.patreon.com/AndOrP\"\u003e\n\u003cimg src=\"https://c5.patreon.com/external/logo/become_a_patron_button.png\" width=\"150\"/\u003e\n\u003c/a\u003e\n\n## Talk\n\n\u003ca href=\"https://youtu.be/QBj-4K-l-sg\"\u003eYoutube\u003c/a\u003e\n\n## Notes\n\nThis project meant to be a blue-print, example for micro-services written in Idris. Its main focus is to reproduce\nabstractions in dependently typed setting, that can be found in Scott Wlashin's book. The main focus is\naround the dependently typed implementation of `BoundedContext`, but several other parts of the architecture\nhad to be worked on to be able to demostrate that Idris can host such solutions. Although during the implementation\nmany other problems were required to think about in the dependently typed setting. This repository can be\nconsidered as a mine practices for dependently typed software development. Enjoy digging up those gems.\n\nYou may find the style of the explanations strange, maybe a bit chaotic, but if you follow path suggested\nin the [READMAP.md](https://github.com/andorp/order-taking/blob/main/READMAP.md) you will learn many things about the Idris language. This style feels chaotic that could\nbe because I have a slight ADHD and I try to linarize the content here, but sometimes quickly the explanations\ngo deep. Although I believe a short explanation after every Idris snippet helps to view this reposity as\na hand-book for Idris development.\n\n## High level overview\n\nThis repository contains more than just the `Idris` one to one translation of the `F#` code from the\nDomain Modeling Made Functional book. I wanted to show how Idris can be used to interface with existing\n`NodeJS` libraries. For that reason I added the following parts:\n\n- FFI for NodeJS interfacing libraries\n- Sketch of type-safe SQL library\n- Minimal scaffolding of a NodeJS server\n- Dependently typed framework for Bound-Context and Workflows\n- State transition of the PlaceOrder example\n- Free monadic DSL formalization of the PlaceOrder example\n- One backend implementation of the operations of PlaceOrder DSL\n\nSee the [slides](https://github.com/andorp/order-taking/blob/main/SLIDES.md)\n\n## Run\n\nAfter setted up; start the microservice with `make start-opt`, start the client service `npm run dev`,\nand open `localhost:5000` in a browser.\n\n## Setup\n\n### Server\n\n * Install Idris2 which version must match the one marketd the [VERSIONS](https://github.com/andorp/order-taking/blob/main/VERSIONS) file. OR\n * If you Idris2 release version installed, check out the corresponding tag from 0.4.0\n\nFor dependencies install `nodejs`, `npm` and packages:\n\n```\nnpm install google-closure-compiler\nnpm install sqlite\nnpm install md5\n```\n\nTo start the OrderTaking service, which will create the initial Sqlite DB and starts\nthe service on `127.0.0.1:3000`\n\n```\nmake init-db\nmake start-opt\n```\n\n### Client\n\nAn example client can be found in the `client/svelte-client` directory. Follow the instructions\nfrom its README.md\n\nTo run the client, call the following command:\n\n```\ncd client/svelte-client\nnpm run dev\n```\n\nWhich starts the client in development mode, any changes in its code, will be picked up.\n\nImportant note, use the `g21` as product code on the client side for testing. The client\nis very in pre-alpha state, best to open the developer console to see, what happens before and\nafter submitting the order. I will work on these details soon.\n\nHave fun!\n\n## ASCII ART\n\n[ASCII ART](https://dot-to-ascii.ggerganov.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandorp%2Forder-taking","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandorp%2Forder-taking","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandorp%2Forder-taking/lists"}