Add Plausible

This commit is contained in:
Sebastien Castiel
2023-12-11 11:54:24 -05:00
parent 9f7ea9ca50
commit 4f43e8e42a
6 changed files with 23 additions and 1 deletions

View File

@@ -20,6 +20,7 @@ Spliit is a free and open source alternative to Splitwise. I created it back in
- [Next.js](https://nextjs.org/) for the web application
- [TailwindCSS](https://tailwindcss.com/) for the styling
- [shadcn/UI](https://ui.shadcn.com/) for the UI components
- [Prisma](https://prisma.io) to access the database
- [Vercel](https://vercel.com/) for hosting (application and database)
## Contribute

View File

@@ -1,4 +1,5 @@
/** @type {import('next').NextConfig} */
const nextConfig = {}
module.exports = nextConfig
const { withPlausibleProxy } = require('next-plausible')
module.exports = withPlausibleProxy()(nextConfig)

14
package-lock.json generated
View File

@@ -24,6 +24,7 @@
"clsx": "^2.0.0",
"lucide-react": "^0.290.0",
"next": "^14.0.4",
"next-plausible": "^3.12.0",
"next-themes": "^0.2.1",
"next13-progressbar": "^1.1.1",
"pg": "^8.11.3",
@@ -4242,6 +4243,19 @@
}
}
},
"node_modules/next-plausible": {
"version": "3.12.0",
"resolved": "https://registry.npmjs.org/next-plausible/-/next-plausible-3.12.0.tgz",
"integrity": "sha512-SSkEqKQ6PgR8fx3sYfIAT69k2xuCUXO5ngkSS19CjxY97lAoZxsfZpYednxB4zo0mHYv87JzhPynrdBPlCBVHg==",
"funding": {
"url": "https://github.com/4lejandrito/next-plausible?sponsor=1"
},
"peerDependencies": {
"next": "^11.1.0 || ^12.0.0 || ^13.0.0 || ^14.0.0",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
}
},
"node_modules/next-themes": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/next-themes/-/next-themes-0.2.1.tgz",

View File

@@ -25,6 +25,7 @@
"clsx": "^2.0.0",
"lucide-react": "^0.290.0",
"next": "^14.0.4",
"next-plausible": "^3.12.0",
"next-themes": "^0.2.1",
"next13-progressbar": "^1.1.1",
"pg": "^8.11.3",

View File

@@ -4,6 +4,7 @@ import { ThemeToggle } from '@/components/theme-toggle'
import { Button } from '@/components/ui/button'
import { env } from '@/lib/env'
import type { Metadata, Viewport } from 'next'
import PlausibleProvider from 'next-plausible'
import Image from 'next/image'
import Link from 'next/link'
import './globals.css'
@@ -63,6 +64,9 @@ export default function RootLayout({
}) {
return (
<html lang="en" suppressHydrationWarning>
{env.PLAUSIBLE_DOMAIN && (
<PlausibleProvider domain={env.PLAUSIBLE_DOMAIN} trackOutboundLinks />
)}
<body className="pt-16 min-h-[100dvh] flex flex-col items-stretch">
<ThemeProvider
attribute="class"

View File

@@ -4,6 +4,7 @@ const envSchema = z.object({
NEXT_PUBLIC_BASE_URL: z.string().url(),
POSTGRES_URL_NON_POOLING: z.string().url(),
POSTGRES_PRISMA_URL: z.string().url(),
PLAUSIBLE_DOMAIN: z.string().optional(),
})
export const env = envSchema.parse(process.env)