Skip to content

Conversation

@cfurrow
Copy link

@cfurrow cfurrow commented Nov 11, 2025

📝 Description

As pointed out in issue #177, the DEFAULT_BILLING_MODE env variable does not appear to be respected or used, and the premium "gates" and ads still show when self hosting and setting that variable to "DISABLED" or "FREEMIUM".

Looking at the code, it appears that using this env var was not implemented yet.

This PR creates a centralized place to retrieve the billing configuration details, and also hides any premium gates or ads if the billing config is disabled or set to "freemium".

NOTE: I used Claude Code to help me find all places that needed new billing config logic introduced that would support the "disabled" or "freemium" values of DEFAULT_BILLING_MODE.

📋 Checklist

  • My code follows the project conventions
  • This PR includes breaking changes: Potentially! It sets the default billing mode to "disabled" if the env var is not set.
  • I have updated documentation if necessary

🗃️ Prisma Migrations (if applicable)

  • I have created a migration
  • I have tested the migration locally

📸 Screenshots (if applicable)

Premium status is "active" when setting DEFAULT_BILLING_MODE="DISABLED"

CleanShot 2025-11-11 at 15 41 47

Statistics page does not render the "upgrade" overlay when DEFAULT_BILLING_MODE="DISABLED"
CleanShot 2025-11-11 at 15 42 46

The "remove ads" link is removed when DEFAULT_BILLING_MODE="DISABLED"
image

I created a "premium" program, and all users can see/use it when DEFAULT_BILLING_MODE="DISABLED"

image image

And more, I'm sure.

🔗 Related Issues

#177

@vercel
Copy link

vercel bot commented Nov 11, 2025

@cfurrow is attempting to deploy a commit to the Workoutcool Team Team on Vercel.

A member of the Team first needs to authorize it.

@cfurrow cfurrow force-pushed the default-billing-mode-fix branch from 9ad6590 to fea6dec Compare November 11, 2025 20:47
Comment on lines +38 to +41
// Don't show ads if billing is disabled (self-hosted instances with no billing)
if (billingMode === "DISABLED") {
return <>{fallback}</>;
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should "FREEMIUM" still show ads? It would in this case, and only disable ads if user is premium, or if the billing mode was "DISABLED"

Comment on lines +36 to +38
DEFAULT_BILLING_MODE: z
.enum(["DISABLED", "LICENSE_KEY", "SUBSCRIPTION", "FREEMIUM"])
.default("DISABLED"),
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a breaking change if DEFAULT_BILLING_MODE is not currently set in environments, we would be defaulting to "disabled" which may not be expected. I'll note this in the PR description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant