{"id":14991393,"url":"https://github.com/zckyachmd/hono-auth","last_synced_at":"2025-04-12T03:41:46.256Z","repository":{"id":256149806,"uuid":"854017336","full_name":"zckyachmd/hono-auth","owner":"zckyachmd","description":"Hono-Auth is a lightweight authentication boilerplate created with Hono.js and Bun. It offers essential features and functionality for building secure and efficient web applications.","archived":false,"fork":false,"pushed_at":"2024-10-18T00:30:24.000Z","size":41,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T23:15:17.865Z","etag":null,"topics":["auth","bun","honojs","jwt","open-api","prisma-orm","swagger-api","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/zckyachmd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2024-09-08T07:11:32.000Z","updated_at":"2025-01-17T06:15:30.000Z","dependencies_parsed_at":"2024-09-24T16:17:58.070Z","dependency_job_id":null,"html_url":"https://github.com/zckyachmd/hono-auth","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"768ee10c9e552dca51f2f6f5059a40d9b422355b"},"previous_names":["zckyachmd/hono-auth"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zckyachmd%2Fhono-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zckyachmd%2Fhono-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zckyachmd%2Fhono-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zckyachmd%2Fhono-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zckyachmd","download_url":"https://codeload.github.com/zckyachmd/hono-auth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248514221,"owners_count":21116899,"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":["auth","bun","honojs","jwt","open-api","prisma-orm","swagger-api","typescript"],"created_at":"2024-09-24T14:27:41.388Z","updated_at":"2025-04-12T03:41:46.240Z","avatar_url":"https://github.com/zckyachmd.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hono Auth\n\n**Hono-Auth** is a simple authentication boilerplate built with Hono.js using Bun and TypeScript, designed to provide essential auth functionality. This project includes four key authentication endpoints and leverages Prisma ORM for database management, Zod for validation, and Swagger UI for API documentation.\n\n## Features\n\n- User Authentication: Includes user registration, login, logout, and token refresh.\n- Zod Validation: Schema validation for secure data handling.\n- Swagger UI: Auto-generated API docs for easy testing and integration.\n- Dynamic Role Access Control: Enhanced role management allowing for flexible access control based on user roles and hierarchy.\n- Role Hierarchy Filtering: Implemented filtering logic to ensure only appropriate roles are included in access checks, improving security and clarity.\n\n## Tech Stack (Framework \u0026 Libraries)\n\n- Hono.js (Bun \u0026 TypeScript)\n- Prisma ORM (PostgreSQL)\n- Swagger UI (Scalar)\n- Zod (Data Validation)\n\n## Endpoints\n\n| Endpoint            | Method | Description          |\n| ------------------- | ------ | -------------------- |\n| /auth/register      | POST   | Register a new user  |\n| /auth/login         | POST   | Log in a user        |\n| /auth/refresh-token | POST   | Refresh access token |\n| /auth/logout        | POST   | Log out a user       |\n| /auth/me            | GET    | Get user information |\n\n## Setup and Usage\n\n\u003cdetails\u003e\n  \u003csummary\u003eClick to expand\u003c/summary\u003e\n  \n1. Clone the repository and install dependencies:\n\n```bash\n  git clone https://github.com/zckyachmd/hono-auth.git\n  cd hono-auth\n  bun install\n```\n\n2. Create a `.env` file in the root directory:\n\n   ```bash\n     cp .env.example .env\n     nano .env # Edit the variables as needed (see below)\n\n     #... (.env)\n     DATABASE_URL=postgresql://user:password@localhost:5432/database?schema=public\n     JWT_SECRET=your-secret-token\n     SALT_ROUNDS=10 # Number of rounds for password hashing\n   ```\n\n3. Migrate the database:\n\n   ```bash\n     bun prisma migrate dev\n   ```\n\n4. Start the server:\n\n   ```bash\n     bun run dev\n\n     # Open http://localhost:3000/ui in your browser\n   ```\n\n   \u003c/details\u003e\n\n## Contributing\n\nContributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE.md) file for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzckyachmd%2Fhono-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzckyachmd%2Fhono-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzckyachmd%2Fhono-auth/lists"}