{"id":13736954,"url":"https://github.com/Prolifode/deno_rest","last_synced_at":"2025-05-08T13:32:06.531Z","repository":{"id":37929295,"uuid":"294730305","full_name":"Prolifode/deno_rest","owner":"Prolifode","description":"A Boilerplate for deno RESTful apis","archived":false,"fork":false,"pushed_at":"2023-07-14T07:50:14.000Z","size":200,"stargazers_count":147,"open_issues_count":3,"forks_count":27,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-08-04T00:06:30.035Z","etag":null,"topics":["api-starter","boilerplate","deno","deno-boilerplate","deno-generator","deno-mongo","deno-rest","denon","jwt","mongodb","oak","rest-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/Prolifode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"github":"vicky-gonsalves","custom":["https://www.paypal.me/vickygonsalves"]}},"created_at":"2020-09-11T15:19:43.000Z","updated_at":"2024-07-26T18:41:22.000Z","dependencies_parsed_at":"2024-08-03T03:07:33.312Z","dependency_job_id":"43ce08fd-cfcc-4ac9-a7e1-4e900ccc7397","html_url":"https://github.com/Prolifode/deno_rest","commit_stats":null,"previous_names":["prolifode/deno_rest","vicky-gonsalves/deno_rest"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prolifode%2Fdeno_rest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prolifode%2Fdeno_rest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prolifode%2Fdeno_rest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prolifode%2Fdeno_rest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Prolifode","download_url":"https://codeload.github.com/Prolifode/deno_rest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253077352,"owners_count":21850306,"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":["api-starter","boilerplate","deno","deno-boilerplate","deno-generator","deno-mongo","deno-rest","denon","jwt","mongodb","oak","rest-api","typescript"],"created_at":"2024-08-03T03:01:32.398Z","updated_at":"2025-05-08T13:32:06.523Z","avatar_url":"https://github.com/Prolifode.png","language":"TypeScript","readme":"# Deno REST - A Deno RESTful API Boilerplate\n\n![Deno Logo](https://deno.land/images/deno_logo_4.gif)\n\n[![CircleCI](https://circleci.com/gh/Prolifode/deno_rest.svg?style=svg)](https://circleci.com/gh/Prolifode/deno_rest)\n\nDeno REST is a straightforward boilerplate project for creating RESTful APIs\nusing Deno, Oak, and deno_mongo. Deno is a secure runtime for JavaScript and\nTypeScript that uses V8 and is built in Rust, Oak is a middleware framework for\nDeno's http server, and deno_mongo is a MongoDB driver for Deno.\n\n## Features\n\n- **Organized by Model, Controller, Service structure:** This project follows a\n  clean architecture that separates concerns into different layers, making it\n  easy to maintain and scale.\n- **MongoDB integration:** We utilize the deno_mongo library for seamless\n  interaction with MongoDB databases.\n- **JWT-based authentication:** Securely authenticate users with JSON Web Tokens\n  (JWTs).\n- **User authorization:** Implement role-based access control to restrict\n  resources based on user roles.\n- **CORS support:** CORS middleware is integrated to handle cross-origin\n  requests.\n- **Environment management via .env:** Manage different environments with ease\n  using the .env file.\n- **Request validation:** Validate incoming requests to ensure they contain\n  valid data.\n- **Error handling:** Gracefully handle errors and provide helpful error\n  messages to the client.\n- **Database seeding:** Populate your database with initial data using our\n  database seeding feature.\n- **User roles and permissions:** Manage user access and permissions\n  efficiently.\n- **User activity history:** Keep track of user activities within your\n  application.\n- **Password hashing with BCrypt:** Securely store user passwords with BCrypt\n  hashing.\n- **Integration tests:** Test your application with our pre-written integration\n  tests.\n- **Docker and CircleCI integration:** Containerize your application with Docker\n  and set up continuous integration with CircleCI.\n\n## Libraries Utilized\n\n- [Oak](https://jsr.io/@oak/oak) - Middleware framework for Deno's net server\n- [deno_mongo](https://jsr.io/@db/mongo) - MongoDB driver for Deno\n- [cors](https://jsr.io/@tajpouria/cors) - CORS middleware for Deno\n- [djwt](https://jsr.io/@zaubrik/djwt) - JSON Web Tokens in Deno, based on JWT\n  and JWS specifications\n- [yup](https://www.npmjs.com/package/yup) - Schema builder for value parsing\n  and validation\n- [bcrypt](https://jsr.io/@da/bcrypt) - OpenBSD Blowfish password hashing\n  algorithm\n\n## Getting Started\n\n### Installation / Upgrade\n\nTo get started with this project, you first need to have Deno installed. If you\nhaven't installed it already, you can follow the official\n[Installation Guide](https://deno.com/manual@v1.35.0/getting_started/installation#installation).\n\n### Environment Variables\n\nReview the `.environments/.env.example` file and create a suitable `.env` file\nbased on your needs. For example, create a `.env.development` file under the\n`.environments` directory for a development environment. For a test environment,\ncreate a `.env.test` file under the `.environments` directory. Then, add the\nnecessary variables.\n\n### Database Seeding\n\nWe use a seeding script to populate the database with initial data. Run the\nfollowing command to execute the seeding script:\n\n```bash\ndeno run seed\n```\n\n### Running the Project\n\nAfter setting up everything, you can run the project using the following\ncommand:\n\n```bash\ndeno start\n```\n\n#### with file watch:\n\n```bash\ndeno start:watch\n```\n\nThe server will start and listen for incoming requests.\n\n### Tests\n\n```bash\ndeno test\n```\n\n## User Roles and Permissions\n\nUser roles and permissions are defined in the `config/roles.ts` file. You can\nadd, modify, or remove roles and their associated permissions in this file.\n\nTo add a new role, follow these steps:\n\n1. Open the `config/roles.ts` file.\n2. Add a new role to the `enum Role` declaration. For example, to add a `GUEST`\n   role, your `enum Role` might look like this:\n\n```typescript\nexport enum Role {\n  USER = 'USER',\n  ADMIN = 'ADMIN',\n  GUEST = 'GUEST',\n}\n```\n\n3. Define permissions for the new role in the `roleRights` object. For example,\n   to allow a `GUEST` to view users but not modify them, your `roleRights`\n   object might look like this:\n\n```typescript\nexport const roleRights = new Map([\n  [Role.USER, [\n    PermissionList.GET_USER,\n    PermissionList.POST_USER,\n    PermissionList.PUT_USER,\n    PermissionList.DELETE_USER,\n  ]],\n  [Role.ADMIN, [\n    PermissionList.GET_USER,\n    PermissionList.POST_USER,\n    PermissionList.PUT_USER,\n    PermissionList.DELETE_USER,\n    PermissionList.MANAGE_ROLES,\n  ]],\n  [Role.GUEST, [PermissionList.GET_USER]],\n]);\n```\n\n## API Routes\n\nThis project comes with the following API routes:\n\n- **GET /users:** Fetch a list of all users.\n- **GET /users/:id:** Fetch a specific user by ID.\n- **POST /users:** Create a new user.\n- **PUT /users/:id:** Update a specific user by ID.\n- **DELETE /users/:id:** Delete a specific user by ID.\n\nEach route is secured and requires appropriate permissions to access.\n\n## Contributing\n\nWe welcome contributions to this project. Please feel free to open an issue or\nsubmit a pull request.\n\n## License\n\nThis project is licensed under the MIT License.\n","funding_links":["https://github.com/sponsors/vicky-gonsalves","https://www.paypal.me/vickygonsalves"],"categories":["基础设施","TypeScript","boilerplate"],"sub_categories":["数据展示"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FProlifode%2Fdeno_rest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FProlifode%2Fdeno_rest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FProlifode%2Fdeno_rest/lists"}