Skip to content

Create professional demos and 3D mockups in seconds, directly in your browser

feat: add Supabase integration with session management and environment variable handling

CristianOlivera1fd3787615e05
diff --git a/app/config/env.ts b/app/config/env.ts
index a21852b..7450e00 100644
--- a/app/config/env.ts
+++ b/app/config/env.ts
@@ -3,4 +3,14 @@ export const env = {
accessKey: process.env.NEXT_PUBLIC_UNSPLASH_ACCESS_KEY ?? "",
secretKey: process.env.NEXT_PUBLIC_UNSPLASH_SECRET_KEY ?? "",
},
+ pexels: {
+ apiKey: process.env.NEXT_PUBLIC_PEXELS_API_KEY ?? "",
+ },
+ pixabay: {
+ apiKey: process.env.NEXT_PUBLIC_PIXABAY_API_KEY ?? "",
+ },
+ supabase: {
+ url: process.env.NEXT_PUBLIC_SUPABASE_URL ?? "",
+ publishableKey: process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_DEFAULT_KEY ?? "",
+ },
} as const;
\ No newline at end of file
diff --git a/app/layout.tsx b/app/layout.tsx
index daf8dde..3fddaf9 100644
--- a/app/layout.tsx
+++ b/app/layout.tsx
@@ -1,5 +1,6 @@
import type { Metadata } from "next";
import { Inter, Roboto, Poppins, Montserrat, DM_Sans } from "next/font/google";
+import { TooltipProvider } from "@/components/ui/tooltip"
import "./globals.css";
const inter = Inter({
@@ -37,11 +38,73 @@ const dmSans = DM_Sans({
});
export const metadata: Metadata = {
- title: "openvid - Crea tomas cinemáticas",
- description: "Genera tomas cinematográficas con facilidad",
+ title: "openvid - Crea demos profesionales",
+ description: "Crea demos cinemáticas y edita videos en segundos. Añade zooms suaves, mockups, personaliza fondos y exporta demos profesionales.",
+ applicationName: "openvid",
+ keywords: [
+ "openvid",
+ "edición de video",
+ "zoom video",
+ "grabación de pantalla",
+ "creador de demos",
+ "tomas cinemáticas",
+ "mockups",
+ "Cristian Olivera",
+ ],
+ authors: [{ name: "Cristian Olivera" }],
+ robots: {
+ index: true,
+ follow: true,
+ googleBot: {
+ index: true,
+ follow: true,
+ },
+ },
+ alternates: {
+ canonical: "https://openvid.dev/",
+ },
icons: {
- icon: "data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><circle cx='16' cy='16' r='14' fill='%230E0E12' stroke='%233B82F6' stroke-width='2'/><circle cx='16' cy='16' r='6' fill='%233B82F6'/></svg>",
+ icon: "/images/metadata/favicon.svg", //32 x 32 px.
+ shortcut: "/images/metadata/shortcut.svg", //16 x 16 px.
+ apple: "/images/metadata/apple.svg", //180 x 180 px
+ },
+ openGraph: {
+ type: "website",
+ url: "https://openvid.dev/",
+ title: "openvid - Crea demos profesionales y edita en segundos",
+ description:
+ "Añade zooms suaves, mockups, personaliza fondos y exporta demos profesionales sin editores complejos.",
+ images: [
+ {
+ url: "https://openvid.dev/images/metadata/preview-openvid.jpg",
+ width: 1200,
+ height: 630,
+ alt: "openvid - Creador de demos, Graba Pantalla y Editor de Video",
+ },
+ ],
+ locale: "es_ES",
+ siteName: "openvid",
+ },
+ twitter: { // 1200 x 630 px
+ card: "summary_large_image",
+ title: "openvid - Crea demos profesionales y edita en segundos",
+ description:
+ "Añade zooms suaves, mockups, personaliza fondos y exporta demos profesionales sin editores complejos.",
+ images: ["https://openvid.dev/images/metadata/preview-openvid.jpg"],
},
+ other: {
+ "msapplication-TileColor": "#1f2937",
+ "format-detection": "telephone=no",
+ "mobile-web-app-capable": "yes",
+ "apple-mobile-web-app-capable": "yes",
+ "apple-mobile-web-app-status-bar-style": "black-translucent",
+ },
+};
+
+export const viewport = {
+ width: "device-width",
+ initialScale: 1,
+ themeColor: "#050505",
};
export default function RootLayout({
@@ -50,9 +113,11 @@ export default function RootLayout({
children: React.ReactNode;
}) {
return (
- <html lang="en">
+ <html lang="es">
<body className={`${inter.variable} ${roboto.variable} ${poppins.variable} ${montserrat.variable} ${dmSans.variable} ${inter.className} antialiased dark`}>
- {children}
+ <TooltipProvider delayDuration={200}>
+ {children}
+ </TooltipProvider>
</body>
</html>
);
diff --git a/proxy.ts b/proxy.ts
new file mode 100644
index 0000000..16d8f0a
--- /dev/null
+++ b/proxy.ts
@@ -0,0 +1,20 @@
+import { updateSession } from "@/utils/supabase/middleware";
+import { type NextRequest } from "next/server";
+
+export async function proxy(request: NextRequest) {
+ return await updateSession(request);
+}
+
+export const config = {
+ matcher: [
+ /*
+ * Match all request paths except for the ones starting with:
+ * - _next/static (static files)
+ * - _next/image (image optimization files)
+ * - favicon.ico (favicon file)
+ * - public folder
+ * - api routes that don't need auth
+ */
+ "/((?!_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)",
+ ],
+};
diff --git a/utils/supabase/client.ts b/utils/supabase/client.ts
new file mode 100644
index 0000000..1c3f562
--- /dev/null
+++ b/utils/supabase/client.ts
@@ -0,0 +1,11 @@
+import { createBrowserClient } from "@supabase/ssr";
+
+const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
+const supabaseKey = process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_DEFAULT_KEY;
+
+if (!supabaseUrl || !supabaseKey) {
+ throw new Error("Missing Supabase environment variables");
+}
+
+export const createClient = () =>
+ createBrowserClient(supabaseUrl, supabaseKey);
diff --git a/utils/supabase/middleware.ts b/utils/supabase/middleware.ts
new file mode 100644
index 0000000..8b7d3b1
--- /dev/null
+++ b/utils/supabase/middleware.ts
@@ -0,0 +1,51 @@
+import { createServerClient } from "@supabase/ssr";
+import { type NextRequest, NextResponse } from "next/server";
+
+const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
+const supabaseKey = process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_DEFAULT_KEY;
+
+if (!supabaseUrl || !supabaseKey) {
+ throw new Error("Missing Supabase environment variables");
+}
+
+export const updateSession = async (request: NextRequest) => {
+ let supabaseResponse = NextResponse.next({
+ request,
+ });
+
+ const supabase = createServerClient(supabaseUrl, supabaseKey, {
+ cookies: {
+ getAll() {
+ return request.cookies.getAll();
+ },
+ setAll(cookiesToSet) {
+ cookiesToSet.forEach(({ name, value }) => request.cookies.set(name, value));
+ supabaseResponse = NextResponse.next({
+ request,
+ });
+ cookiesToSet.forEach(({ name, value, options }) =>
+ supabaseResponse.cookies.set(name, value, options)
+ );
+ },
+ },
+ });
+
+ const {
+ data: { user },
+ } = await supabase.auth.getUser();
+
+ // if (!user && request.nextUrl.pathname.startsWith("/editor")) {
+ // const url = request.nextUrl.clone();
+ // url.pathname = "/login";
+ // url.searchParams.set("redirectedFrom", request.nextUrl.pathname);
+ // return NextResponse.redirect(url);
+ // }
+
+ if (user && request.nextUrl.pathname.startsWith("/login")) {
+ const url = request.nextUrl.clone();
+ url.pathname = "/";
+ return NextResponse.redirect(url);
+ }
+
+ return supabaseResponse;
+};
diff --git a/utils/supabase/server.ts b/utils/supabase/server.ts
new file mode 100644
index 0000000..755c663
--- /dev/null
+++ b/utils/supabase/server.ts
@@ -0,0 +1,30 @@
+import { createServerClient } from "@supabase/ssr";
+import { cookies } from "next/headers";
+
+const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
+const supabaseKey = process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_DEFAULT_KEY;
+
+if (!supabaseUrl || !supabaseKey) {
+ throw new Error("Missing Supabase environment variables");
+}
+
+export const createClient = async () => {
+ const cookieStore = await cookies();
+
+ return createServerClient(supabaseUrl, supabaseKey, {
+ cookies: {
+ getAll() {
+ return cookieStore.getAll();
+ },
+ setAll(cookiesToSet) {
+ try {
+ cookiesToSet.forEach(({ name, value, options }) =>
+ cookieStore.set(name, value, options)
+ );
+ } catch {
+
+ }
+ },
+ },
+ });
+};