{"id":16787917,"url":"https://github.com/elie222/tinybird-example","last_synced_at":"2025-08-16T07:36:03.090Z","repository":{"id":237037886,"uuid":"689015043","full_name":"elie222/tinybird-example","owner":"elie222","description":"Set up a Tinybird Next.js project","archived":false,"fork":false,"pushed_at":"2023-09-08T15:39:13.000Z","size":49,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-14T09:57:30.457Z","etag":null,"topics":["clickhouse","nextjs","tinybird"],"latest_commit_sha":null,"homepage":"https://youtube.com/elie2222","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elie222.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-09-08T15:39:04.000Z","updated_at":"2024-06-30T09:18:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"bab8361e-517d-42c8-a893-60f49a934575","html_url":"https://github.com/elie222/tinybird-example","commit_stats":null,"previous_names":["elie222/tinybird-example"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/elie222/tinybird-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elie222%2Ftinybird-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elie222%2Ftinybird-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elie222%2Ftinybird-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elie222%2Ftinybird-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elie222","download_url":"https://codeload.github.com/elie222/tinybird-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elie222%2Ftinybird-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270684150,"owners_count":24627773,"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","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["clickhouse","nextjs","tinybird"],"created_at":"2024-10-13T08:16:21.389Z","updated_at":"2025-08-16T07:36:03.081Z","avatar_url":"https://github.com/elie222.png","language":"TypeScript","readme":"# Tinybird Demo\n\nThis is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).\n\n## Getting Started\n\n```bash\npnpm dev\n```\n\nOpen [http://localhost:3000](http://localhost:3000) with your browser to see the result.\n\n## Tinybird Setup\n\nFollow [Tinybird Quickstart](https://www.tinybird.co/docs/quick-start-cli.html).\n\nInstall Tinybird CLI:\n\n```bash\npython3 -m venv .venv\nsource .venv/bin/activate\npip install tinybird-cli\n```\n\nGo to: https://ui.tinybird.co/ to create a project and copy an admin token. Then paste it in when prompted:\n\n```bash\ntb auth\n```\n\n### Add data to Tinybird\n\nNote, if you're running these commands on this project the files are located in the `tinybird` folder.\n\n```bash\ntb datasource generate https://storage.googleapis.com/tinybird-assets/datasets/guides/events_50M_1.csv\nmv events_50M_1.datasource shopping_data.datasource\ntb push shopping_data.datasource\ntb datasource append shopping_data https://storage.googleapis.com/tinybird-assets/datasets/guides/events_50M_1.csv shopping_data\n```\n\n### Query data from Tinybird\n\nTwo steps:\n1. Create a pipe\n2. Publish an API so we can query the pipe\n\n```bash\ntb pipe generate top_10_searched_products \"SELECT * FROM shopping_data WHERE event == 'search'\"\n```\n\nIn the file change `NODE endpoint` to `NODE search_events`.\n\nAdd a second node to the file:\n\n```sql\nNODE aggregate_by_product_id\nDESCRIPTION \u003e\n    Create a count of searches aggregated by the product ID\nSQL \u003e\n    SELECT product_id, count() as total FROM search_events\n    GROUP BY product_id\n    ORDER BY total DESC\n```\n\nAdd a third node to the file:\n\n```sql\nNODE endpoint\nDESCRIPTION \u003e\n    Exposes top 10 rows as an API\nSQL \u003e\n    SELECT product_id, total FROM aggregate_by_product_id\n    LIMIT 10\n```\n\nPush pipe to Tinybird:\n\n```bash\ntb push top_10_searched_products.pipe\n```\n\nNow we'll publish the API:\n\n```bash\ntb pipe publish top_10_searched_products\n```\n\nCongrats! Now we can query the published API.\n\n```bash\ntb pipe data top_10_searched_products\n```\n\n### Query data from Next.js app\n\nNow that the API endpoint exists we'll make use of it in our app. See `app/api/tinybird/route.ts` for how we query the data. To add new data we can publish events using `app/api/tinybird/publish/route.ts`.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felie222%2Ftinybird-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felie222%2Ftinybird-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felie222%2Ftinybird-example/lists"}