{"id":21130608,"url":"https://github.com/golemcloud/golem-examples","last_synced_at":"2025-12-30T05:06:30.289Z","repository":{"id":185598123,"uuid":"671963598","full_name":"golemcloud/golem-examples","owner":"golemcloud","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-30T15:42:52.000Z","size":12007,"stargazers_count":30,"open_issues_count":3,"forks_count":10,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-02-20T11:08:17.018Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/golemcloud.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":"2023-07-28T14:56:15.000Z","updated_at":"2025-02-15T06:54:19.000Z","dependencies_parsed_at":"2024-04-23T16:27:15.457Z","dependency_job_id":"0f035760-38d0-4334-8f5f-3c67c7d955f1","html_url":"https://github.com/golemcloud/golem-examples","commit_stats":null,"previous_names":["golemcloud/golem-templates","golemcloud/golem-examples"],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golemcloud%2Fgolem-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golemcloud%2Fgolem-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golemcloud%2Fgolem-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golemcloud%2Fgolem-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/golemcloud","download_url":"https://codeload.github.com/golemcloud/golem-examples/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240622538,"owners_count":19830709,"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":[],"created_at":"2024-11-20T05:35:37.438Z","updated_at":"2025-12-12T14:33:23.840Z","avatar_url":"https://github.com/golemcloud.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e [!NOTE]\n\u003e **Moved to: [https://github.com/golemcloud/golem-cli](golem-cli)**\n\n# Golem Cloud example templates\n\nThis repository contains all the *template examples* available for the `golem` CLI tool using via the `golem new` command.\n\n\u003e [!CAUTION]\n\u003e **While some template examples might work as they are, using them directly is not supported.**\n\nSee the example templates section on the [Golem CLI page](https://www.golem.cloud/learn/golem-cli).\n\n## Structure\n\nThe examples are organized to directories per **guest languages**. Each guest language directory contains an `INSTRUCTIONS` text file, which is a template itself and gets printed as a result of the `golem new` command.\n\nEach subdirectory of the guest languages is a template where the directory's name becomes the template's name.\n\nEach **example** consists of arbitrary number of files and subdirectories and a `metadata.json` file.\n\nThe `golem new` command applies the below defined **template rules** for each file's and directory's name, and for each file's contents.\n\nThe metadata file contains required information and also allows some additional project generation steps to be enabled.\n\n### Metadata JSON\nThe following fields are required:\n\n- `description` is a free-text description of the example\n\nThe following fields are optional:\n\n- `requiresAdapter` is a boolean, defaults to **true**. If true, the appropriate version of the WASI Preview2 to Preview1 adapter is copied into the generated project (based on the guest language) to an `adapters` directory.\n- `adapterTarget` is an optional directory path that overrides the default `adapter` directory, when set and `requiresAdapter` is not, then the latter is implicitly set to **true**\n- `requiresGolemHostWIT` is a boolean, defaults to **false**. If true, the Golem specific WIT interface gets copied into `wit/deps`.\n- `requiresWASI` is a boolean, defaults to **false**. If true, the WASI Preview2 WIT interfaces which are compatible with Golem Cloud get copied into `wit/deps`.\n- `witDepsPaths` is an array of directory paths, defaults to **null**. When set, overrides the `wit/deps` directory for the above options and allows to use multiple target dirs for supporting multi-component examples.\n- `exclude` is a list of sub-paths and works as a simplified `.gitignore` file. It's primary purpose is to help the development loop of working on examples and in the future it will likely be dropped in favor of just using `.gitignore` files.\n- `transformExclude` is an optional list of file names, defaults to **null**. Files with name in this list will not be transformed, only copied.\n- `transform` is an optional boolean, defaults to **true**. When set no transformations are applied to any files, useful for common app templates.\n- `instructions` is an optional filename, defaults to **null**. When set, overrides the __INSTRUCTIONS__ file used for the example, the file needs to be placed to same directory as the default instructions file.\n- `appCommonGroup` is used to mark the example to be part of a composable app template group as a common template\n- `appComponentGroup` is used to mark the example to be part of a composable app template group as a component template\n\n### Template rules\n\nGolem examples are currently simple and not using any known template language, in order to keep the examples **compilable** as they are - this makes it very convenient to work on existing ones and add new examples as you can immediately verify that it can be compiled into a _Golem template_.\n\nWhen calling `golem-new` the user specifies a **template name**. The provided component name must use either `PascalCase`, `snake_case` or `kebab-case`.\n\nThere is an optional parameter for defining a **package name**, which defaults to `golem:component`. It has to be in the `pack:name` format. The first part of the package name is called **package namespace**.\n\nThe following occurrences get replaced to the provided component name, applying the casing used in the template:\n- `componentname` (unchanged)\n- `component-name`\n- `componentName`\n- `ComponentName`\n- `component_name`\n- `pack::name`\n- `pa_ck::na_me` (for rust binding import)\n- `pack:name`\n- `pack_name`\n- `pack-name`\n- `pack/name`\n- `PackName`\n- `pack-ns`\n- `PackNs`\n\n### Testing the examples\nThe example generation and instructions can be tested with a test [cli app](/src/test/main.rs).\nThe app also accepts a filter argument, which matches for the example name as regular expressions, eg. to test the go examples use:\n\n```shell\ncargo run --bin golem-examples-test-cli -- examples -f go\n```\n\nOr to exactly match an example name:\n\n```shell\ncargo run --bin golem-examples-test-cli -- examples -f '^go-default$'\n```\n\nThe necessary tooling for the specific language is expected to be available.\n\nThe test app will instantiate examples and then execute the instructions (all lines starting with `  `).\n\nThe examples are generated in the `/examples-test` directory.\n\n### Testing the composable app templates\n\n```shell\ncargo run --bin golem-examples-test-cli app\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgolemcloud%2Fgolem-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgolemcloud%2Fgolem-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgolemcloud%2Fgolem-examples/lists"}