🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Update dependencies and enhance documentation structure
Bill Yang7ab608eddb42
diff --git a/docs/package-lock.json b/docs/package-lock.jsonindex df0a2e6ab..86cf02a86 100644--- a/docs/package-lock.json+++ b/docs/package-lock.json@@ -8,6 +8,7 @@"license": "MIT","dependencies": {"@radix-ui/react-accordion": "^1.2.7",+ "@radix-ui/react-slider": "^1.3.2","@tailwindcss/postcss": "^4.1.4","@theguild/remark-mermaid": "^0.3.0","boring-avatars": "^1.11.2",@@ -1061,6 +1062,11 @@"win32"]},+ "node_modules/@radix-ui/number": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/@radix-ui/number/-/number-1.1.1.tgz",+ "integrity": "sha512-MkKCwxlXTgz6CFoJx3pCwn07GKp36+aZyu/u2Ln2VrA5DcdyCZkASEDBTd8x5whTQQL5CiYf4prXKLcgQdv29g=="+ },"node_modules/@radix-ui/primitive": {"version": "1.1.2","resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.2.tgz",@@ -1254,6 +1260,38 @@}}},+ "node_modules/@radix-ui/react-slider": {+ "version": "1.3.2",+ "resolved": "https://registry.npmjs.org/@radix-ui/react-slider/-/react-slider-1.3.2.tgz",+ "integrity": "sha512-oQnqfgSiYkxZ1MrF6672jw2/zZvpB+PJsrIc3Zm1zof1JHf/kj7WhmROw7JahLfOwYQ5/+Ip0rFORgF1tjSiaQ==",+ "dependencies": {+ "@radix-ui/number": "1.1.1",+ "@radix-ui/primitive": "1.1.2",+ "@radix-ui/react-collection": "1.1.4",+ "@radix-ui/react-compose-refs": "1.1.2",+ "@radix-ui/react-context": "1.1.2",+ "@radix-ui/react-direction": "1.1.1",+ "@radix-ui/react-primitive": "2.1.0",+ "@radix-ui/react-use-controllable-state": "1.2.2",+ "@radix-ui/react-use-layout-effect": "1.1.1",+ "@radix-ui/react-use-previous": "1.1.1",+ "@radix-ui/react-use-size": "1.1.1"+ },+ "peerDependencies": {+ "@types/react": "*",+ "@types/react-dom": "*",+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"+ },+ "peerDependenciesMeta": {+ "@types/react": {+ "optional": true+ },+ "@types/react-dom": {+ "optional": true+ }+ }+ },"node_modules/@radix-ui/react-slot": {"version": "1.2.0","resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.2.0.tgz",@@ -1320,6 +1358,37 @@}}},+ "node_modules/@radix-ui/react-use-previous": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/@radix-ui/react-use-previous/-/react-use-previous-1.1.1.tgz",+ "integrity": "sha512-2dHfToCj/pzca2Ck724OZ5L0EVrr3eHRNsG/b3xQJLA2hZpVCS99bLAX+hm1IHXDEnzU6by5z/5MIY794/a8NQ==",+ "peerDependencies": {+ "@types/react": "*",+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"+ },+ "peerDependenciesMeta": {+ "@types/react": {+ "optional": true+ }+ }+ },+ "node_modules/@radix-ui/react-use-size": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/@radix-ui/react-use-size/-/react-use-size-1.1.1.tgz",+ "integrity": "sha512-ewrXRDTAqAXlkl6t/fkXWNAhFX9I+CkKlw6zjEwk86RSPKwZr3xpBRso655aqYafwtnbpHLj6toFzmd6xdVptQ==",+ "dependencies": {+ "@radix-ui/react-use-layout-effect": "1.1.1"+ },+ "peerDependencies": {+ "@types/react": "*",+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"+ },+ "peerDependenciesMeta": {+ "@types/react": {+ "optional": true+ }+ }+ },"node_modules/@react-aria/focus": {"version": "3.20.2","resolved": "https://registry.npmjs.org/@react-aria/focus/-/focus-3.20.2.tgz",diff --git a/docs/package.json b/docs/package.jsonindex 746c08311..75cee6983 100644--- a/docs/package.json+++ b/docs/package.json@@ -10,6 +10,7 @@},"dependencies": {"@radix-ui/react-accordion": "^1.2.7",+ "@radix-ui/react-slider": "^1.3.2","@tailwindcss/postcss": "^4.1.4","@theguild/remark-mermaid": "^0.3.0","boring-avatars": "^1.11.2",diff --git a/docs/src/app/_meta.js b/docs/src/app/_meta.jsindex eee0cd5c6..c76a84ac9 100644--- a/docs/src/app/_meta.js+++ b/docs/src/app/_meta.js@@ -6,6 +6,10 @@ export default {type: "page",title: "Documentation",},+ pricing: {+ type: "page",+ title: "Pricing",+ },// blog: {// type: 'page',// title: 'Blog'diff --git a/docs/src/app/pricing/metadata.js b/docs/src/app/pricing/metadata.jsnew file mode 100644index 000000000..93b40e851--- /dev/null+++ b/docs/src/app/pricing/metadata.js@@ -0,0 +1,4 @@+export const metadata = {+ title: "Pricing",+ description: "Rybbit Analytics pricing",+};diff --git a/docs/src/app/pricing/page.jsx b/docs/src/app/pricing/page.jsxnew file mode 100644index 000000000..0ec76fec5--- /dev/null+++ b/docs/src/app/pricing/page.jsx@@ -0,0 +1,188 @@+"use client";++import Link from "next/link";+import { Slider } from "@/components/ui/slider";+import { Check } from "lucide-react";+import { useState } from "react";++// Available event tiers for the slider+const EVENT_TIERS = [+ 100_000, 250_000, 500_000, 1_000_000, 2_000_000, 5_000_000, 10_000_000,+];++// Define plan features+const PRO_FEATURES = [+ "Unlimited websites",+ "Unlimited team members",+ "Real-time analytics",+ "Custom events",+ "Funnels & user flows",+ "All features"+];++// Format price with dollar sign+function getFormattedPrice(eventLimit, isAnnual) {+ // Monthly prices from stripe.ts+ let monthlyPrice;+ if (eventLimit <= 100_000) monthlyPrice = 19;+ else if (eventLimit <= 250_000) monthlyPrice = 29;+ else if (eventLimit <= 500_000) monthlyPrice = 49;+ else if (eventLimit <= 1_000_000) monthlyPrice = 69;+ else if (eventLimit <= 2_000_000) monthlyPrice = 99;+ else if (eventLimit <= 5_000_000) monthlyPrice = 129;+ else monthlyPrice = 169; // 10M events++ // Annual prices are 10x monthly (2 months free)+ const annualPrice = monthlyPrice * 10;+ return {+ monthly: monthlyPrice,+ annual: annualPrice+ };+}++export default function Pricing() {+ const [eventLimitIndex, setEventLimitIndex] = useState(0); // Default to 100k (index 0)+ const [isAnnual, setIsAnnual] = useState(true);++ const eventLimit = EVENT_TIERS[eventLimitIndex];+ const prices = getFormattedPrice(eventLimit, isAnnual);++ // Handle slider changes+ function handleSliderChange(value) {+ setEventLimitIndex(value[0]);+ }++ return (+ <div className="flex flex-col items-center justify-center">+ <div className="container mx-auto py-12 px-4">+ <div className="mb-10 text-center max-w-3xl mx-auto">+ <h1 className="text-4xl md:text-5xl font-bold tracking-tight pb-4 text-transparent bg-clip-text bg-gradient-to-b from-white via-gray-200 to-gray-400">+ Simple, Transparent Pricing+ </h1>+ <p className="text-lg text-neutral-300 mb-6">+ Privacy-friendly analytics with all the features you need to grow+ </p>+ </div>++ {/* Pricing card */}+ <div className="max-w-lg mx-auto">+ <div className="bg-neutral-800/50 rounded-xl border border-neutral-700 overflow-hidden">+ <div className="p-6">+ {/* Slider section */}+ <div className="mb-6">+ <div className="flex justify-between mb-3 items-center">+ <div>+ <h3 className="font-semibold mb-2">Events per month</h3>+ <div className="text-3xl font-bold text-emerald-400">+ {eventLimit.toLocaleString()}+ </div>+ </div>+ <div className="flex flex-col items-end">+ {/* Billing toggle */}+ <div className="flex gap-3 mb-2 text-sm">+ <button+ onClick={() => setIsAnnual(false)}+ className={`px-3 py-1 rounded-full transition-colors ${!isAnnual+ ? "bg-emerald-500/20 text-emerald-400 font-medium"+ : "text-neutral-400 hover:text-neutral-200"}`}+ >+ Monthly+ </button>+ <button+ onClick={() => setIsAnnual(true)}+ className={`px-3 py-1 rounded-full transition-colors ${isAnnual+ ? "bg-emerald-500/20 text-emerald-400 font-medium"+ : "text-neutral-400 hover:text-neutral-200"}`}+ >+ Annual+ <span className="ml-1 text-xs text-emerald-500">-17%</span>+ </button>+ </div>+ <div className="text-right">+ {isAnnual ? (+ <>+ <span className="text-3xl font-bold">${prices.annual}</span>+ <span className="ml-1 text-neutral-400">+ /year+ </span>+ <div className="text-sm text-neutral-400">+ ${Math.round(prices.annual / 12)}/mo+ </div>+ </>+ ) : (+ <>+ <span className="text-3xl font-bold">${prices.monthly}</span>+ <span className="ml-1 text-neutral-400">+ /month+ </span>+ </>+ )}+ </div>+ </div>+ </div>++ <Slider+ defaultValue={[0]}+ max={EVENT_TIERS.length - 1}+ min={0}+ step={1}+ onValueChange={handleSliderChange}+ className="mb-3"+ />++ <div className="flex justify-between text-xs text-neutral-400">+ {EVENT_TIERS.map((tier, index) => (+ <span+ key={index}+ className={eventLimitIndex === index ? "font-bold text-emerald-400" : ""}+ >+ {tier >= 1_000_000 ? `${tier / 1_000_000}M` : `${tier / 1_000}K`}+ </span>+ ))}+ </div>+ </div>++ <div className="space-y-4 mb-6">+ {PRO_FEATURES.map((feature, i) => (+ <div key={i} className="flex items-center">+ <Check className="h-4 w-4 text-emerald-400 mr-3 shrink-0" />+ <span>{feature}</span>+ </div>+ ))}+ </div>++ <Link href="https://demo.rybbit.io/signup" className="w-full block">+ <button className="w-full bg-emerald-600 hover:bg-emerald-500 text-white font-medium px-5 py-3 rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-emerald-500 focus:ring-opacity-50">+ Start your 14 day free trial+ </button>+ </Link>++ <p className="text-center text-sm text-neutral-400 mt-4">+ No credit card required. Cancel anytime.+ </p>+ </div>+ </div>++ {/* FAQ section */}+ <div className="mt-10 space-y-6">+ <h3 className="text-xl font-semibold mb-4">Frequently Asked Questions</h3>++ <div className="bg-neutral-800/20 p-5 rounded-lg border border-neutral-700">+ <h4 className="font-medium mb-2">Can I change my plan later?</h4>+ <p className="text-neutral-300">+ Absolutely. You can upgrade, downgrade, or cancel your plan at any time through your account settings.+ </p>+ </div>++ <div className="bg-neutral-800/20 p-5 rounded-lg border border-neutral-700">+ <h4 className="font-medium mb-2">What happens if I go over my event limit?</h4>+ <p className="text-neutral-300">+ We'll notify you when you're approaching your limit. You can either upgrade to a higher plan or continue with your current plan (events beyond the limit won't be tracked).+ </p>+ </div>+ </div>+ </div>+ </div>+ </div>+ );+}\ No newline at end of filediff --git a/docs/src/components/ui/slider.tsx b/docs/src/components/ui/slider.tsxnew file mode 100644index 000000000..09391e86b--- /dev/null+++ b/docs/src/components/ui/slider.tsx@@ -0,0 +1,63 @@+"use client"++import * as React from "react"+import * as SliderPrimitive from "@radix-ui/react-slider"++import { cn } from "@/lib/utils"++function Slider({+ className,+ defaultValue,+ value,+ min = 0,+ max = 100,+ ...props+}: React.ComponentProps<typeof SliderPrimitive.Root>) {+ const _values = React.useMemo(+ () =>+ Array.isArray(value)+ ? value+ : Array.isArray(defaultValue)+ ? defaultValue+ : [min, max],+ [value, defaultValue, min, max]+ )++ return (+ <SliderPrimitive.Root+ data-slot="slider"+ defaultValue={defaultValue}+ value={value}+ min={min}+ max={max}+ className={cn(+ "relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",+ className+ )}+ {...props}+ >+ <SliderPrimitive.Track+ data-slot="slider-track"+ className={cn(+ "bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"+ )}+ >+ <SliderPrimitive.Range+ data-slot="slider-range"+ className={cn(+ "bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"+ )}+ />+ </SliderPrimitive.Track>+ {Array.from({ length: _values.length }, (_, index) => (+ <SliderPrimitive.Thumb+ data-slot="slider-thumb"+ key={index}+ className="border-primary bg-background ring-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"+ />+ ))}+ </SliderPrimitive.Root>+ )+}++export { Slider }diff --git a/server/src/cron/monthly-usage-checker.ts b/server/src/cron/monthly-usage-checker.tsindex 19b03389d..b4b505a64 100644--- a/server/src/cron/monthly-usage-checker.ts+++ b/server/src/cron/monthly-usage-checker.ts@@ -11,7 +11,7 @@ import { DateTime } from "luxon";// Default event limit for users without an active subscriptionconst DEFAULT_EVENT_LIMIT = 0;-const TRIAL_EVENT_LIMIT = 1_000_000;+const TRIAL_EVENT_LIMIT = 100_000;// Global set to track site IDs that have exceeded their monthly limitsexport const sitesOverLimit = new Set<number>();