Transforms Next.js into a powerful and extensible REST API platform
npx create-next-app -e https://github.com/finom/vovk-hello-world
For detailed information on Vovk.ts installation visit the official documentation
npm i vovk-client vovk
or yarn add vovk-client vovk
.compilerOptions.experimentalDecorators
to true in your tsconfig.json.npx vovk dev
that wraps the original npx next dev
to set required ports and open http://localhost:3000.--no-next-dev
in order to avoid running next dev
internally and provide PORT variable explicitly: PORT=3000 concurrently 'vovk dev --no-next-dev' 'next dev' --kill-others
npx vovk generate
before npx next build
. Create NPM script: "vovk generate && next build"
.Run your full-stack app on a single port. Vovk.ts is an addon over documented Next.js API routes.
No more workarounds and new protocols. Create RESTful API for your Next.js app with ease.
Specially designed for Next.js App Router, Vovk doesn't introduce complex abstractions by being just a wrapper over route handlers making it easy to learn.
Edge runtime is available out of the box. Your REST API is geographically closer to users.
Vovk.ts is tiny and has zero dependencies.
Vovk.ts is a well-typed library that also exports types for any use-case imaginable.
You can jump straight from the client-side to the controller implementation, making the development process easier, thanks to Mapped Types in TypeScript.
You can completely redefine the behavior of the generated library by implementing your own fetching function. This allows tight integration with your application's state logic or the addition of extra options.
Read DocsCreating a full-stack React-Native application has never been so easy! Set up a project with React Native, Next.js, and Vovk.ts, and start making requests.
See exampleBundle and distribute your REST API client library with ease. The examples below utilize the vovk-examples package, bundled with Webpack, which accesses REST endpoints from the Examples Website API.
See Examples RepositoryVovkRequest
that extends NextRequest to define request body and search query in order to set up proper type recognition. If you're familiar with using them, you already know how to handle operations like retrieving the JSON body, Request Body FormData, search query, making a redirect, using cookies, accessing headers, etc.vovkZod
decorator implemented at vovk-zod package. The validation is isomorphic, meaning it works on both the server and the client and the data is validated before it reaches the server. Try it yourself:See the code for this example here. The examples website also includes React Hook Form example that you can view by this link.Sponsor the author of this project on Github ♥️
You can also contact me via email from my Github profile