{"id":24087932,"url":"https://github.com/tinybirdco/tinybird-quick-start","last_synced_at":"2025-07-08T12:43:38.803Z","repository":{"id":255067610,"uuid":"847870107","full_name":"tinybirdco/tinybird-quick-start","owner":"tinybirdco","description":"Demo app for the Tinybird Quick Start video and guide","archived":false,"fork":false,"pushed_at":"2024-08-27T19:06:49.000Z","size":93,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-11T09:08:51.023Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","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","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}},"created_at":"2024-08-26T17:48:00.000Z","updated_at":"2025-02-28T11:15:16.000Z","dependencies_parsed_at":"2024-08-27T21:19:49.770Z","dependency_job_id":null,"html_url":"https://github.com/tinybirdco/tinybird-quick-start","commit_stats":null,"previous_names":["tinybirdco/tinybird-quick-start"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tinybirdco/tinybird-quick-start","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinybirdco%2Ftinybird-quick-start","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinybirdco%2Ftinybird-quick-start/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinybirdco%2Ftinybird-quick-start/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinybirdco%2Ftinybird-quick-start/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tinybirdco","download_url":"https://codeload.github.com/tinybirdco/tinybird-quick-start/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinybirdco%2Ftinybird-quick-start/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264271825,"owners_count":23582761,"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:15.154Z","updated_at":"2025-07-08T12:43:38.785Z","avatar_url":"https://github.com/tinybirdco.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# quick-start-demo\n \nThis repo contains the accompanying demo app to the Tinybird Quick Start video + guide.\n\nYou will accomplish the following:\n1. Sign up for Tinybird\n2. Ingest data\n3. Query data\n4. Publish as an API\n5. Call the API\n6. Update Tinybird workspace via CLI\n\n## Run the app locally\n\n### Prerequisites\n- Node.js \u003e= 18.18\n- Python: 3.8, 3.9, 3.10, or 3.11\n- A [free Tinybird account](https://tinybird.co/signup)\n\n### Install dependencies\n\nOpen repo in VS Code or editor of choice.\n\nThen install app dependencies from the root of the repo:\n\n```bash\nnpm i\n```\n\n## Tinybird setup\nCreate a [free Tinybird account](https://tinybird.co/signup)\n\nSelect region\n\nCreate workspace called *customer_rewards*\n\n### Data Source\n\nUpload orders.ndjson (found in quick-start-demo/data)\n\nAppend data source using Events API\n\nFrom the terminal run one of the following:\n\nCopy cURL command from Events API modal and change -d line to\n```bash\n      -d $'{\"cost\":8.01,\"date\":\"2024-08-09 10:32:20.164\",\"first_name\":\"Cameron\",\"online_order\":1,\"order\":\"pastry\",\"store\":\"145 N Washington Boulevard\",\"transaction_id\":\"7dc1f433-ccbd-4791-b8df-701643b0bbae\",\"used_rewards\":1}'\n```\nOR\n\nUpdate the following with your Tinybird API base url and admin token\n\n```bash\ncurl \\\n      -X POST '\u003cTINYBIRD API BASE URL\u003e/v0/events?name=orders' \\\n      -H \"Authorization: Bearer \u003cTINYBIRD ADMIN TOKEN\u003e\" \\\n      -d $'{\"cost\":8.01,\"date\":\"2024-08-09 10:32:20.164\",\"first_name\":\"Cameron\",\"online_order\":1,\"order\":\"pastry\",\"store\":\"145 N Washington Boulevard\",\"transaction_id\":\"7dc1f433-ccbd-4791-b8df-701643b0bbae\",\"used_rewards\":1}'\n``` \n\n### Pipe\n\nIn Tinybird UI, select Create Pipe. \n\nRename Pipe to *rewards* and first node to *spend_and_progress*\n\nCopy the following into *spend_and_progress* node\n```sql\n%\nSELECT\n    first_name AS name,\n    round(sum(cost), 2) AS total_spend,\n    round(total_spend - floor(total_spend, -2), 2) AS current_progress,\n    100 - current_progress AS remaining_spend\nFROM orders\nWHERE used_rewards = 0 AND name = {{ String(name, 'April') }}\nGROUP BY name\n\n```\n\nCopy the following into the transformation node, run, and then rename to *endpoint*\n\n```sql\nSELECT name, 'current_progress' AS type, current_progress AS value\nFROM spend_and_progress\nUNION ALL\nSELECT name, 'remaining' AS type, remaining_spend AS value\nFROM spend_and_progress\nORDER BY type\n```\n\n### API Endpoint and Chart\n\nSelect Create API Endpoint and select endpoint\n\n(to test, copy HTTP request into new browser tab)\n\nSelect Create Chart\n\nGeneral tab:\n- Name: Next Reward\n- Type: Donut Chart\n\nData tab\n- Index: type\n- Category: value\n- Legend: Show legend in chart checked\n\nStyle tab\n- Chart colors: update 2nd color to #717380\n- Height: 300px\n- Border Radius: 6px\n\nSave chart\n\n### Update app\n\nInstall Tinybird charts from the root of the repo by running\n\n```bash\nnpm install @tinybirdco/charts\n```\n\nCopy Next Reward component into components/next-reward.tsx and save\n\nGo to dashboard/page.tsx and Import NextReward component and add it into the Page() component then save\n\n### Run the demo app\n\nRun it locally:\n\n```bash\nnpm run dev\n```\n\nThen open [http://localhost:3000/dashboard](http://localhost:3000/dashboard) with your browser.\n\n## Bonus: use CLI to see additional charts in action\n\n## Push additional Pipes using Tinybird CLI\n\nReference; [CLI overview](https://www.tinybird.co/docs/cli/overview)\n\nFrom top-level, move to tinybird folder\n\n```bash\ncd tinybird\n```\n\nCreate a virtual environment for Python 3\n\n```bash\npython3 -m venv .venv\nsource .venv/bin/activate\n```\n\nAuthenticate with your admin token\n\n```bash\ntb auth -i\n```\n\nPush the Pipes\n\n```bash\ntb push\n```\n\n### Add your Tinybird parameters to environment variables\n\nReturn to repo's top-level with a new terminal or \n```bash\ncd ..\n```\n\nCreate a new file `.env.local`\n```bash\ncp .env.example .env.local\n```\n\nYou need to copy your Tinybird host and token to the `.env.local` file in your directory:\n\nMake sure to use the correct [API base URL](https://www.tinybird.co/docs/api-reference/overview#regions-and-endpoints) for your selected region \n\n\n```bash\nNEXT_PUBLIC_TINYBIRD_API_BASE_URL=\"YOUR API BASE URL (ex: https://api.tinybird.co)\"\nNEXT_PUBLIC_TINYBIRD_STATIC_READ_TOKEN=\"chart_read_token (available in UI from Tokens after pushing pipes)\"\n```\n\n### Check out the demo app\n\nOpen [http://localhost:3000](http://localhost:3000) with your browser to see all of the charts!\n\n(Note: you may need to restart your local server)\n\n```bash\nnpm run dev\n```\n\n## Congrats!\nWhat will you build next?\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinybirdco%2Ftinybird-quick-start","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftinybirdco%2Ftinybird-quick-start","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinybirdco%2Ftinybird-quick-start/lists"}