Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

feat: Disable Sign Up page (#196)

Andrii Zontovb8d8ad76fbf6
diff --git a/client/Dockerfile b/client/Dockerfile
index e8f31805c..c64f3297e 100644
--- a/client/Dockerfile
+++ b/client/Dockerfile
@@ -19,8 +19,10 @@ COPY . .
# Learn more here: https://nextjs.org/telemetry
ENV NEXT_TELEMETRY_DISABLED=1
ARG NEXT_PUBLIC_BACKEND_URL
+ARG NEXT_PUBLIC_DISABLE_SIGNUP
ARG NEXT_PUBLIC_CLOUD
ENV NEXT_PUBLIC_BACKEND_URL=${NEXT_PUBLIC_BACKEND_URL}
+ENV NEXT_PUBLIC_DISABLE_SIGNUP=${NEXT_PUBLIC_DISABLE_SIGNUP}
ENV NEXT_PUBLIC_CLOUD=${NEXT_PUBLIC_CLOUD}
RUN npm run build
diff --git a/client/next.config.js b/client/next.config.js
index 58c2edfed..7f5f90d72 100644
--- a/client/next.config.js
+++ b/client/next.config.js
@@ -3,6 +3,7 @@ const nextConfig = {
output: "standalone",
env: {
NEXT_PUBLIC_BACKEND_URL: process.env.NEXT_PUBLIC_BACKEND_URL,
+ NEXT_PUBLIC_DISABLE_SIGNUP: process.env.NEXT_PUBLIC_DISABLE_SIGNUP,
},
};
diff --git a/client/src/app/login/page.tsx b/client/src/app/login/page.tsx
index ebdfbf7d2..462c4465c 100644
--- a/client/src/app/login/page.tsx
+++ b/client/src/app/login/page.tsx
@@ -13,7 +13,7 @@ import { useState } from "react";
import { Alert, AlertDescription, AlertTitle } from "../../components/ui/alert";
import { useSetPageTitle } from "../../hooks/useSetPageTitle";
import { authClient } from "../../lib/auth";
-import { IS_CLOUD } from "../../lib/const";
+import { DISABLE_SIGNUP, IS_CLOUD } from "../../lib/const";
import { userStore } from "../../lib/userStore";
export default function Page() {
@@ -150,13 +150,15 @@ export default function Page() {
<AlertDescription>{error}</AlertDescription>
</Alert>
)}
-
- <div className="text-center text-sm">
- Don't have an account?{" "}
- <Link href="/signup" className="underline">
- Sign up
- </Link>
- </div>
+
+ {!DISABLE_SIGNUP && (
+ <div className="text-center text-sm">
+ Don't have an account?{" "}
+ <Link href="/signup" className="underline">
+ Sign up
+ </Link>
+ </div>
+ )}
</div>
</form>
</CardContent>
diff --git a/client/src/app/signup/page.tsx b/client/src/app/signup/page.tsx
index a4e127e8a..4622ef315 100644
--- a/client/src/app/signup/page.tsx
+++ b/client/src/app/signup/page.tsx
@@ -1,7 +1,7 @@
"use client";
import { Button } from "@/components/ui/button";
-import { Card } from "@/components/ui/card";
+import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { GithubLogo, GoogleLogo } from "@phosphor-icons/react/dist/ssr";
@@ -17,17 +17,18 @@ import {
Sparkles,
User,
} from "lucide-react";
+import Image from "next/image";
import Link from "next/link";
import { useRouter, useSearchParams } from "next/navigation";
-import { useState, useEffect, Suspense } from "react";
+import { Suspense, useEffect, useState } from "react";
import { addSite } from "../../api/admin/sites";
import { CodeSnippet } from "../../components/CodeSnippet";
+import { Logo } from "../../components/Logo";
import { Alert, AlertDescription, AlertTitle } from "../../components/ui/alert";
+import { useSetPageTitle } from "../../hooks/useSetPageTitle";
import { authClient } from "../../lib/auth";
-import { BACKEND_URL, IS_CLOUD } from "../../lib/const";
+import { DISABLE_SIGNUP, IS_CLOUD } from "../../lib/const";
import { userStore } from "../../lib/userStore";
-import { Logo } from "../../components/Logo";
-import { useSetPageTitle } from "../../hooks/useSetPageTitle";
// Animation variants for step transitions
const contentVariants = {
@@ -492,6 +493,28 @@ export default function SignupPage() {
// Calculate progress percentage
const progressPercentage = ((currentStep - 1) / 3) * 100;
+ if(DISABLE_SIGNUP) {
+ return (
+ <div className="flex justify-center items-center h-screen w-full">
+ <Card className="w-full max-w-sm p-1">
+ <CardHeader>
+ <Image src="/rybbit.png" alt="Rybbit" width={32} height={32} />
+ <CardTitle className="text-2xl flex justify-center">
+ Sign Up Disabled
+ </CardTitle>
+ </CardHeader>
+ <CardContent>
+ <div className="flex flex-col gap-6">
+ <p className="text-center">New account registration is currently disabled. If you have an account, you can
+ {" "}<Link href="/login" className="underline">sign in</Link>.
+ </p>
+ </div>
+ </CardContent>
+ </Card>
+ </div>
+ )
+ }
+
return (
<div className="flex justify-center items-center min-h-screen bg-background p-4 relative overflow-hidden">
{/* Suspense boundary for the URL parameter handler */}
diff --git a/client/src/lib/const.ts b/client/src/lib/const.ts
index fa28ab75f..cccee0b4f 100644
--- a/client/src/lib/const.ts
+++ b/client/src/lib/const.ts
@@ -2,5 +2,6 @@ export const BACKEND_URL =
process.env.NEXT_PUBLIC_BACKEND_URL === "http://localhost:3001"
? "http://localhost:3001"
: `${process.env.NEXT_PUBLIC_BACKEND_URL}/api`;
+export const DISABLE_SIGNUP = process.env.NEXT_PUBLIC_DISABLE_SIGNUP === "true";
export const IS_CLOUD = process.env.NEXT_PUBLIC_CLOUD === "true";
export const IS_DEMO = process.env.NEXT_PUBLIC_DEMO === "true";
diff --git a/docker-compose.cloud.yml b/docker-compose.cloud.yml
index 1b970a8cb..7cd297dab 100644
--- a/docker-compose.cloud.yml
+++ b/docker-compose.cloud.yml
@@ -91,10 +91,12 @@ services:
dockerfile: Dockerfile
args:
NEXT_PUBLIC_BACKEND_URL: ${BASE_URL}
+ NEXT_PUBLIC_DISABLE_SIGNUP: ${DISABLE_SIGNUP}
NEXT_PUBLIC_CLOUD: ${CLOUD}
environment:
- NODE_ENV=production
- NEXT_PUBLIC_BACKEND_URL=${BASE_URL}
+ - NEXT_PUBLIC_DISABLE_SIGNUP=${DISABLE_SIGNUP}
- NEXT_PUBLIC_CLOUD=${CLOUD}
depends_on:
- backend
diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml
index 075076650..e8a09e813 100644
--- a/docker-compose.dev.yml
+++ b/docker-compose.dev.yml
@@ -95,11 +95,13 @@ services:
dockerfile: Dockerfile
args:
NEXT_PUBLIC_BACKEND_URL: ${BASE_URL}
+ NEXT_PUBLIC_DISABLE_SIGNUP: ${DISABLE_SIGNUP}
NEXT_PUBLIC_CLOUD: ${CLOUD}
environment:
- NODE_ENV=production
- NEXT_PUBLIC_DEMO=true
- NEXT_PUBLIC_BACKEND_URL=${BASE_URL}
+ - NEXT_PUBLIC_DISABLE_SIGNUP=${DISABLE_SIGNUP}
- NEXT_PUBLIC_CLOUD=${CLOUD}
depends_on:
- backend
diff --git a/docker-compose.yml b/docker-compose.yml
index 8b44c783a..42007ee71 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -87,11 +87,13 @@ services:
dockerfile: Dockerfile
args:
NEXT_PUBLIC_BACKEND_URL: ${BASE_URL}
+ NEXT_PUBLIC_DISABLE_SIGNUP: ${DISABLE_SIGNUP}
ports:
- "${HOST_CLIENT_PORT}"
environment:
- NODE_ENV=production
- NEXT_PUBLIC_BACKEND_URL=${BASE_URL}
+ - NEXT_PUBLIC_DISABLE_SIGNUP=${DISABLE_SIGNUP}
depends_on:
- backend
restart: unless-stopped
diff --git a/docs/src/content/self-hosting-advanced.mdx b/docs/src/content/self-hosting-advanced.mdx
index 4b67822bf..a9b8236e0 100644
--- a/docs/src/content/self-hosting-advanced.mdx
+++ b/docs/src/content/self-hosting-advanced.mdx
@@ -154,6 +154,7 @@ services:
environment:
- NODE_ENV=production
- NEXT_PUBLIC_BACKEND_URL=${BASE_URL}
+ - NEXT_PUBLIC_DISABLE_SIGNUP=${DISABLE_SIGNUP}
depends_on:
- rybbit_backend
restart: unless-stopped