Tutorials

Using NPM Packages in Xano

Xano's NPM package support opens up the entire JavaScript and TypeScript ecosystem directly inside your backend — and the best part is you don't need to be a developer to take advantage of it. Whether you want to generate charts, manipulate images, create PDFs, handle encryption, or translate text, there's almost certainly an NPM package that can do it for you.

What Is an NPM Package?

An NPM package is a pre-built library designed to perform specific tasks in JavaScript or TypeScript. Think of it as a ready-made tool you can plug into your code. Tasks like generating UUIDs, doing advanced math, or converting emoji shortcodes to actual emoji symbols are all fair game. If Xano doesn't handle something natively, an NPM package probably will.

How to Use NPM Packages in Xano

To use NPM packages, you'll work with Lambda functions — blocks of JavaScript or TypeScript that sit right alongside your Xano function stacks. You import the package you need, write a small function to call it, and return the result. It's that straightforward.

If writing code feels intimidating, the Lambda Assistant is your best friend here. Just describe what you want to build in plain language, and the assistant will find the right package, write the code for you, and explain what it does. For example, you can tell it to "translate the contents of my text input to Spanish" and it will generate the complete Lambda function ready to use.

Best Practices to Keep in Mind

Before you start importing packages everywhere, here are some important guidelines to follow:

  • Pin specific package versions to keep your Lambda functions efficient and predictable.
  • Only import packages you actually use — every import adds to execution time.
  • Never hardcode sensitive information like API keys inside your Lambda functions. Store those in your workspace environment variables and reference them from there.
  • Review and test AI-generated code before pushing anything to production. The Lambda Assistant is powerful, but you'll want to verify and iterate before going live.
  • Research unfamiliar packages on the NPM website to understand what they do and check their documentation.

A Real-World Example: Generating a Sales Chart

Here's a practical example that shows just how powerful this can be. By combining a database query with a Lambda function using the chart.js library, you can generate a fully rendered HTML sales chart — entirely on your Xano backend, with no external API calls.

This approach has real advantages. You save money by avoiding third-party charting services, you ensure consistent rendering across web and mobile frontends, and you keep heavy computation on the backend where it belongs. It's also a great solution when working with legacy systems that can't support modern frontend charting tools.

NPM package support is a major unlock for building more capable, self-contained backends in Xano — and now it's available to everyone, regardless of coding background.

Sign up for Xano

Join 100,000+ people already building with Xano.
Start today and scale to millions.