Getting started with Tinybird.js¶
Among other things, Tinybird.js provides you with an easy way to:
Import and append data into Tinybird Analytics.
Run live queries from your serverless applications. No back-end needed.
Build and run ETL pipelines.
Render specific visualization components.
Perform analytics in a secure environment.
Using the library¶
You need an Auth token to get started. Go to the Web UI and open the Auth token modal under your user settings. Once you have your Auth token, you can specify it in the code when initializaing the
//norun let tinyb = tinybird(your_auth_token)
Note that once you are logged in to the Web UI, all the examples in this documentation will (where possible) already include the necessary tokens for you to be able to copy and paste them directly into your apps.
You can use Tinybird.js by including it directly in your html files or you can use a module bundler.
Using Tinybird.js through Tinybird Analytics’ CDN¶
Once you have included the library, insert the following code in your app to make a basic query right from your frontend application.
// tinybird.js constructor function requires an Auth token. let tinyb = tinybird('<token>') let res = await tinyb.query('select * from <pipe> LIMIT 3') console.log(res.data) console.log("query time: " + res.statistics.elapsed)
Using a module bundler¶
You can also install Tinybird.js using npm
//norun npm install --save tinybird.js
For Tinybird.js, you can use this