2 min read
nextjs-server-action-tester
๐กIn a recent project, I was responsible for developing the frontend using Next.js, while a colleague handled the backend logic. As a core Node.js developer, my colleague was accustomed to using Postman for testing API endpoints. However, when it came to server actions in Next.jsโfunctions that are executed directly on the server and aren't exposed as API endpointsโhe found it challenging to test them using traditional tools like Postman.
This challenge sparked the idea to create a tool that could scan a Next.js codebase, identify all server actions, and provide a user interface to test these actions ๐ฏ. The goal was to streamline the testing process for server actions, especially for developers who are more familiar with traditional API testing methods. This led to the creation of nextjs-server-action-tester
๐.
nextjs-server-action-tester
? ๐คnextjs-server-action-tester
is an npm package designed to make the testing of server actions in Next.js projects as straightforward as possible. It automates the process of scanning your project, generates metadata, and creates a user-friendly UI for listing, searching, and executing server functions ๐จ. The tool supports both JavaScript and TypeScript, and it comes with customizable configurations and a built-in light/dark mode.
nextjs-server-action-tester
๐npm install nextjs-server-action-tester
http://localhost:3000/list-actions
). Here, you can view all detected server actions, search for specific actions, input parameters, and execute them ๐.nextjs-server-action-tester
bridges the gap between traditional API testing tools like Postman and the server actions feature in Next.js. It empowers developers, especially those familiar with Node.js and API testing, to test server actions with ease. The tool integrates directly into your project, giving you full control while keeping the development process smooth and efficient.
Contributions are welcome! If you have ideas for improvements or find any issues, feel free to submit a pull request or open an issue on the GitHub repository.
By sharing this tool, I hope to make the development and testing of server actions in Next.js projects more accessible and efficient. Whether you're working on a solo project or collaborating with a team, nextjs-server-action-tester can be a valuable addition to your development toolkit ๐ผ.