{"id":13726644,"url":"https://github.com/jchavarri/ocaml_webapp","last_synced_at":"2025-07-28T08:06:24.222Z","repository":{"id":39027590,"uuid":"280836188","full_name":"jchavarri/ocaml_webapp","owner":"jchavarri","description":"A minimal example of a lightweight webapp in OCaml","archived":false,"fork":false,"pushed_at":"2022-12-13T11:54:26.000Z","size":1459,"stargazers_count":45,"open_issues_count":17,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-02T07:51:11.179Z","etag":null,"topics":["ocaml","reasonml","web-application","webapp"],"latest_commit_sha":null,"homepage":"https://ocaml-webapp.herokuapp.com/","language":"Reason","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/jchavarri.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":"2020-07-19T09:48:51.000Z","updated_at":"2025-02-17T20:47:14.000Z","dependencies_parsed_at":"2023-01-28T12:01:41.732Z","dependency_job_id":null,"html_url":"https://github.com/jchavarri/ocaml_webapp","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jchavarri/ocaml_webapp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchavarri%2Focaml_webapp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchavarri%2Focaml_webapp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchavarri%2Focaml_webapp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchavarri%2Focaml_webapp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jchavarri","download_url":"https://codeload.github.com/jchavarri/ocaml_webapp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchavarri%2Focaml_webapp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267482004,"owners_count":24094508,"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-07-28T02:00:09.689Z","response_time":68,"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":["ocaml","reasonml","web-application","webapp"],"created_at":"2024-08-03T01:03:15.535Z","updated_at":"2025-07-28T08:06:24.204Z","avatar_url":"https://github.com/jchavarri.png","language":"Reason","funding_links":[],"categories":["Reason"],"sub_categories":[],"readme":"# ocaml_webapp\n\nA minimal example of a lightweight webapp in OCaml.\n\nIt features a possible organization of files to maximize code sharing between server (native OCaml) and client (BuckleScript). Some of the things shared are:\n\n- React components, which are server-side rendered with [Tyxml](https://github.com/ocsigen/tyxml) and hydrated with [ReasonReact](https://reasonml.github.io/reason-react/)\n- Routes, through the OCaml library [Routes](https://github.com/anuragsoni/routes).\n- API endpoints interface types, through library [ATD](https://github.com/ahrefs/atd), that also generates encoders / decoders automatically.\n\nPotentially, `shared` folder can contain other shared code like validation functions, data processing, etc.\n\n### Getting started\n\nCreate an opam local switch:\n\n```bash\nmake create-switch\n```\n\nInstall `dune` in the newly created switch:\n\n```bash\nopam install dune\n```\n\nInstall all dependencies:\n\n```bash\nmake deps\n```\n\nBuild client:\n\n```\nyarn webpack:dev\n```\n\nBuild and run the server:\n```bash\nmake run\n```\n\nOpen the browser and go to http://localhost:3000/.\n\nIt's also possible to get hot reloading while developing. For that, start the server (to be able to serve API requests) with `make run`, run BuckleScript in `yarn start` and then start Webpack dev server with `yarn server`.\n\n### Run databases locally\n\n```\ndocker-compose -f docker-compose.dev.yml up -d\n```\n\n### Deploying to Heroku\n\nRight now, the example allows to easily deploy the app to Heroku. Build times are longer than they should, but hopefully\nthis will be fixed [soon](https://github.com/jchavarri/ocaml_webapp/issues/1).\n\n- Install the Heroku CLI: http://toolbelt.heroku.com/\n- Run `heroku create your_app` from the app folder\n- Set stack for the app to `container`: `heroku stack:set container`\n- `git push heroku master`\n\n### Resources\n\n- Amazing tutorial to create a lightweight OCaml webapp: https://shonfeder.gitlab.io/ocaml_webapp/\n- Deploying native Reason/OCaml with Zeit's now.sh: https://jaredforsyth.com/posts/deploying-native-reason-ocaml-with-now-sh/\n- Deploying OCaml server on Heroku: https://medium.com/@aleksandrasays/deploying-ocaml-server-on-heroku-f91dcac11f11\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjchavarri%2Focaml_webapp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjchavarri%2Focaml_webapp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjchavarri%2Focaml_webapp/lists"}