{"id":13494853,"url":"https://github.com/finom/vovk","last_synced_at":"2025-04-06T17:11:28.033Z","repository":{"id":180785012,"uuid":"665697965","full_name":"finom/vovk","owner":"finom","description":"🐺 Back-end meta-framework for Next.js","archived":false,"fork":false,"pushed_at":"2025-03-30T08:08:28.000Z","size":7386,"stargazers_count":47,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-30T09:20:02.710Z","etag":null,"topics":["controller","decorators","nestjs","nextjs","nextjs13","nodejs","rest-api","service","threading","worker"],"latest_commit_sha":null,"homepage":"https://vovk.dev","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/finom.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-12T19:42:22.000Z","updated_at":"2025-03-22T21:47:42.000Z","dependencies_parsed_at":"2023-11-13T22:24:57.966Z","dependency_job_id":"3b919635-b188-459d-be9c-99af06fb1ebc","html_url":"https://github.com/finom/vovk","commit_stats":{"total_commits":892,"total_committers":1,"mean_commits":892.0,"dds":0.0,"last_synced_commit":"b1fe5ff61f06d478be9d4e0aace020c548f40fe0"},"previous_names":["finom/nextjs-api-router","finom/nextjs-alternative-router","finom/next-wednesday","finom/next-epoch","finom/next-smoothie","finom/vovk"],"tags_count":264,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finom%2Fvovk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finom%2Fvovk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finom%2Fvovk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finom%2Fvovk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/finom","download_url":"https://codeload.github.com/finom/vovk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247517912,"owners_count":20951718,"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":["controller","decorators","nestjs","nextjs","nextjs13","nodejs","rest-api","service","threading","worker"],"created_at":"2024-07-31T19:01:28.845Z","updated_at":"2025-04-06T17:11:28.003Z","avatar_url":"https://github.com/finom.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e \n  \u003cpicture\u003e\n    \u003csource width=\"300\" media=\"(prefers-color-scheme: dark)\" srcset=\"https://vovk.dev/vovk-logo-white.svg\"\u003e\n    \u003csource width=\"300\" media=\"(prefers-color-scheme: light)\" srcset=\"https://vovk.dev/vovk-logo.svg\"\u003e\n    \u003cimg width=\"300\" alt=\"vovk\" src=\"https://vovk.dev/vovk-logo.svg\"\u003e\n  \u003c/picture\u003e\u003cbr\u003e\n  \u003cstrong\u003eRESTful RPC for Next.js\u003c/strong\u003e\n  \n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  Transforms \u003ca href=\"https://nextjs.org/docs/app\"\u003eNext.js\u003c/a\u003e into a powerful REST API platform with RPC capabilities. \n  \u003cbr\u003e\u003cbr\u003e\n  ℹ️ An ultimate version of Vovk.ts is coming soon. Stay tuned!\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://vovk.dev/\"\u003eDocumentation\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://discord.gg/qdT8WEHUuP\"\u003eDiscord\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://github.com/finom/vovk-examples\"\u003eCode Examples\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://github.com/finom/vovk-zod\"\u003evovk-zod\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://github.com/finom/vovk-hello-world\"\u003evovk-hello-world\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://github.com/finom/vovk-react-native-example\"\u003evovk-react-native-example\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/vovk\"\u003e\u003cimg src=\"https://badge.fury.io/js/vovk.svg\" alt=\"npm version\" /\u003e\u003c/a\u003e\u0026nbsp;\n  \u003ca href=\"https://www.typescriptlang.org/\"\u003e\u003cimg src=\"https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg\" alt=\"TypeScript\" /\u003e\u003c/a\u003e\u0026nbsp;\n  \u003ca href=\"https://github.com/finom/vovk/actions/workflows/main.yml\"\u003e\u003cimg src=\"https://github.com/finom/vovk/actions/workflows/main.yml/badge.svg\" alt=\"Build status\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\n \u003cbr /\u003e\n\nExample back-end Controller Class:\n\n```ts\n// /src/modules/post/PostController.ts\nimport { get, prefix, type VovkRequest } from 'vovk';\nimport PostService from './PostService';\n \n@prefix('posts')\nexport default class PostController {\n  /**\n   * Create a comment on a post\n   * POST /api/posts/:postId/comments\n   */\n  @post(':postId/comments')\n  static async createComment(\n    // decorate NextRequest type with body and query types\n    req: VovkRequest\u003c\n      { content: string; userId: string }, \n      { notificationType: 'push' | 'email' }\n    \u003e,\n    { postId }: { postId: string } // params\n  ) {\n    // use standard Next.js API to get body and query\n    const { content, userId } = await req.json();\n    const notificationType = req.nextUrl.searchParams.get('notificationType');\n \n    // perform the request to the database in a custom service\n    return PostService.createComment({ \n      postId, content, userId, notificationType,\n    });\n  }\n}\n```\n\nExample component that uses the auto-generated client library:\n\n```tsx\n'use client';\nimport { useState } from 'react';\nimport { PostController } from 'vovk-client';\nimport type { VovkReturnType } from 'vovk';\n \nexport default function Example() {\n  const [response, setResponse] = useState\u003cVovkReturnType\u003ctypeof PostController.createComment\u003e\u003e();\n \n  return (\n    \u003c\u003e\n      \u003cbutton\n        onClick={async () =\u003e setResponse(\n          await PostController.createComment({\n            body: { \n              content: 'Hello, World!', \n              userId: '1', \n            },\n            params: { postId: '69' },\n            query: { notificationType: 'push' }\n          })\n        )}\n      \u003e\n        Post a comment\n      \u003c/button\u003e\n      \u003cdiv\u003e{JSON.stringify(response)}\u003c/div\u003e\n    \u003c/\u003e\n  );\n}\n```\n\nAlternatively, the resource can be fetched wit the regular `fetch` function:\n\n```ts\nfetch('/api/posts/69?notificationType=push', {\n  method: 'POST',\n  body: JSON.stringify({ \n    content: 'Hello, World!', \n    userId: '1', \n  }),\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffinom%2Fvovk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffinom%2Fvovk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffinom%2Fvovk/lists"}