{"id":24087971,"url":"https://github.com/tinybirdco/bigquery-dashboard","last_synced_at":"2026-06-15T05:32:38.913Z","repository":{"id":201605988,"uuid":"706393198","full_name":"tinybirdco/bigquery-dashboard","owner":"tinybirdco","description":null,"archived":false,"fork":false,"pushed_at":"2023-10-19T17:45:34.000Z","size":663,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-10T03:56:23.980Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tinybirdco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-10-17T21:27:50.000Z","updated_at":"2024-11-23T11:43:22.000Z","dependencies_parsed_at":"2024-03-04T12:30:17.149Z","dependency_job_id":null,"html_url":"https://github.com/tinybirdco/bigquery-dashboard","commit_stats":null,"previous_names":["tinybirdco/bigquery-dashboard"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinybirdco%2Fbigquery-dashboard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinybirdco%2Fbigquery-dashboard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinybirdco%2Fbigquery-dashboard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinybirdco%2Fbigquery-dashboard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tinybirdco","download_url":"https://codeload.github.com/tinybirdco/bigquery-dashboard/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240982536,"owners_count":19888522,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-10T03:56:43.126Z","updated_at":"2026-06-15T05:32:33.896Z","avatar_url":"https://github.com/tinybirdco.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Build a real-time dashboard over BigQuery\n\nThis project includes all of the resources necessary to build a real-time dashboard over a BigQuery table. This project uses Tinybird as a real-time analytics layer over BigQuery that exposes dashboard metrics as low-latency APIs which are consumed by a Next.js frontend.\n\n## Prerequisites\n\n- A BigQuery project\n- The ability to add a `BigQuery Data Viewer` permission to that project\n- A BigQuery table (you can create one from the included [CSV](/baseball_stats.csv))\n- Python \u003e=3.8\n- Node.js\n\n## Instructions\n\n### 1. Set up a free Tinybird Workspace\n\nNavigate to [tinybird.co/signup](https://www.tinybird.co/signup) and create a free account. Create a new Workspace called `bigquery_dashboard` (or name it whatever you want).\n\n### 2. Clone the repository\n\n```bash\ngit clone https://github.com/tinybirdco/bigquery-dashboard.git\ncd bigquery-dashboard\n```\n\n### 3. Install the Tinybird CLI\n\n```bash\npython -mvenv .e\n. .e/bin/activate\npip install tinybird-cli\n```\n\n### 4. Authenticate to Tinybird\n\nCopy your user admin token from [ui.tinybird.co/tokens](https://ui.tinybird.co/tokens). Your user admin token is the token with the format `admin \u003cyour email address\u003e`.\n\nIn the Tinybird CLI, run the following command\n\n```bash\ncd data-project\nexport TB_TOKEN=\u003cyour user admin token\u003e\ntb auth\n```\n\nIf you intend to push this to your own repo, add the `.tinyb` file to your `.gitignore`, as it contains your user admin token.\n\n```bash\necho \".tinyb\" \u003e\u003e .gitignore\n```\n\n### 5. Set up your connection to BigQuery\n\nIn this step, you'll authorize Tinybird to read data from your BigQuery project.\n\n```bash\ncd data-project\ntb connection create bigquery\n#** Log into your Google Cloud Platform Console as a project editor and go to https://console.cloud.google.com/iam-admin/iam\n#** Grant access to this principal: \u003cyour-unique principal\u003e\n#** Assign it the role \"BigQuery Data Viewer\"\n#Ready?  (y, N) [N]: y\n#** Connection bigquery created successfully!\n```\n\n### 6. Create a table in your BigQuery project\n\nUse the [included CSV file](/baseball_stats.csv) or use an existing table. Keep in mind that if you're using an existing BigQuery table, you'll need to create a new Data Source schema definition and updated your Pipes to match. That means everything from here on out will need to be customized to your unique setup.\n\n\u003e Note that if you're using your own BigQuery table, then it might be easier to create the Data Source using the [BigQuery Connector](https://www.tinybird.co/docs/ingest/bigquery.html) in the Tinybird UI.\n\n### 7. Update `baseball_game_stats.datasource` with your BigQuery details\n\nIf you're using the included CSV, you can leave the column definitions alone. Update the BigQuery definition as follows:\n\n```bash\nIMPORT_SERVICE 'bigquery'\nIMPORT_SCHEDULE '0 0 */1 * *' # \u003c- This determines how often your BigQuery table syncs to Tinybird\nIMPORT_STRATEGY 'replace'\nIMPORT_EXTERNAL_DATASOURCE '\u003cyour bigquery project\u003e.\u003cyour bigquery dataset\u003e.\u003cyour bigquery table\u003e'\n```\n\n### 8. Push the resources to your Tinybird Workspace\n\n```bash\ncd data-project\ntb push --force\n```\n\n\u003e Note that depending on the frequency of the Cron schedule you set in the previous step, you may need to force an initial sync with BigQuery. To do so, go to [ui.tinybird.co](https://ui.tinybird.co), find your Data Source (called `baseball_game_stats`), click the three dots in the upper right hand corner, and select \"Sync Now\".\n\n![Force syncing a BigQuery table to Tinybird](/img/force_sync.png)\n\n### 9. Authorize your Next app to read from Tinybird APIs\n\nYou'll need to add some local environment variables to allow your Next.js app to read from Tinybird's APIs. Add the following to `.env.local`:\n\n```bash\nNEXT_PUBLIC_TINYBIRD_HOST=api.tinybird.co #OR api.us-east.tinybird.co\nNEXT_PUBLIC_TINYBIRD_TOKEN=\u003cyour user admin token\u003e\n```\n\n### 10. Run the app\n\n```\nnpm run dev\n```\n\nOpen http://localhost:3000 and you should see this:\n\n![real-time bigquery dashboard](img/final_dashboard_screenshot.png)\n\nNotice the latencies of the API requests. They should be very small (\u003c5 ms depending on your network).\n\n---\n\n## Contributing\n\nIf you find any issues or have suggestions for improvements, please submit an issue or a [pull request](https://github.com/tinybirdco/bigquery-dashboard/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc).\n\n## License\n\nThis code is available under the MIT license. See the [LICENSE](https://github.com/tinybirdco/bigquery-dashboard/blob/main/LICENSE.txt) file for more details.\n\n## Need help?\n\n\u0026bull; [Community Slack](https://www.tinybird.co/join-our-slack-community) \u0026bull; [Tinybird Docs](https://docs.tinybird.co/) \u0026bull;\n\n## Authors\n\n- [Cameron Archer](https://github.com/tb-peregrine)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinybirdco%2Fbigquery-dashboard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftinybirdco%2Fbigquery-dashboard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinybirdco%2Fbigquery-dashboard/lists"}