{"id":21878663,"url":"https://github.com/btahir/tail-story","last_synced_at":"2025-04-15T03:05:39.658Z","repository":{"id":38766215,"uuid":"282737657","full_name":"btahir/tail-story","owner":"btahir","description":"A Tail Story","archived":false,"fork":false,"pushed_at":"2023-01-10T02:33:47.000Z","size":767,"stargazers_count":15,"open_issues_count":7,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-15T03:05:30.229Z","etag":null,"topics":["firebase","firebase-auth","firebase-functions","gatsby","gatsby-theme-firebase","starter","stripe-customer"],"latest_commit_sha":null,"homepage":"https://tail-story.netlify.app/","language":"TypeScript","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/btahir.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-26T21:38:55.000Z","updated_at":"2024-11-13T03:39:49.000Z","dependencies_parsed_at":"2023-02-08T16:46:35.521Z","dependency_job_id":null,"html_url":"https://github.com/btahir/tail-story","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btahir%2Ftail-story","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btahir%2Ftail-story/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btahir%2Ftail-story/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btahir%2Ftail-story/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/btahir","download_url":"https://codeload.github.com/btahir/tail-story/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248997086,"owners_count":21195799,"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":["firebase","firebase-auth","firebase-functions","gatsby","gatsby-theme-firebase","starter","stripe-customer"],"created_at":"2024-11-28T08:13:22.941Z","updated_at":"2025-04-15T03:05:39.641Z","avatar_url":"https://github.com/btahir.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gatsby Tailwind + Firebase + Stripe Starter\n\nAuthentication and Payments are 40-60% of the work! I wasted enough time on it to realize I needed a system. This starter combines an authentication flow using Firebase with the Stripe Customer Portal where users can manage their subscriptions.\n\n![preview](https://github.com/btahir/tail-story/blob/master/tail-story-preview.png)\n\nLive Demo: https://tail-story.netlify.app/\n\nTo start, cd into project directory and run\n\n```\nyarn \u0026\u0026 yarn dev\n```\n\nTailwind starter wih authentication + stripe. Built on the shoulders of\n\nTailwind Starter: https://github.com/taylorbryant/gatsby-starter-tailwind\n\nGatsby Theme Firebase: https://github.com/epilande/gatsby-theme-firebase\n\nStripe Customer Portal: https://www.netlify.com/blog/2020/07/13/manage-subscriptions-and-protect-content-with-stripe/\n\n## Firebase\n\nUse firebase for authentication (email + social logins) and store user object in firestore. \nLeverage gatsby-firebase-theme for this.\n\n### Set up env variables\n\nFor development, create a .env.development file locally and add these ENV variables. If you want to see gatsby build \u0026\u0026 serve, you will have to create a .env.production file as well. For netlify, add env variables in UI.\n\n```\nFIREBASE_API_KEY=\"\u003cYOURDATA\u003e\"\nFIREBASE_AUTH_DOMAIN=\"\u003cYOURDATA\u003e\"\nFIREBASE_DATABASE_URL=\"\u003cYOURDATA\u003e\"\nFIREBASE_PROJECT_ID=\"\u003cYOURDATA\u003e\"\nFIREBASE_STORAGE_BUCKET=\"\u003cYOURDATA\u003e\"\nFIREBASE_MESSAGING_SENDER_ID=\"\u003cYOURDATA\u003e\"\nFIREBASE_APP_ID=\"\u003cYOURDATA\u003e\"\n```\n\n## Firebase Functions\n\nWe need to setup firebase functions so Stripe webhooks can call them after events (add subscription, change subscription etc).\nSource: https://firebase.google.com/docs/functions/get-started\n\nIn the project directory, run\n\n\n```\nfirebase login\nfirebase init functions\n```\n\nThis will create firebase.json, .firebaserc, functions folder with all the things needed to deploy functions. index.js is where functions live.\nYou will need to updated .firebaserc for the name of your GCP project.\n\nAdd functions to index.js and create deploy.sh file. To deploy functions, cd into the functions directory and run\n```\nsh deploy.sh\n```\n\n### Firebase Function Variables\n\nThese are in the deploy.sh file\n\n```\nexport STRIPE_SIGNING_UPD_SUB=STRIPE_WEBHOOK_SIGNATURE\nexport STRIPE_TOKEN=STRIPE_SECRET_KEY\nexport STRIPE_DEFAULT_PRICE_PLAN=STRIPE_PRICE_PLAN\nexport STRIPE_RETURN_URL=BILLING_PORTAL_RETURN_URL\n```\n\n## Stripe\n\nWe will use the addSubscription hook to create a Stripe customer on sign up. Then we can leverage the Stripe Customer Portal \nto let the user manage their subscription plan. We can use a updateSubscription webhook to update our databse on any Stripe subscription changes.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbtahir%2Ftail-story","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbtahir%2Ftail-story","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbtahir%2Ftail-story/lists"}