{"id":39058370,"url":"https://github.com/mastern2k3/poseidon","last_synced_at":"2026-01-17T18:02:14.331Z","repository":{"id":57502533,"uuid":"167210349","full_name":"mastern2k3/poseidon","owner":"mastern2k3","description":"Opinionated extended apis on top of Nakama's api","archived":false,"fork":false,"pushed_at":"2019-07-04T23:57:54.000Z","size":350,"stargazers_count":12,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-06-20T19:18:19.380Z","etag":null,"topics":["game-framework","game-server","nakama","nakama-server"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mastern2k3.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":"2019-01-23T15:57:51.000Z","updated_at":"2024-03-14T19:08:58.000Z","dependencies_parsed_at":"2022-09-13T07:02:07.529Z","dependency_job_id":null,"html_url":"https://github.com/mastern2k3/poseidon","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mastern2k3/poseidon","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastern2k3%2Fposeidon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastern2k3%2Fposeidon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastern2k3%2Fposeidon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastern2k3%2Fposeidon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mastern2k3","download_url":"https://codeload.github.com/mastern2k3/poseidon/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastern2k3%2Fposeidon/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28514939,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T17:57:59.192Z","status":"ssl_error","status_checked_at":"2026-01-17T17:57:52.527Z","response_time":85,"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":["game-framework","game-server","nakama","nakama-server"],"created_at":"2026-01-17T18:02:14.122Z","updated_at":"2026-01-17T18:02:14.294Z","avatar_url":"https://github.com/mastern2k3.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# poseidon\n\u003e Opinionated extended apis and tools on top of the Nakama server\n\n## Features\n\n### Storage Collection Accessors\n\nAllows for more fluent use of Nakama's storage collections, taking care of json marshalling and unmarshalling, default values and bulk reads.\n\n```go\nimport (\n\t\"context\"\n\n\t\"github.com/heroiclabs/nakama/runtime\"\n\t\"github.com/mastern2k3/poseidon/storage\"\n)\n\nvar (\n\tstatsAccessor = \u0026storage.CollectionAccessor{\n\t\tCollectionID: \"stats\",\n\t\tKeyID:        \"matchesPlayed\",\n\t\t// An empty model used for unmarshalling\n\t\tModelFactory: func() interface{} { return new(MatchStats) },\n\t\t// A default value for when a record does not exist\n\t\tDefaultFactory: func() interface{} {\n\t\t\treturn \u0026MatchStats{\n\t\t\t\tWinningStreak: 0,\n\t\t\t\tMatchesPlayed: 0,\n\t\t\t}\n\t\t},\n\t}\n)\n\ntype MatchStats struct {\n\tMatchesPlayed uint `json:\"matchesPlayed\"`\n\tWinningStreak uint `json:\"winningStreak\"`\n}\n\nfunc GetMatchStats(ctx context.Context, nk runtime.NakamaModule, userIDs []string) (map[string]*MatchStats, error) {\n\n\tdx, err := statsAccessor.GetOrDefaultList(ctx, nk, userIDs)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstats := map[string]*MatchStats{}\n\n\tfor userID, d := range dx {\n\t\tstats[userID] = d.(*MatchStats)\n\t}\n\n\treturn stats, nil\n}\n```\n\n### RPC Routes\n\nProvide json marshalling and unmarshalling for RPC requests and responses, as well as a nicer way to register an array of RPC handlers.\n\n```go\npackage services\n\nimport (\n\t\"context\"\n\t\"database/sql\"\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/heroiclabs/nakama/runtime\"\n\t\"github.com/mastern2k3/poseidon/rpc\"\n)\n\nvar (\n\tMyRoutes = []rpc.RPCRoute{\n\t\t\u0026rpc.JsonRoute{\"json_route\", func() interface{} { return \u0026[]string{} }, jsonRoute},\n\t\t\u0026rpc.StringRoute{\"string_route\", stringRoute},\n\t}\n)\n\ntype SomeResponse struct {\n\tData map[string]string `json:\"data\"`\n}\n\nfunc jsonRoute(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, input interface{}) (interface{}, error) {\n\n\tuserIDs := input.(*[]string)\n\n\tlogger.Println(userIDs)\n\n\treturn \u0026SomeResponse{\n\t\tData: map[string]string {\n\t\t\t\"hello\": \"world\",\n\t\t}\n\t}, nil\n}\n\nfunc stringRoute(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, input string) (string, error) {\n\n\tlogger.Println(input)\n\n\treturn \"ok\", nil\n}\n```\n\nAnd in your initialization code:\n\n```go\nfunc InitModule(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, initializer runtime.Initializer) error {\n\tif err := rpc.RegisterRoutes(initializer, services.MyRoutes); err != nil {\n\t\treturn err\n\t}\n}\n```\n\n### GraphQL endpoint with bundled GraphiQL interface\n\nProvides a GraphQL endpoint and bundled GraphQL ui for easy browsing of the server data.\n\n![GraphiQL UI](docs/imgs/graphiql.png)\n\nThe UI is served on port 8090 so remember to expose it.\n\n### Live parameters\n\nProvides a set of convenience methods and endpoints for variables that you would like to be able to change and observe at runtime and also have persist through restarts.\n\nFirst declare the variables as pointers:\n\n```go\nvar (\n\tmyLiveInt    *int\n\tmyLiveString *string\n)\n```\n\nThen at initialization register them as live parameters:\n\n```go\nfunc InitModule(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, initializer runtime.Initializer) error {\n\tif err := liveparams.RegisterLiveParameters(ctx, nk, initializer, func(reg liveparams.Registrar) {\n\t\tmyLiveInt = reg.LiveInt(\"liveint\", 12)\n\t\tmyLiveString = reg.LiveString(\"livestring\", \"hello\")\n\t}); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n```\n\nThose variables will be available for use throughout the code and will be available for editing and observation using the RPCs named `\"liveparams_get\"` and `\"liveparams_set\"`, as well as the graphql query named `liveParams` and the mutation named `setLiveParam(name: String)`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmastern2k3%2Fposeidon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmastern2k3%2Fposeidon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmastern2k3%2Fposeidon/lists"}