-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/subscription plans #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
103 commits
Select commit
Hold shift + click to select a range
cfff0cb
:sparkles: feat: Prompt guest users to log in when attempting to down…
danarocha-br 42ac437
:sparkles: feat: Implement watermarks for exported images and OG imag…
danarocha-br f7e178b
:sparkles: feat: Implement Stripe integration for subscriptions and r…
danarocha-br 3b9463c
:sparkles: feat: Implement public sharing with view limits and usage …
danarocha-br 3a1abf2
:sparkles: feat: Introduce folder usage limits, integrate upgrade pro…
danarocha-br 226b5d5
:sparkles: feat: Use Supabase service role client in Stripe webhook a…
danarocha-br 21e9994
:sparkles: feat: Centralize SQL plan limit definitions and add a vali…
danarocha-br bcf7b65
:sparkles: feat: introduce video export limits with usage tracking, u…
danarocha-br eaa7ae5
:sparkles: feat: Implement video export usage limits and add decremen…
danarocha-br fe74ba0
:sparkles: feat: Add Stripe webhook audit logging, Sentry error repor…
danarocha-br 98f6aa4
:sparkles: feat: Introduce usage tracking and sharing features with s…
danarocha-br d59c4ba
:wrench: refactor: Migrate usage counter updates from application act…
danarocha-br c85aa65
:sparkles: feat: Implement consistent error handling with new `Friend…
danarocha-br 76cecf4
:sparkles: feat: Introduce Arcjet rate limiting to various API routes…
danarocha-br eee1439
:sparkles: feat: Implement Zod-based input validation for snippet and…
danarocha-br c73c90b
:sparkles: feat: introduce `withAuth` higher-order functions to centr…
danarocha-br 2bbc745
:sparkles: feat: Add Stripe checkout success and canceled pages, upda…
danarocha-br 36cfd59
:sparkles: feat: Implement 'over limit' tracking for user content wit…
danarocha-br 4cd460d
:sparkles: feat: Introduce `@t3-oss/env-nextjs` for environment varia…
danarocha-br e970d82
:sparkles: feat: add CSRF protection to middleware and remove environ…
danarocha-br b527e37
:sparkles: feat: Implement user usage RPC with fallback and Sentry er…
danarocha-br 76761fe
:sparkles: feat: add database migration for new foreign key and compo…
danarocha-br 8267e94
:bug: refactor: Improve Stripe price ID mapping, use native disabled …
danarocha-br 19bf608
:wrench: refactor: Implement collection-snippet many-to-many relation…
danarocha-br 12e9945
:sparkles: feat: Enhance Next.js configuration with image optimizatio…
danarocha-br 225cb94
:sparkles: feat: Refactor animation update logic to conditionally inc…
danarocha-br 9acb3f2
:sparkles: feat: Update rate limiting to use publicLimiter across mul…
danarocha-br 59fdf93
:sparkles: feat: Add Radix UI Checkbox component and integrate downgr…
danarocha-br 05858cf
:sparkles: feat: Update user usage and plan queries to handle errors …
danarocha-br 5dc4098
Update src/lib/arcjet/limiters.ts
danarocha-br 64d44d9
:sparkles: feat: Implement new billing and subscription management sy…
danarocha-br 078310b
Merge remote changes and resolve conflict in arcjet limiters
danarocha-br 21ed37d
:sparkles: feat: Add 'use server' directive to withAuthAction utility…
danarocha-br 86023f4
:sparkles: feat: Refactor animation creation and update logic to impr…
danarocha-br dfe5916
:sparkles: feat: Enhance snippet creation logic by adding robust limi…
danarocha-br c55f531
:sparkles: feat: Enhance error handling in checkout session creation …
danarocha-br e43dc9a
:sparkles: feat: Update CSRF handling in proxy logic to simplify orig…
danarocha-br a797d29
:sparkles: refactor: Update billing plan type to 'plan_type' for cons…
danarocha-br b0935d6
:bug: fix: Improve environment variable loading, add skip validation …
danarocha-br 921c97e
:wrench: refactor: Enhance collection retrieval logic by ensuring id …
danarocha-br 3eb56b6
:wrench: refactor: Remove Sentry route wrapping and context applicati…
danarocha-br 52b3f1c
:sparkles: feat: Update free plan limits, refine usage tracking, and …
danarocha-br 6c6cc07
:wrench: refactor: Change runtime environment for URL shortening API …
danarocha-br aa60664
:wrench: chore: Remove rate limiting from the OG image API.
danarocha-br 57e6255
:sparkles: chore: Adjust friendly error page to fill screen height an…
danarocha-br 42262ad
:wrench: refactor: Update FriendlyError component layout for better c…
danarocha-br 0786dc9
:sparkles: feat: allow same-origin requests and Vercel preview URLs i…
danarocha-br 740ecdc
:bug: refactor: Move checkout success UI, toast, and redirect logic t…
danarocha-br 1170be8
:sparkles: feat: Introduce `subscription-sync` service to centralize …
danarocha-br 4377f08
:bug: refactor: Split subscription profile update into two parts to a…
danarocha-br f08e5f7
:sparkles: feat: Add `update_user_plan` RPC function and integrate it…
danarocha-br 93de416
:sparkles: feat: Add `reconcile_over_limit_content` function, refine …
danarocha-br 5079ae0
:sparkles: feat: Enhance animation and snippet creation with improved…
danarocha-br efc72a5
:sparkles: feat: Implement usage limits cache management in snippet d…
danarocha-br 7d31894
:sparkles: feat: Remove debug log file, enhance folder creation check…
danarocha-br a67f64c
:sparkles: feat: Remove debug log file, enhance animation and collect…
danarocha-br b640fe8
:sparkles: feat: Enhance animation collection deletion and movement l…
danarocha-br b0cd292
:sparkles: feat: Refactor collection deletion logic to include snippe…
danarocha-br f0acfe7
:sparkles: feat: Add ConfirmDeleteDialog component and integrate it i…
danarocha-br 3f33c36
:sparkles: feat: Enhance usage limits computation with agent logging …
danarocha-br 8f39738
:bug: fix: Update validation error message for code input, enhance us…
danarocha-br 3b021df
:sparkles: feat: Implement subscription synchronization functionality…
danarocha-br 9ba6573
feat: Implement comprehensive billing dialog with payment method and …
danarocha-br 576628e
:sparkles: feat: Implement a new downgrade feature with dedicated UI …
danarocha-br 973b8ba
:bug: fix: Prevent duplicate subscriptions and enhance invoice displa…
danarocha-br f3e132b
:lipstick: chore: make settings panel more accessible
danarocha-br 4c47b1a
:sparkles: feat: Implement Stripe customer portal return handling and…
danarocha-br 8489bf7
:sparkles: feat: Update plan terminology from 'started' to 'starter' …
danarocha-br 0288bd3
🗑️ chore: Remove verbose console logs and refine subscription period …
danarocha-br 8cc6c56
:sparkles: feat: Add email preview and development scripts, enhance p…
danarocha-br e6232ff
:sparkles: feat: Add SQL function to gracefully handle user deletion …
danarocha-br e97769e
:bug: fix: Enhance animation persistence by skipping auto-save for em…
danarocha-br 4418388
:bug: fix: Enhance webhook handling and subscription management by ve…
danarocha-br 90e97d3
:bug: fix: Clean up account deletion process by removing unnecessary …
danarocha-br b373f1c
:sparkles: feat: Integrate comprehensive tracking for user actions in…
danarocha-br 65d4e77
:wrench: chore: Update pnpm version to 10.26.0 in plan-validation wor…
danarocha-br 4221eb5
:bug: fix: Enhance user snippet saving process by adding usage data r…
danarocha-br b943e68
:bug: fix: Improve user snippet saving by implementing session valida…
danarocha-br dd6f3f6
:art: style: Update letter-spacing for code elements to zero in CSS a…
danarocha-br b4bb900
:sparkles: feat: Enhance error handling in animation actions with a s…
danarocha-br 2f564ea
:sparkles: feat: Introduce JSON type definitions in Liveblocks config…
danarocha-br 3eb5530
:sparkles: feat: Add Content Security Policy and X-Frame-Options head…
danarocha-br 5f2543d
:sparkles: feat: Update plan validation workflow to trigger on specif…
danarocha-br 7172249
:sparkles: feat: Update Keepalive workflow to run on Mondays at 00:00…
danarocha-br e209e67
:sparkles: feat: Update Notion URL handling in generatePlatformUrl fu…
danarocha-br 0da4690
:sparkles: feat: Refactor plan validation workflow to trigger on spec…
danarocha-br a0ddb08
:bug: fix: Refactor OG image generation to improve error handling and…
danarocha-br b643704
:sparkles: feat: Enhance animation embed functionality by adding auto…
danarocha-br a5263d7
:sparkles: feat: Enhance OG image generation by implementing syntax h…
danarocha-br 8f8ca44
:sparkles: feat: Integrate watermark visibility preferences across an…
danarocha-br b4ee885
:sparkles: feat: Optimize bundle size for Edge Runtime by temporarily…
danarocha-br b23ed4e
:sparkles: feat: Enhance README with new features for code animations…
danarocha-br 275d047
:sparkles: feat: Refactor watermark preference management by removing…
danarocha-br 5579aa9
:bug: fix: Integrate AuthProvider into Providers component for enhanc…
danarocha-br 79e82ba
:sparkles: feat: Enhance checkout success flow by invalidating billin…
danarocha-br f8c2cd2
:sparkles: feat: Update animation and snippet creation actions to use…
danarocha-br 7ba885f
:fire: refactor: Remove the "Refresh subscription status" button from…
danarocha-br 053de5c
:fire: refactor: Remove watermark visibility management and related e…
danarocha-br 1736a48
:sparkles: feat: Add middleware for CORS handling and Next.js 16 comp…
danarocha-br 124f3e7
:fire: refactor: Remove middleware file for proxy re-export, streamli…
danarocha-br 4f52b3f
:sparkles: feat: Introduce payment method and invoices query keys for…
danarocha-br 3e80aca
:sparkles: feat: Update snippet creation logic to handle null max lim…
danarocha-br 674da0d
:sparkles: feat: Add an empty line at the end of dtos.ts for improved…
danarocha-br File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,34 +1,55 @@ | ||
| NODE_ENV=development | ||
|
|
||
| # GENERAL | ||
| NEXT_PUBLIC_VERCEL_ENV=development | ||
| NEXT_PUBLIC_VERCEL_URL=localhost:3000 | ||
|
|
||
| NEXT_PUBLIC_SENTRY_TUNNEL=/monitoring | ||
| SENTRY_DSN= | ||
|
|
||
| #SUPABASE | ||
| # Required: core platform | ||
| NEXT_PUBLIC_SUPABASE_URL= | ||
| NEXT_PUBLIC_SUPABASE_ANON_KEY= | ||
| SUPABASE_SERVICE_ROLE_KEY= | ||
|
|
||
| #CANNY | ||
| CANNY_API_KEY= | ||
|
|
||
| NEXT_PUBLIC_HOTJAR_SITE_ID= | ||
|
|
||
| #LIVEBLOCKS | ||
| SUPABASE_SERVICE_ROLE_KEY= | ||
| LIVEBLOCKS_SECRET_KEY= | ||
| LIVEBLOCKS_PUCLIC_API_KEY= | ||
|
|
||
| KEEPALIVE_ENDPOINT= | ||
| KEEPALIVE_API_KEY= | ||
|
|
||
| #ANALYTICS | ||
| # Required: app + billing | ||
| NEXT_PUBLIC_APP_URL=http://localhost:3000 | ||
| NEXT_PUBLIC_VERCEL_ENV=development | ||
| NEXT_PUBLIC_VERCEL_URL=localhost:3000 | ||
| NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_... | ||
| STRIPE_SECRET_KEY=sk_test_... | ||
| STRIPE_WEBHOOK_SECRET=whsec_... | ||
| NEXT_PUBLIC_STRIPE_STARTER_MONTHLY_PRICE_ID=price_... | ||
| NEXT_PUBLIC_STRIPE_STARTER_YEARLY_PRICE_ID=price_... | ||
| NEXT_PUBLIC_STRIPE_PRO_MONTHLY_PRICE_ID=price_... | ||
| NEXT_PUBLIC_STRIPE_PRO_YEARLY_PRICE_ID=price_... | ||
|
|
||
| # Optional: observability | ||
| NEXT_PUBLIC_SENTRY_TUNNEL=/monitoring | ||
| SENTRY_DSN= | ||
| SENTRY_ENVIRONMENT= | ||
| SENTRY_TRACES_SAMPLE_RATE= | ||
| SENTRY_PROFILES_SAMPLE_RATE= | ||
| SENTRY_TRACE_PROPAGATION_TARGETS= | ||
| SENTRY_RELEASE= | ||
| SENTRY_REPLAYS_SESSION_SAMPLE_RATE= | ||
| SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE= | ||
|
|
||
| # Optional: analytics + marketing | ||
| NEXT_PUBLIC_POSTHOG_KEY= | ||
| NEXT_PUBLIC_POSTHOG_HOST=https://app.posthog.com | ||
| NEXT_PUBLIC_POSTHOG_ENABLE_LOCAL=false | ||
| POSTHOG_API_KEY= | ||
| NEXT_PUBLIC_HOTJAR_SITE_ID= | ||
| NEXT_PUBLIC_SITE_URL= | ||
| CANNY_API_KEY= | ||
|
|
||
| # Optional: feature flags + experiments | ||
| NEXT_PUBLIC_EXPORT_EXPERIMENT=control | ||
| NEXT_PUBLIC_TRANSITION_EXPERIMENT=control | ||
|
|
||
| #SECURITY | ||
| ARCJET_KEY= | ||
| # Optional: collaboration / security | ||
| ARCJET_KEY= | ||
| NEXT_PUBLIC_LIVEBLOCKS_PUBLIC_API_KEY= | ||
| CORS_ALLOWED_ORIGIN= | ||
| NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA= | ||
| VERCEL_GIT_COMMIT_SHA= | ||
|
|
||
| # Optional: maintenance | ||
| KEEPALIVE_ENDPOINT= | ||
| KEEPALIVE_API_KEY= | ||
| SKIP_ENV_VALIDATION=false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| name: Check Usage Limits | ||
|
|
||
| on: | ||
| schedule: | ||
| # Runs daily at midnight UTC | ||
| - cron: '0 0 * * *' | ||
| # Allow manual triggering from the Actions tab | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| check-usage: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Invoke Usage Check API | ||
| env: | ||
| APP_URL: ${{ secrets.APP_URL || 'https://jollycode.dev' }} | ||
| CRON_SECRET: ${{ secrets.CRON_SECRET }} | ||
| run: | | ||
| if [ -z "$CRON_SECRET" ]; then | ||
| echo "Error: CRON_SECRET secret is not set in GitHub Secrets" | ||
| exit 1 | ||
| fi | ||
|
|
||
| response=$(curl -s -w "\n%{http_code}" -X GET \ | ||
| -H "Authorization: Bearer ${CRON_SECRET}" \ | ||
| "${APP_URL}/api/cron/check-usage") | ||
| http_code=$(echo "$response" | tail -n1) | ||
| body=$(echo "$response" | sed '$d') | ||
|
|
||
| if [ "$http_code" -eq 200 ]; then | ||
| echo "✅ Usage check completed successfully" | ||
| echo "$body" | jq '.' || echo "$body" | ||
| else | ||
| echo "❌ Usage check failed with HTTP $http_code" | ||
| echo "$body" | ||
| exit 1 | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| name: Plan Limits | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - 'src/lib/config/plans.ts' | ||
| - 'supabase/migrations/**' | ||
| - '.github/workflows/plan-validation.yml' | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - 'src/lib/config/plans.ts' | ||
| - 'supabase/migrations/**' | ||
| - '.github/workflows/plan-validation.yml' | ||
|
|
||
| jobs: | ||
| validate-plan-limits: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup pnpm | ||
| # Version is automatically read from package.json packageManager field | ||
| uses: pnpm/action-setup@v4 | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| cache: pnpm | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| - name: Validate plan limits | ||
| run: pnpm run validate:plans |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,7 @@ | |
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
| .cursor/debug.log | ||
|
|
||
| # local env files | ||
| .env*.local | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| import React from "react"; | ||
| import { | ||
| Body, | ||
| Container, | ||
| Head, | ||
| Heading, | ||
| Html, | ||
| Preview, | ||
| Section, | ||
| Text, | ||
| Tailwind, | ||
| } from "@react-email/components"; | ||
| import { Logo } from "../src/components/ui/logo"; | ||
|
|
||
| interface AccountDeletedEmailProps { | ||
| name?: string; | ||
| } | ||
|
|
||
| export default function AccountDeletedEmail({ name }: AccountDeletedEmailProps) { | ||
| return ( | ||
| <Html> | ||
| <Head /> | ||
| <Preview>Your Jolly Code account has been deleted</Preview> | ||
| <Tailwind> | ||
| <Body className="bg-white my-auto mx-auto font-sans"> | ||
| <Container className="border border-solid border-[#eaeaea] rounded my-[40px] mx-auto p-[20px] max-w-[465px]"> | ||
| <div className="flex justify-center"> | ||
| <Logo variant="short" className="mx-auto scale-75 -mb-5" /> | ||
| </div> | ||
| <Heading className="text-black text-xl font-normal text-center p-0 my-[30px] mx-0"> | ||
| Your account has been deleted | ||
| </Heading> | ||
| <Text className="text-black text-[14px] leading-[24px]"> | ||
| Hey {name || "there"}, | ||
| </Text> | ||
| <Text className="text-black text-[14px] leading-[24px]"> | ||
| This email confirms that your Jolly Code account and all associated data have been permanently deleted from our systems. | ||
| </Text> | ||
| <Text className="text-black text-[14px] leading-[24px]"> | ||
| <strong>What was deleted:</strong> | ||
| </Text> | ||
| <Text className="text-black text-[14px] leading-[24px] ml-4"> | ||
| • Your profile and account information<br /> | ||
| • All your code snippets and animations<br /> | ||
| • All your collections and folders<br /> | ||
| • All shared links and associated data<br /> | ||
| • Your subscription information (if applicable) | ||
| </Text> | ||
| <Text className="text-black text-[14px] leading-[24px]"> | ||
| If you had an active subscription, it has been canceled and no further charges will be made. | ||
| </Text> | ||
| <Text className="text-black text-[14px] leading-[24px]"> | ||
| If you didn't request this deletion or have any questions, please contact us immediately at{" "} | ||
| <a href="mailto:support@jollycode.dev" className="text-blue-600 underline"> | ||
| support@jollycode.dev | ||
| </a> | ||
| . | ||
| </Text> | ||
| <Text className="text-black text-[14px] leading-[24px] mt-6"> | ||
| We're sorry to see you go. If you change your mind, you can always create a new account in the future. | ||
| </Text> | ||
| <Text className="text-black text-[14px] leading-[24px] mt-6"> | ||
| Best regards, | ||
| </Text> | ||
| <Text className="text-black text-[14px] leading-[24px]"> | ||
| The Jolly Code Team | ||
| </Text> | ||
| </Container> | ||
| </Body> | ||
| </Tailwind> | ||
| </Html> | ||
| ); | ||
| } | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add curl error handling to prevent false success.
The script doesn't handle curl command failures (network errors, DNS failures, timeouts, connection refused, etc.). If curl fails, the script continues with potentially empty or unexpected variables, leading to unclear error messages or false success.
Apply this diff to add robust error handling:
Additional considerations:
--max-time 30) to prevent the workflow from hanging indefinitely.Alternative implementation with timeout:
🤖 Prompt for AI Agents