{"id":44544820,"url":"https://github.com/cheikhshift/samb","last_synced_at":"2026-02-13T19:12:04.269Z","repository":{"id":57552376,"uuid":"157640602","full_name":"cheikhshift/samb","owner":"cheikhshift","description":"Go HTTP route management, with a structured API.","archived":false,"fork":false,"pushed_at":"2019-01-06T16:54:20.000Z","size":112,"stargazers_count":25,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-05T22:39:59.772Z","etag":null,"topics":["appengine-go","samb"],"latest_commit_sha":null,"homepage":"https://gophersauce.com","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cheikhshift.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":"2018-11-15T02:30:16.000Z","updated_at":"2022-08-23T10:19:50.000Z","dependencies_parsed_at":"2022-09-26T18:50:40.747Z","dependency_job_id":null,"html_url":"https://github.com/cheikhshift/samb","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/cheikhshift/samb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheikhshift%2Fsamb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheikhshift%2Fsamb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheikhshift%2Fsamb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheikhshift%2Fsamb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cheikhshift","download_url":"https://codeload.github.com/cheikhshift/samb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheikhshift%2Fsamb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29414590,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-13T06:24:03.484Z","status":"ssl_error","status_checked_at":"2026-02-13T06:23:12.830Z","response_time":78,"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":["appengine-go","samb"],"created_at":"2026-02-13T19:12:03.298Z","updated_at":"2026-02-13T19:12:04.263Z","avatar_url":"https://github.com/cheikhshift.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# samb\n\n[![Build Status](https://travis-ci.org/cheikhshift/samb.svg?branch=master)](https://travis-ci.org/cheikhshift/samb) [![GoDoc](https://godoc.org/github.com/cheikhshift/samb?status.svg)](https://godoc.org/github.com/cheikhshift/samb) [![Go Report Card](https://goreportcard.com/badge/github.com/cheikhshift/samb)](https://goreportcard.com/report/github.com/cheikhshift/samb) [![Maintainability](https://api.codeclimate.com/v1/badges/062da952018e56ea46d5/maintainability)](https://codeclimate.com/github/cheikhshift/samb/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/062da952018e56ea46d5/test_coverage)](https://codeclimate.com/github/cheikhshift/samb/test_coverage)\n\n`samb` offers a structured language to build RESTful HTTP APIs. `samb` provides syntax support for languages similar to those used to write infrastructure as code. It offers:\n\n- A simple way to inject variables in request scope.\n- Nest API routes without long path prefixes.\n- Catch request runtime panics. \n- Generate Go code following guidelines.\n- A tested library to use `samb` as you wish.\n\nOnce you finish writing your code, you may then, deploy your project to your cloud provider of choice. \n\n### Editor Plugins :\n\n- [VScode](https://marketplace.visualstudio.com/items?itemName=GopherSauce.samb)\n- [Sublime 3](https://packagecontrol.io/packages/SAMB)\n\n### Documentation\nLearn more about `samb` code generation : [here](https://github.com/cheikhshift/samb/wiki). Scroll down to find more samples.\n\n\n## Install\n\n#### Requirements\n\n- `samb` requires Go +v1.8\n- [dep](https://github.com/golang/dep) (Dependency management)\n- `$GOPATH` environment variable set.\n\n```\ngo get github.com/cheikhshift/samb/cmd/samb-cl\n```\n\n## Starting a project\nCreate a new directory, then run the following command.\n\n\n\tsamb-cl -new -project=\u003cNEW DIR PATH\u003e \u003cPACKAGE GO IMPORT PATH\u003e\n\nThe command will add files in the new folder. Have a look at the files generated to give you an idea on how `samb` directives work. Some directives have comments further explaining their functionality.\n\n## Transpiling\nRun the following command to convert your directives into Go code.\n\n\t\n\tsamb-cl -file=server.se -project=\u003cNEW DIR PATH\u003e\n\nThis will convert your directives into a Go library to handle your HTTP routes. A command will also be generated to launch your server, you can find the source code at `\u003cNEW DIR PATH\u003e/cmd/server`. \n\n## About parser\nThe following package is used to parse this Nginx like configuration language : [github.com/recoye/config](https://github.com/recoye/config), Nginx configuration style parser with golang.\n\nThe following package is used to parse YAML : [gopkg.in/yaml.v2](https://gopkg.in/yaml.v2)\n\n## Additional packages\n\n[Parth : Path parsing for segment unmarshaling and slicing.](https://github.com/codemodus/parth)\n\n-----\n\n#### Tooling\n\nHere is a list of tools that generate Go code for your SAMB projects.\n\nsamb-handler : Generate Go HTTP handlers with the specified parameters.\n\n- Install : `go get github.com/cheikhshift/samb/cmd/samb-handler`\n- Help : Run `samb-handler -h`\n\nsamb-provide: Generate and add a provider to your project. This will generate the Go source used with your provider as well.\n\n- Install : `go get github.com/cheikhshift/samb/cmd/samb-provide`\n- Help : Run `samb-provide -h`\n\nsamb-medic : Generate recover directive functions for your project.\n\t\n- Install : `go get github.com/cheikhshift/samb/cmd/samb-medic`\n- Help : Run `samb-medic -h`\n\n\n## Todo\n\n- [x] Provide better documentation. Checkout the [wiki](https://github.com/cheikhshift/samb/wiki).\n- [x] Sublime/VSCode text plugins.\n- [x] Write package tests.\n- [ ] Write tutorials/ guides.\n- [x] A command line to help with adding new handler source.\n- [x] Implement direct deployment to GCP App engine.\n\n\n### Samples\n\nFind more sample projects [here](https://github.com/cheikhshift/samb-examples).\nHere is a sample server definition (in Nginx like language) :\n\n```\nserver {\n    host 127.0.0.1;\n    port 8080;\n\n    # Import web route definitions\n    require \"./endpoints.se\";\n\n\n    start {\n    \tdo println(\"Hello\");\n    \tdo println(\"Hello again\");\n    }\n\n    shutdown {\n\t# directive do will execute passed\n\t# golang code\n    \tdo println(\"Bye\");\n    }  \n}\n\n```\n\nIn YAML:\n\n```\n# Go package import path of your project.\npackage: github.com/cheikhshift/samb-examples/yaml-example\n\n# import providers\nrequire: [\"./providers.se\"]\n\n\n# Globals are exported via package \n# globals\nglobal:\n  - name: Foo\n    type : bool\n    # Adding comments to exported variable.\n    comment: Foo decides if a process should run\n    return : false\n  - name: AnotherVariable\n    type : bool\n    return: true\n\nserver: \n  host: 127.0.0.1\n  port: 8081\n  # Import web route definitions\n  require : [\"./endpoints.yml\"]\n\n  start:\n    do:\n      - println(\"HelloWorld\")\n      - println(\"Starting...\")\n```\n\n##### Sample Route (file named endpoints.se)\n\n```\n# Routes' definition\n# Import Go packages with directive import\n# For example import \"net/http\";\n# samb source format checking.\n\n\nroutes {\n    provide r;\n\n    route {\n\t    method *;\n\t    # Defines route path.\n\t    # all sub routes have this path\n\t    # prepended.\n\t    path \"/hello/\";\n\n\t    # Provider variables\n\t    # within scope of entire \n\t    # route.\n\t    provide w;\n\t    provide r;\n\n\n\t    go {\n\t    \tdo println(\"Hello\");\n\t    \t# The following commented\n\t    \t# do directive will stop a\n\t    \t# request :\n\t    \t# do return;\n\t    }\n\n\t    route {\n\t    \tmethod GET;\n\t    \tpath \"Foo\";\n\n\t    \tgo {\n\t    \t\tdo println(\"Hello\");\n\t    \t}\n\n\t    \t# Handler can be any function.\n\t    \t# Should be a function that handles the request\n\t    \t# response. using provided variable r\n\t\t# with handler. This code will fail,\n\t\t# the referenced handler is not defined\n\t    \thandler virtualPackage.Handle(r);\n\t    }\n\n\n\t}\n}\n```\n\n##### Sample Providers\n\n```\n# Providers are used\n# within endpoint requests.\nprovider {\n\tname r;\n\ttype *http.Request;\n    # directive return is not used here.\n    # return can be used to define how your\n    # provider is initialized. For example,\n    # providing a variable with value \"Foo\"\n    # : return string(\"Foo\") \n}\n\nprovider {\n\tname w;\n\ttype *http.ResponseWriter;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheikhshift%2Fsamb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcheikhshift%2Fsamb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheikhshift%2Fsamb/lists"}