{"id":27650617,"url":"https://github.com/fdemir/havlu","last_synced_at":"2025-07-17T13:39:19.692Z","repository":{"id":208558040,"uuid":"721908789","full_name":"fdemir/havlu","owner":"fdemir","description":"Havlu lets you focus on the frontend by making it effortless to have a custom API.","archived":false,"fork":false,"pushed_at":"2024-01-23T01:22:49.000Z","size":27,"stargazers_count":16,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-24T03:44:05.136Z","etag":null,"topics":["golang","json-server-mock"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fdemir.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-11-22T03:01:41.000Z","updated_at":"2024-04-11T23:57:38.000Z","dependencies_parsed_at":"2023-11-26T14:27:57.512Z","dependency_job_id":"1245153d-a360-416c-9c94-a3a8187e5f6f","html_url":"https://github.com/fdemir/havlu","commit_stats":null,"previous_names":["fdemir/havlu"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fdemir%2Fhavlu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fdemir%2Fhavlu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fdemir%2Fhavlu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fdemir%2Fhavlu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fdemir","download_url":"https://codeload.github.com/fdemir/havlu/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250559521,"owners_count":21450167,"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":["golang","json-server-mock"],"created_at":"2025-04-24T03:44:10.138Z","updated_at":"2025-04-24T03:44:10.767Z","avatar_url":"https://github.com/fdemir.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# havlu\n\nHavlu lets you focus on the frontend by making it effortless to have a custom REST. You give the JSON, it gives you the REST API. Fast, easy, and reliable. You can self-host it, easily deploy it to somewhere, or use it as a Docker container. Everything happening on the memory, so you don't need to worry about the database.\n\n## Motivation\n\nWhen you are developing a frontend application, you need a backend to serve your data. You can use a mock server, but it is not always enough. You may need to have a custom REST API. Havlu is a tool that helps you to create a custom REST API with a JSON file.\n\nHowever, havlu is not offering a new approach for existing tools like `json-server`. It does the same thing but faster. Why not?\n\n## Installation\n\nMac OS\n\n```bash\nbrew install fdemir/tap/havlu\n```\n\nGo\n\n```bash\ngo install github.com/fdemir/havlu@latest\n```\n\nSource\n\n```bash\ngit clone\ncd havlu\ngo install\n```\n\n## Usage\n\n```bash\nhavlu data.json --port 3000\n```\n\n## Options\n\n| Option    | Description                    | Default   |\n| --------- | ------------------------------ | --------- |\n| --port    | Port number                    | 3000      |\n| --host    | Host name                      | localhost |\n| --cors    | Enable CORS                    | false     |\n| --delay   | Response delay in milliseconds | 0         |\n| --help    | Show help                      |           |\n| --version | Show version number            |           |\n\n## Hav File\n\nHav is a simple schema file that defines the entities(resources) and their fake data types. It helps you create mock APIs faster. Here is an example:\n\nexample.hav\n```\nentity user {\n  name Person.Name\n  email Internet.Email\n}\n\nentity address {\n  lat Address.Latitude\n  lon Address.Longitude\n}\n```\n\nIt uses [Faker](https://pkg.go.dev/github.com/jaswdr/faker#section-documentation) under the hood. You can use the any available methods as a data type. Like the following `Person.Name` or `Address.Latitude`.\n\n## JSON File\n\nThe JSON file should be an array of objects. Each object represents a resource. The key of the object is the resource name. The value of the object is an array of objects. Each object represents a resource item. The key of the object is the resource item id. The value of the object is the resource item.\n\n`db.json`\n\n```json\n[\n  {\n    \"users\": [\n      {\n        \"id\": 1,\n        \"name\": \"Furkan Demir\",\n        \"gender\": \"G\",\n      },\n      {\n        \"id\": 2,\n        \"name\": \"John Doe\",\n        \"gender\": \"B\"\n      }\n    ]\n  }\n]\n```\n\nRun havlu with the following command.\n\n```bash\nhavlu db.json\n```\n\nIt will create a REST API for the `users` resource.\n\n```bash\nGET    /users\nPOST /users\nDELETE /users/:id\nGET /users?field=value\n```\n\n## Using as Module\n\nYou can adapt havlu to your own server by using it as a module.\n\n```go\ntodo!\n```\n\n\u003c!-- GET /locations?order=city\u0026sort=desc --\u003e\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffdemir%2Fhavlu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffdemir%2Fhavlu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffdemir%2Fhavlu/lists"}