{"id":18013749,"url":"https://github.com/m4rocks/fresh_gleam","last_synced_at":"2026-02-15T20:32:00.572Z","repository":{"id":246411744,"uuid":"820928798","full_name":"m4rocks/fresh_gleam","owner":"m4rocks","description":"A plugin to use Gleam inside of Fresh.","archived":false,"fork":false,"pushed_at":"2024-09-29T08:11:46.000Z","size":43,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-10T13:14:02.791Z","etag":null,"topics":["deno","fresh","gleam"],"latest_commit_sha":null,"homepage":"https://deno.land/x/fresh_gleam","language":"TypeScript","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/m4rocks.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":"2024-06-27T13:08:32.000Z","updated_at":"2024-11-01T10:38:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"bc8b5fa5-af6d-40a3-afc9-2efac94e19a8","html_url":"https://github.com/m4rocks/fresh_gleam","commit_stats":null,"previous_names":["notangelmario/fresh-gleam","m4rocks/fresh_gleam","notangelmario/fresh_gleam"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/m4rocks/fresh_gleam","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m4rocks%2Ffresh_gleam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m4rocks%2Ffresh_gleam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m4rocks%2Ffresh_gleam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m4rocks%2Ffresh_gleam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/m4rocks","download_url":"https://codeload.github.com/m4rocks/fresh_gleam/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m4rocks%2Ffresh_gleam/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29488553,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T19:29:10.908Z","status":"ssl_error","status_checked_at":"2026-02-15T19:29:10.419Z","response_time":118,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["deno","fresh","gleam"],"created_at":"2024-10-30T03:24:20.881Z","updated_at":"2026-02-15T20:32:00.556Z","avatar_url":"https://github.com/m4rocks.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fresh_gleam\n\nA plugin to use [Gleam](https://gleam.run) inside of [Fresh](https://fresh.deno.dev).\n\n\u003e [!WARNING]\n\u003e This plugin is experimental and the only Fresh version tested is 1.6.8.\n\n### Features\n\n-   Use Gleam files inside of Fresh\n-   Create routes using Gleam\n-   You can even create a full Gleam app using Fresh\n\n### Roadmap\n\n-   [ ] Allow usage of pure Gleam Request and Response objects\n-   [ ] Add support for `FreshContext` in Gleam files\n\n## Instructions\n\nGleam only supports files inside of a `src/` folder, so you will have to move your app into a `src/` folder. [See instructions](https://fresh.deno.dev/docs/examples/changing-the-src-dir#using-a-src-directory)\n\n1. Add `gleam.toml` to your Fresh project\n\n```toml\nname = \"main\"\n# Can be any name but remember to change\n# the alias in the deno.json file as explained below\n# and pass the name to the plugin\nversion = \"0.1.0\"\ntarget = \"javascript\"\n\n[javascript]\ntypescript_declarations = true # Needed if you want to use TypeScript\nruntime = \"deno\"\n```\n\n2. Add `fresh_gleam` to plugins.\n\n```json\n// deno.json\n{\n\t\"imports\": {\n\t\t\"fresh_gleam\": \"https://deno.land/x/fresh_gleam@v0.1.3/mod.ts\"\n\t\t// Other imports\n\t}\n}\n```\n\n```typescript\n// fresh.config.ts\nimport { defineConfig } from \"$fresh/server.ts\";\nimport { gleamPlugin } from \"@notangelmario/fresh_gleam\";\n// Or add it directly from the URL\n// import { gleamPlugin } from \"jsr:@notangelmario/fresh_gleam@v0.1.3\";\n\nexport default defineConfig({\n\tplugins: [\n\t\t// We use await because we want to wait for the gleam build to finish\n\t\tawait gleamPlugin(Deno.cwd(), {\n\t\t\t// Optional, add Gleam project name. Default to \"main\"\n\t\t\tgleamProjectName: \"main\",\n\t\t}),\n\t],\n});\n```\n\n3. Add an alias to the compiled Gleam files and exclude the build folder\n\n```json\n// deno.json\n{\n\t\"imports\": {\n\t\t\"$gleam/\": \"./build/dev/javascript/main/\",\n\t\t// Other imports\n\t},\n\t\"exclude\": [\"./build/*\"]\n}\n```\n\n4. Run Fresh\n\n```bash\n$ deno task start\n```\n\nAnd that's it! Your Gleam files will be compiled an can be imported using the alias `$gleam/`.\n\n## How to use\n\nYou can import your Gleam files using the alias `$gleam/`:\n\n```rust\n// src/main.gleam\npub fn hello_from_gleam() -\u003e String {\n\t\"Hello from Gleam!\"\n}\n```\n\n```typescript\n// src/routes/index.tsx\nimport { hello_from_gleam } from \"$gleam/main.mjs\";\n```\n\n\u003e [!TIP]\n\u003e Gleam files are compiled to `.mjs` files, so you will need to import them using the `.mjs` extension instead of `.gleam`. Files are also relative to the `src/` folder.\n\u003e\n\u003e So if you have a file `src/lib/utils.gleam`, you will import it like this:\n\u003e\n\u003e ```typescript\n\u003e import { greet } from \"$gleam/lib/utils.mjs\";\n\u003e ```\n\nYou can also use Gleam files as routes:\n\n```rust\n// src/routes/api/hello.gleam\nimport gleam/http/request\nimport conversation.{type JsRequest, type JsResponse, translate_response}\n\n\npub fn handler(req: JsRequest) -\u003e JsResponse {\n\tresponse.new(200)\n\t|\u003e response.set_body(Text(\"Hello from Gleam!\"))\n\t|\u003e translate_response\n}\n```\n\n\u003e [!TIP]\n\u003e You will need to translate the request and response to JavaScript objects. You can use [conversation](https://hex.pm/packages/conversation) to do that.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm4rocks%2Ffresh_gleam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm4rocks%2Ffresh_gleam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm4rocks%2Ffresh_gleam/lists"}