{"id":13602035,"url":"https://github.com/didi/tinyid","last_synced_at":"2025-05-14T19:10:21.954Z","repository":{"id":37286568,"uuid":"150379389","full_name":"didi/tinyid","owner":"didi","description":"ID Generator id生成器 分布式id生成系统，简单易用、高性能、高可用的id生成系统","archived":false,"fork":false,"pushed_at":"2022-06-21T00:47:59.000Z","size":306,"stargazers_count":2313,"open_issues_count":33,"forks_count":588,"subscribers_count":74,"default_branch":"master","last_synced_at":"2025-04-13T15:08:28.871Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","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/didi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-26T06:34:57.000Z","updated_at":"2025-04-11T06:49:32.000Z","dependencies_parsed_at":"2022-08-03T12:20:39.620Z","dependency_job_id":null,"html_url":"https://github.com/didi/tinyid","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/didi%2Ftinyid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/didi%2Ftinyid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/didi%2Ftinyid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/didi%2Ftinyid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/didi","download_url":"https://codeload.github.com/didi/tinyid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254209859,"owners_count":22032897,"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-08-01T18:01:12.267Z","updated_at":"2025-05-14T19:10:20.518Z","avatar_url":"https://github.com/didi.png","language":"Java","readme":"## Tinyid\n[![license](http://img.shields.io/badge/license-Apache2.0-brightgreen.svg?style=flat)](https://github.com/didi/tinyid/blob/master/LICENSE)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/didi/tinyid/pulls)\n\nTinyid is a ID Generator Service. It provides a REST API and a java client for getting ids. Over 10 million QPS per single instance when using the java client.\nSupport jdk version 1.7+\n\n# Getting started\n\n[中文wiki](https://github.com/didi/tinyid/wiki)\n\n## Clone code\ngit clone https://github.com/didi/tinyid.git\n\n## Create table\ncd tinyid/tinyid-server/ \u0026\u0026 create table with db.sql (mysql)\n\n## Config db\n\ncd tinyid-server/src/main/resources/offline  \nvi application.properties\n```properties\ndatasource.tinyid.names=primary\n\ndatasource.tinyid.primary.driver-class-name=com.mysql.jdbc.Driver\ndatasource.tinyid.primary.url=jdbc:mysql://ip:port/databaseName?autoReconnect=true\u0026useUnicode=true\u0026characterEncoding=UTF-8\ndatasource.tinyid.primary.username=root\ndatasource.tinyid.primary.password=123456\n```\n## Start tinyid-server\n```xml\ncd tinyid-server/\nsh build.sh offline\njava -jar output/tinyid-server-xxx.jar\n```\n## REST API \n```properties\nnextId:\ncurl 'http://localhost:9999/tinyid/id/nextId?bizType=test\u0026token=0f673adf80504e2eaa552f5d791b644c'\nresponse:{\"data\":[2],\"code\":200,\"message\":\"\"}\n\nnextId Simple:\ncurl 'http://localhost:9999/tinyid/id/nextIdSimple?bizType=test\u0026token=0f673adf80504e2eaa552f5d791b644c'\nresponse: 3\n\nwith batchSize:\ncurl 'http://localhost:9999/tinyid/id/nextIdSimple?bizType=test\u0026token=0f673adf80504e2eaa552f5d791b644c\u0026batchSize=10'\nresponse: 4,5,6,7,8,9,10,11,12,13\n\nGet nextId like 1,3,5,7,9...\nbizType=test_odd : delta is 2 and remainder is 1\ncurl 'http://localhost:9999/tinyid/id/nextIdSimple?bizType=test_odd\u0026batchSize=10\u0026token=0f673adf80504e2eaa552f5d791b644c'\nresponse: 3,5,7,9,11,13,15,17,19,21\n```\n## Java client  (Recommended)\n\n### Maven dependency\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.xiaoju.uemc.tinyid\u003c/groupId\u003e\n    \u003cartifactId\u003etinyid-client\u003c/artifactId\u003e\n    \u003cversion\u003e${tinyid.version}\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Create tinyid_client.properties in your classpath\n\ntinyid_client.properties:\n```properties\ntinyid.server=localhost:9999\ntinyid.token=0f673adf80504e2eaa552f5d791b644c\n\n#(tinyid.server=localhost:9999/gateway,ip2:port2/prefix,...)\n```\n### Java Code\n```java\nLong id = TinyId.nextId(\"test\");\nList\u003cLong\u003e ids = TinyId.nextId(\"test\", 10);\n```\n\n# Communication\n\u003cimg src=\"doc/qqqun.JPG\" alt=\"Tinyid Community\" width=\"200\"/\u003e\n\n# Contributing\n\nWelcome to contribute by creating issues or sending pull requests. See [Contributing Guide](CONTRIBUTING.md) for guidelines.\n\n# License\n\nTinyid is licensed under the Apache License 2.0. See the [LICENSE](LICENSE) file.\n\n# Note\n\nThis is not an official Didi product (experimental or otherwise), it is just code that happens to be owned by Didi.\n","funding_links":[],"categories":["Java","分布式开发"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdidi%2Ftinyid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdidi%2Ftinyid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdidi%2Ftinyid/lists"}