{"id":21801139,"url":"https://github.com/wpcodevo/deno-mongodb","last_synced_at":"2025-04-13T18:30:32.317Z","repository":{"id":59177823,"uuid":"530366924","full_name":"wpcodevo/deno-mongodb","owner":"wpcodevo","description":"In this tutorial, we'll cover how to build a Deno API that supports CRUD operations and stores data in a MongoDB database. The example API will run on an Oak middleware framework that will include routes to create, retrieve, update, and delete documents in the database.","archived":false,"fork":false,"pushed_at":"2022-11-06T21:11:32.000Z","size":60,"stargazers_count":12,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T09:11:49.269Z","etag":null,"topics":["crud","crud-api","deno","denoapi","mongodb","oak","oakframework","rest-api","restful","zod"],"latest_commit_sha":null,"homepage":"https://codevoweb.com/deno-crud-restful-api-with-mongodb","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wpcodevo.png","metadata":{"files":{"readme":"readMe.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-29T19:36:10.000Z","updated_at":"2024-05-06T13:56:59.000Z","dependencies_parsed_at":"2023-01-22T09:45:38.960Z","dependency_job_id":null,"html_url":"https://github.com/wpcodevo/deno-mongodb","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/wpcodevo%2Fdeno-mongodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpcodevo%2Fdeno-mongodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpcodevo%2Fdeno-mongodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpcodevo%2Fdeno-mongodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wpcodevo","download_url":"https://codeload.github.com/wpcodevo/deno-mongodb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248760207,"owners_count":21157309,"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":["crud","crud-api","deno","denoapi","mongodb","oak","oakframework","rest-api","restful","zod"],"created_at":"2024-11-27T11:16:28.969Z","updated_at":"2025-04-13T18:30:32.293Z","avatar_url":"https://github.com/wpcodevo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RESTful API with Deno, Oak, and MongoDB\n\n## 1. How to Setup and Use MongoDB with Deno\n\n![How to Setup and Use MongoDB with Deno](https://codevoweb.com/wp-content/uploads/2022/09/How-to-Setup-and-Use-MongoDB-with-Deno.webp)\n\nWhen it comes to learning a new framework or language, the first thing that comes to our mind is creating a Todo app that has all the basic CRUD functionalities. So in this article, we will create a Todo CRUD RESTful API in a Deno environment that runs on an Oak middleware server and uses a MongoDB database.\n\n### Topics Covered\n\n- What is Deno Oak Middleware Framework?\n- Installing Deno\n- Setup Oak Middleware and Routing\n- Setup MongoDB Server with Docker\n- Connect Deno to MongoDB Server\n- Create the MongoDB Database Models\n- Create the Request Validation Schemas\n- Create the Route Controllers\n    - Add the Dependency Imports\n    - Create Document Controller\n    - Update Document Controller\n    - Read a Single Document Controller\n    - Read All Documents Controller\n    - Delete Document Controller\n    - Export the Controllers\n- Create/Merge the API Routes with Oak\n- Test the Deno API with Postman\n    - Create a new document\n    - Update an existing document\n    - Get a single document\n    - Get all the documents\n    - Delete a document\n\nRead the entire article here: [https://codevoweb.com/setup-and-use-mongodb-with-deno](https://codevoweb.com/setup-and-use-mongodb-with-deno)\n\n## 2. How to Setup and Use MongoDB with Deno\n\n![How to Setup and Use MongoDB with Deno](https://codevoweb.com/wp-content/uploads/2022/09/How-to-Setup-and-Use-MongoDB-with-Deno.webp)\n\nWhen it comes to learning a new framework or language, the first thing that comes to our mind is creating a Todo app that has all the basic CRUD functionalities. So in this article, we will create a Todo CRUD RESTful API in a Deno environment that runs on an Oak middleware server and uses a MongoDB database.\n\n### Topics Covered\n\n- What is Deno Oak Middleware Framework?\n- Installing Deno\n- Setup Oak Middleware and Routing\n- Setup MongoDB Server with Docker\n- Connect Deno to MongoDB Server\n- Create the MongoDB Database Models\n- Create the Request Validation Schemas\n- Create the Route Controllers\n    - Add the Dependency Imports\n    - Create Document Controller\n    - Update Document Controller\n    - Read a Single Document Controller\n    - Read All Documents Controller\n    - Delete Document Controller\n    - Export the Controllers\n- Create/Merge the API Routes with Oak\n- Test the Deno API with Postman\n    - Create a new document\n    - Update an existing document\n    - Get a single document\n    - Get all the documents\n    - Delete a document\n\nRead the entire article here: [https://codevoweb.com/setup-and-use-mongodb-with-deno](https://codevoweb.com/setup-and-use-mongodb-with-deno)\n\n\n## 3.  Authentication with Bcrypt, JWT, and Cookies in Deno\n\n![ Authentication with Bcrypt, JWT, and Cookies in Deno](https://codevoweb.com/wp-content/uploads/2022/09/Authentication-with-Bcrypt-JWT-and-Cookies-in-Deno.webp)\n\nTo demonstrate how JWT authentication works in Deno, we'll build an API that runs on an Oak middleware server and uses a MongoDB database. Then, we'll add an authentication guard where only users with a valid JSON Web Token will be able to access the protected routes. Also, we'll make the passwords secure by hashing them with the Bcrypt library.\n\n### Topics Covered\n\n- Setup the API Project\n- Create the Database Model with MongoDB\n- Create the Validation Schemas with Zod\n- Load the Environment Variables in Deno\n- Create Utility Functions\n    - Function to Sign and Verify the JSON Web Token\n    - Function to Hash and Verify the Passwords\n    - Function to Omit Fields from an Object\n- Create the API Route Controllers\n    - Register User Controller\n    - Login User Controller\n    - Logout User Controller\n    - Request Authenticated User's Profile Controller\n- Create the Middleware Guard\n- Create the API Routes\n- Add the Routes to the Deno Application\n\nRead the entire article here: [https://codevoweb.com/authentication-with-bcrypt-jwt-and-cookies-in-deno](https://codevoweb.com/authentication-with-bcrypt-jwt-and-cookies-in-deno)\n\n## 4. Build a Complete Deno CRUD RESTful API with MongoDB\n\n![Build a Complete Deno CRUD RESTful API with MongoDB](https://codevoweb.com/wp-content/uploads/2022/09/Build-a-Complete-Deno-CRUD-RESTful-API-with-MongoDB.webp)\n\nIn this tutorial, we'll cover how to build a Deno API that supports CRUD operations and stores data in a MongoDB database. The example API will run on an Oak middleware framework that will include routes to create, retrieve, update, and delete documents in the database.\n\n### Topics Covered\n\n- Run the Deno + MongoDB CRUD API Locally\n- Setup the Deno CRUD API\n- Create the MongoDB Model\n- Create the Validation Schemas with Zod\n- Create the Oak Middleware Route Handlers\n    - Add document handler\n    - Update document handler\n    - Get a single document handler\n    - Get all documents handler\n    - Delete a document handler\n- Create the Oak Middleware Routes\n- Register the API Routes\n\nRead the entire article here: [https://codevoweb.com/deno-crud-restful-api-with-mongodb](https://codevoweb.com/deno-crud-restful-api-with-mongodb)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwpcodevo%2Fdeno-mongodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwpcodevo%2Fdeno-mongodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwpcodevo%2Fdeno-mongodb/lists"}