
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
A JavaScript wrapper for the Grocy REST API.
node-grocy is a comprehensive client library for interacting with Grocy, an open-source self-hosted ERP system for your groceries and household management. This library provides a clean, Promise-based interface to all Grocy API endpoints.
npm install node-grocy
import Grocy from 'node-grocy';
// Initialize client
const grocy = new Grocy('https://your-grocy-instance.com', 'your-api-key');
// Get all products in stock
async function getStock() {
try {
const stock = await grocy.getStock();
console.log('Products in stock:', stock);
} catch (error) {
console.error('Error fetching stock:', error.message);
}
}
// Add a product to stock
async function addProduct(productId) {
try {
const data = {
amount: 1,
best_before_date: '2023-12-31',
transaction_type: 'purchase',
price: 2.99
};
const result = await grocy.addProductToStock(productId, data);
console.log('Product added:', result);
} catch (error) {
console.error('Error adding product:', error.message);
}
}
// Get volatile stock (due soon, overdue, expired, missing)
async function getVolatileStock() {
try {
const volatileStock = await grocy.getVolatileStock(7); // Products due within 7 days
console.log('Products due soon:', volatileStock.due_products);
console.log('Products overdue:', volatileStock.overdue_products);
console.log('Products expired:', volatileStock.expired_products);
console.log('Products missing:', volatileStock.missing_products);
} catch (error) {
console.error('Error fetching volatile stock:', error.message);
}
}
const grocy = new Grocy(baseUrl, apiKey);
baseUrl: The base URL of your Grocy instance (with or without /api suffix)apiKey: Your Grocy API keyThe library includes methods for all Grocy API endpoints, organized into these categories:
getSystemInfo(): Get information about the Grocy instancegetDbChangedTime(): Get the time when the database was last changedgetConfig(): Get all config settingsgetTime(offset): Get the current server timegetStock(): Get all products in stockgetStockEntry(entryId): Get a specific stock entryeditStockEntry(entryId, data): Edit a stock entrygetVolatileStock(dueSoonDays): Get products due soon, overdue, expired, or missinggetProductDetails(productId): Get details of a productgetProductByBarcode(barcode): Get product by barcodeaddProductToStock(productId, data): Add product to stockaddProductToStockByBarcode(barcode, data): Add product to stock by barcodeconsumeProduct(productId, data): Consume product from stockconsumeProductByBarcode(barcode, data): Consume product by barcodetransferProduct(productId, data): Transfer product between locationsinventoryProduct(productId, data): Set new amount for productopenProduct(productId, data): Mark product as opened...and many more for shopping lists, chores, recipes, tasks, etc.
For detailed documentation on all methods and their parameters, please see the full API documentation.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
A JavaScript wrapper for the Grocy REST API
We found that node-grocy demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.