A Node.js/TypeScript library for interacting with the CukCuk OpenPlatform API, designed for restaurant management applications. This open-source client enables developers to seamlessly connect to CukCuk's API for authentication, branch management, and more, following community standards and best practices.
- Type-Safe: Built with TypeScript for robust type checking and IntelliSense support.
- Authentication: Simplifies the process of obtaining and managing access tokens.
- API Endpoints: Supports key CukCuk API endpoints like account login and branch listing.
- Open Source: Licensed under GNU General Public License v3.0, welcoming contributions from the community.
- Modular Design: Easily extendable for additional CukCuk API endpoints.
Install the package via npm:
npm i @luutronghieu/cukcuk-api-clientTo use this library, you need:
- Node.js >= 14.x
- TypeScript >= 4.x (if using TypeScript)
- CukCuk API credentials (
AppID,Domain,SecretKey,CompanyCode)
Obtain your credentials from the CukCuk management portal as described in the official documentation.
Here's a basic example to authenticate and fetch branches using the CukCuk API client:
import { CukCukClient } from "cukcuk-api-client";
const client = new CukCukClient({
secretKey: "your-secret-key",
});
async function main() {
try {
// Authenticate and obtain access token
const loginResponse = await client.account.login({
Domain: "your-domain",
AppId: "your-app-id",
LoginTime: new Date().toISOString(),
});
// Fetch all branches
const branches = await client.branches.getAll({ includeInactive: true });
console.log("Branches:", branches);
} catch (error) {
console.error("Error:", error);
}
}
main();Detailed guides for connecting to each API endpoint are available in the docs directory:
- Branches API
- Categories API
- Customers API
- Employees API
- Inventory Items API
- Tables API
- Orders API
- Order Onlines API
- SAInvoice API
- Table API
Refer to these guides for endpoint-specific parameters, response formats, and error handling.
We welcome contributions! Please follow these steps:
- Fork the repository.
- Create a feature branch (
git checkout -b feature/your-feature). - Commit your changes (
git commit -m 'Add your feature'). - Push to the branch (
git push origin feature/your-feature). - Open a Pull Request.
See our Contributing Guide for more details.
This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.
For issues, feature requests, or questions, please open an issue on the GitHub repository.
- Built with ❤️ by the open-source community.
- Thanks to CukCuk for providing the OpenPlatform API.