{"id":15723272,"url":"https://github.com/a4arpon/deno-back-end-starterkit","last_synced_at":"2025-04-01T04:32:24.797Z","repository":{"id":245536138,"uuid":"818543145","full_name":"a4arpon/deno-back-end-starterkit","owner":"a4arpon","description":"Ready to go Deno Starter Kit for back-end web server development. ","archived":true,"fork":false,"pushed_at":"2024-07-24T20:14:31.000Z","size":39,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-12T08:22:42.963Z","etag":null,"topics":["back-end-development","deno","deno-deploy","engineering","fullstack-development","hono","honojs","javascript","mongodb","mongoose","mr-wayne"],"latest_commit_sha":null,"homepage":"https://deno-hono-pono.deno.dev/","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/a4arpon.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-22T06:01:13.000Z","updated_at":"2024-11-02T20:06:57.000Z","dependencies_parsed_at":"2024-06-22T17:05:49.225Z","dependency_job_id":"f6ef9d6e-ef5d-40a5-9cbe-ff899f893b89","html_url":"https://github.com/a4arpon/deno-back-end-starterkit","commit_stats":null,"previous_names":["a4arpon/deno-hono-starter"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a4arpon%2Fdeno-back-end-starterkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a4arpon%2Fdeno-back-end-starterkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a4arpon%2Fdeno-back-end-starterkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a4arpon%2Fdeno-back-end-starterkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/a4arpon","download_url":"https://codeload.github.com/a4arpon/deno-back-end-starterkit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246586087,"owners_count":20801025,"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":["back-end-development","deno","deno-deploy","engineering","fullstack-development","hono","honojs","javascript","mongodb","mongoose","mr-wayne"],"created_at":"2024-10-03T22:10:54.039Z","updated_at":"2025-04-01T04:32:24.474Z","avatar_url":"https://github.com/a4arpon.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deno Back-End Starter Kit\n\nThis repository is a ready-to-use starter kit for Deno, offering a\nwell-organized and structured API setup similar to what you might expect from a\nNode.js environment. It includes configurations for essential packages such as\nHono, Mongoose, and jsonwebtoken.\n\n### Important Note\n\nThis starter kit is not intended for newcomers. It is recommended for developers\nwho have advanced experience with Node.js and TypeScript, and who understand the\nDeno architecture. If you are new to these technologies, it is advisable to\nfirst familiarize yourself with the basics before using this starter kit.\n\n## Author\n\n- **Name**: Mr. Wayne\n- **Website**: [a4arpon.me](https://a4arpon.me)\n- **GitHub**: [a4arpon](https://github.com/a4arpon)\n- **LinkedIn**: [a4arpon](https://www.linkedin.com/in/a4arpon)\n- **Facebook**: [a4arpon](https://www.facebook.com/a4arpon)\n\n## Packages Used\n\n- **Deno**\n- **Hono**\n- **Mongoose**\n- **jsonwebtoken**\n\n## Why Use This Starter Kit?\n\nThis starter kit solves the problem of having an unstructured and disorganized\nAPI setup in Deno. Unlike Node.js, there isn't a wealth of well-organized\nstarter templates for Deno. This kit provides:\n\n- A structured folder organization\n- Pre-configured middlewares for logging, CORS, and security\n- A ready-to-use database connection setup with Mongoose\n- Standardized response and error handling mechanisms\n- Flexibility to add plugins and change database drivers as needed\n\n## What's Next?\n\nI'm willing to include these things in the Starter-Kit in future\n\n- Deno KV\n- Deno Corn\n- Mail System\n- Authorization Guards\n\n## Folder Structure\n\n```\n.\n├── deno.json            # Deno configuration file\n├── deno.lock            # Lock file for dependencies\n├── README.md            # Project documentation\n└── src\n    ├── config           # Configuration files\n    │   └── helmet.config.ts\n    ├── main.ts          # Main application entry point\n    ├── models           # Database models\n    │   └── user.model.ts\n    ├── routes           # API route definitions\n    │   ├── router.ts\n    │   └── stable.routes.ts\n    ├── middlewares      # Application guards and middlewares\n    ├── services         # Business logic and services\n    │   └── users.services.ts\n    ├── types            # Type definitions\n    │   └── shared.types.ts\n    └── utils            # Utility functions\n        ├── async.ts\n        └── response.ts\n```\n\n## .env File Sample\n\n```\nMONGODB_URL=\"\"\n```\n\n## Key Components\n\n### Main Application Setup (`main.ts`)\n\n- **Environment Loader**: Loads environment variables.\n- **Middlewares**: Sets up logging, CORS, and security headers.\n- **Database Connection**: Connects to MongoDB using Mongoose.\n- **Router Setup**: Defines base routes and integrates with the router.\n\n### Router (`router.ts`)\n\n- **Stable Routes**: Handles stable API routes.\n- **Beta Routes**: Placeholder for beta routes, currently returns a not active\n  message.\n\n### Stable Routes (`stable.routes.ts`)\n\nDefines the routes for user-related operations.\n\n### User Services (`user.services.ts`)\n\nContains the business logic for user operations, such as creating a user and\nretrieving users.\n\n### Utility Functions\n\n- **Async Handler (`async.ts`)**: Safely handles async operations to catch\n  errors.\n\n  ```ts\n  export function safeAsync(func) {\n    return async (context) =\u003e {\n      try {\n        return await func(context)\n      } catch (error) {\n        return exception(\n          context,\n          HTTPStatus.InternalServerError,\n          \"Internal Server Error\",\n        )\n      }\n    }\n  }\n  ```\n\n  **Explanation**: This function wraps asynchronous operations to handle errors\n  gracefully. It catches any errors thrown within the wrapped function and\n  returns a standardized error response.\n\n- **Response (`response.ts`)**: Standardizes JSON responses.\n\n  ```ts\n  export function response(context, message, data, extra, success) {\n    return context.json({\n      success: success || true,\n      message,\n      ...extra,\n      data,\n    })\n  }\n  ```\n\n  **Explanation**: This function formats the response sent to the client. It\n  ensures a consistent response structure with optional additional data and\n  success status.\n\n- **Exception (`response.ts`)**: Handles exceptions and sends error responses.\n\n  ```ts\n  export function exception(context, status, error) {\n    if (status \u0026\u0026 error instanceof Error) {\n      context.status(status)\n      return context.json({\n        success: false,\n        status: status,\n        message: error.message,\n      })\n    }\n    context.status(500)\n    return context.json({\n      success: false,\n      status: 500,\n      message: \"Internal Server Error\",\n    })\n  }\n  ```\n\n  **Explanation**: This function handles exceptions and sends a structured error\n  response. It sets the HTTP status code and returns an error message.\n\n## Customization\n\n### Adding Plugins\n\nYou can easily add plugins to this starter kit from the\n[Hono website](https://hono.dev/). Follow the instructions on the website to\nintegrate additional functionalities as per your requirements.\n\n### Changing Database Driver\n\nThe starter kit uses Mongoose for MongoDB. However, you can replace it with any\nother database driver by updating the database connection logic in `main.ts` and\nadjusting the models and services accordingly.\n\n## Getting Started\n\n1. **Clone the repository**:\n   ```sh\n   git clone https://github.com/a4arpon/deno-starter-kit.git\n   ```\n\n2. **Install Deno**: Follow the instructions on the\n   [official Deno website](https://deno.com).\n\n3. **Run the application**:\n   ```sh\n   deno task start\n   ```\n\n## Contribution\n\nContributions are welcome. Please create an issue or submit a pull request on\nGitHub.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa4arpon%2Fdeno-back-end-starterkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fa4arpon%2Fdeno-back-end-starterkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa4arpon%2Fdeno-back-end-starterkit/lists"}