🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Wip
Bill Yang91cf7a3b3544
diff --git a/client/Dockerfile b/client/Dockerfileindex 22730a433..6ae5fffcc 100644--- a/client/Dockerfile+++ b/client/Dockerfile@@ -45,9 +45,9 @@ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/staticUSER nextjs-EXPOSE 4000+EXPOSE 3002-ENV PORT 4000+ENV PORT 3002ENV HOSTNAME "0.0.0.0"CMD ["node", "server.js"]\ No newline at end of filediff --git a/client/components.json b/client/components.jsonnew file mode 100644index 000000000..ff7f7e746--- /dev/null+++ b/client/components.json@@ -0,0 +1,21 @@+{+ "$schema": "https://ui.shadcn.com/schema.json",+ "style": "new-york",+ "rsc": true,+ "tsx": true,+ "tailwind": {+ "config": "tailwind.config.ts",+ "css": "src/app/globals.css",+ "baseColor": "neutral",+ "cssVariables": false,+ "prefix": ""+ },+ "aliases": {+ "components": "@/components",+ "utils": "@/lib/utils",+ "ui": "@/components/ui",+ "lib": "@/lib",+ "hooks": "@/hooks"+ },+ "iconLibrary": "lucide"+}\ No newline at end of filediff --git a/client/package-lock.json b/client/package-lock.jsonindex 6d35e1853..6f590b57c 100644--- a/client/package-lock.json+++ b/client/package-lock.json@@ -8,9 +8,22 @@"name": "client","version": "0.1.0","dependencies": {+ "@clickhouse/client": "^1.10.1",+ "@nivo/bar": "^0.88.0",+ "@nivo/core": "^0.88.0",+ "@nivo/line": "^0.88.0",+ "@radix-ui/react-slot": "^1.1.1",+ "@tanstack/react-query": "^5.64.2",+ "@tanstack/react-query-devtools": "^5.64.2",+ "class-variance-authority": "^0.7.1",+ "clsx": "^2.1.1",+ "lucide-react": "^0.474.0","next": "15.1.6",+ "next-themes": "^0.4.4","react": "^19.0.0",- "react-dom": "^19.0.0"+ "react-dom": "^19.0.0",+ "tailwind-merge": "^2.6.0",+ "tailwindcss-animate": "^1.0.7"},"devDependencies": {"@types/node": "^20",@@ -33,6 +46,22 @@"url": "https://github.com/sponsors/sindresorhus"}},+ "node_modules/@clickhouse/client": {+ "version": "1.10.1",+ "resolved": "https://registry.npmjs.org/@clickhouse/client/-/client-1.10.1.tgz",+ "integrity": "sha512-Ot/6l4hFALK6NtZDS2UegukfRXWkkftWHCnzKUwanpOQ3Jd+RVKx5dxQreeBG5XcRjt1xyf5904PFjbCnaulXg==",+ "dependencies": {+ "@clickhouse/client-common": "1.10.1"+ },+ "engines": {+ "node": ">=16"+ }+ },+ "node_modules/@clickhouse/client-common": {+ "version": "1.10.1",+ "resolved": "https://registry.npmjs.org/@clickhouse/client-common/-/client-common-1.10.1.tgz",+ "integrity": "sha512-Duh3cign2ChvXABpjVj9Hkz5y20Zf48OE0Y50S4qBVPdhI81S4Rh4MI/bEwvwMnzHubSkiEQ+VhC5HzV8ybnpg=="+ },"node_modules/@emnapi/runtime": {"version": "1.3.1","resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.3.1.tgz",@@ -574,6 +603,187 @@"node": ">= 10"}},+ "node_modules/@nivo/annotations": {+ "version": "0.88.0",+ "resolved": "https://registry.npmjs.org/@nivo/annotations/-/annotations-0.88.0.tgz",+ "integrity": "sha512-NXE+1oIUn+EGWMQpnpeRMLgi2wyuzhGDoJQY4OUHissCUiNotid2oNQ/PXJwN0toiu+/j9SyhzI32xr70OPi7Q==",+ "dependencies": {+ "@nivo/colors": "0.88.0",+ "@nivo/core": "0.88.0",+ "@react-spring/web": "9.4.5 || ^9.7.2",+ "lodash": "^4.17.21"+ },+ "peerDependencies": {+ "react": ">= 16.14.0 < 19.0.0"+ }+ },+ "node_modules/@nivo/axes": {+ "version": "0.88.0",+ "resolved": "https://registry.npmjs.org/@nivo/axes/-/axes-0.88.0.tgz",+ "integrity": "sha512-jF7aIxzTNayV5cI1J/b9Q1FfpMBxTXGk3OwSigXMSfYWlliskDn2u0qGRLiYhuXFdQAWIp4oXsO1GcAQ0eRVdg==",+ "dependencies": {+ "@nivo/core": "0.88.0",+ "@nivo/scales": "0.88.0",+ "@react-spring/web": "9.4.5 || ^9.7.2",+ "@types/d3-format": "^1.4.1",+ "@types/d3-time-format": "^2.3.1",+ "d3-format": "^1.4.4",+ "d3-time-format": "^3.0.0"+ },+ "peerDependencies": {+ "react": ">= 16.14.0 < 19.0.0"+ }+ },+ "node_modules/@nivo/bar": {+ "version": "0.88.0",+ "resolved": "https://registry.npmjs.org/@nivo/bar/-/bar-0.88.0.tgz",+ "integrity": "sha512-wckwuHWeCikxGvvdRfGL+dVFsUD9uHk1r9s7bWUfOD+p8BWhxtYqfXpHolEfgGg3UyPaHtpGA7P4zgE5vgo7gQ==",+ "dependencies": {+ "@nivo/annotations": "0.88.0",+ "@nivo/axes": "0.88.0",+ "@nivo/colors": "0.88.0",+ "@nivo/core": "0.88.0",+ "@nivo/legends": "0.88.0",+ "@nivo/scales": "0.88.0",+ "@nivo/tooltip": "0.88.0",+ "@react-spring/web": "9.4.5 || ^9.7.2",+ "@types/d3-scale": "^4.0.8",+ "@types/d3-shape": "^3.1.6",+ "d3-scale": "^4.0.2",+ "d3-shape": "^3.2.0",+ "lodash": "^4.17.21"+ },+ "peerDependencies": {+ "react": ">= 16.14.0 < 19.0.0"+ }+ },+ "node_modules/@nivo/colors": {+ "version": "0.88.0",+ "resolved": "https://registry.npmjs.org/@nivo/colors/-/colors-0.88.0.tgz",+ "integrity": "sha512-IZ+leYIqAlo7dyLHmsQwujanfRgXyoQ5H7PU3RWLEn1PP0zxDKLgEjFEDADpDauuslh2Tx0L81GNkWR6QSP0Mw==",+ "dependencies": {+ "@nivo/core": "0.88.0",+ "@types/d3-color": "^3.0.0",+ "@types/d3-scale": "^4.0.8",+ "@types/d3-scale-chromatic": "^3.0.0",+ "@types/prop-types": "^15.7.2",+ "d3-color": "^3.1.0",+ "d3-scale": "^4.0.2",+ "d3-scale-chromatic": "^3.0.0",+ "lodash": "^4.17.21",+ "prop-types": "^15.7.2"+ },+ "peerDependencies": {+ "react": ">= 16.14.0 < 19.0.0"+ }+ },+ "node_modules/@nivo/core": {+ "version": "0.88.0",+ "resolved": "https://registry.npmjs.org/@nivo/core/-/core-0.88.0.tgz",+ "integrity": "sha512-XjUkA5MmwjLP38bdrJwn36Gj7T5SYMKD55LYQp/1nIJPdxqJ38dUfE4XyBDfIEgfP6yrHOihw3C63cUdnUBoiw==",+ "dependencies": {+ "@nivo/tooltip": "0.88.0",+ "@react-spring/web": "9.4.5 || ^9.7.2",+ "@types/d3-shape": "^3.1.6",+ "d3-color": "^3.1.0",+ "d3-format": "^1.4.4",+ "d3-interpolate": "^3.0.1",+ "d3-scale": "^4.0.2",+ "d3-scale-chromatic": "^3.0.0",+ "d3-shape": "^3.2.0",+ "d3-time-format": "^3.0.0",+ "lodash": "^4.17.21",+ "prop-types": "^15.7.2"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/nivo/donate"+ },+ "peerDependencies": {+ "react": ">= 16.14.0 < 19.0.0"+ }+ },+ "node_modules/@nivo/legends": {+ "version": "0.88.0",+ "resolved": "https://registry.npmjs.org/@nivo/legends/-/legends-0.88.0.tgz",+ "integrity": "sha512-d4DF9pHbD8LmGJlp/Gp1cF4e8y2wfQTcw3jVhbZj9zkb7ZWB7JfeF60VHRfbXNux9bjQ9U78/SssQqueVDPEmg==",+ "dependencies": {+ "@nivo/colors": "0.88.0",+ "@nivo/core": "0.88.0",+ "@types/d3-scale": "^4.0.8",+ "d3-scale": "^4.0.2"+ },+ "peerDependencies": {+ "react": ">= 16.14.0 < 19.0.0"+ }+ },+ "node_modules/@nivo/line": {+ "version": "0.88.0",+ "resolved": "https://registry.npmjs.org/@nivo/line/-/line-0.88.0.tgz",+ "integrity": "sha512-hFTyZ3BdAZvq2HwdwMj2SJGUeodjEW+7DLtFMIIoVIxmjZlAs3z533HcJ9cJd3it928fDm8SF/rgHs0TztYf9Q==",+ "dependencies": {+ "@nivo/annotations": "0.88.0",+ "@nivo/axes": "0.88.0",+ "@nivo/colors": "0.88.0",+ "@nivo/core": "0.88.0",+ "@nivo/legends": "0.88.0",+ "@nivo/scales": "0.88.0",+ "@nivo/tooltip": "0.88.0",+ "@nivo/voronoi": "0.88.0",+ "@react-spring/web": "9.4.5 || ^9.7.2",+ "d3-shape": "^3.2.0"+ },+ "peerDependencies": {+ "react": ">= 16.14.0 < 19.0.0"+ }+ },+ "node_modules/@nivo/scales": {+ "version": "0.88.0",+ "resolved": "https://registry.npmjs.org/@nivo/scales/-/scales-0.88.0.tgz",+ "integrity": "sha512-HbpxkQp6tHCltZ1yDGeqdLcaJl5ze54NPjurfGtx/Uq+H5IQoBd4Tln49bUar5CsFAMsXw8yF1HQvASr7I1SIA==",+ "dependencies": {+ "@types/d3-scale": "^4.0.8",+ "@types/d3-time": "^1.1.1",+ "@types/d3-time-format": "^3.0.0",+ "d3-scale": "^4.0.2",+ "d3-time": "^1.0.11",+ "d3-time-format": "^3.0.0",+ "lodash": "^4.17.21"+ }+ },+ "node_modules/@nivo/scales/node_modules/@types/d3-time-format": {+ "version": "3.0.4",+ "resolved": "https://registry.npmjs.org/@types/d3-time-format/-/d3-time-format-3.0.4.tgz",+ "integrity": "sha512-or9DiDnYI1h38J9hxKEsw513+KVuFbEVhl7qdxcaudoiqWWepapUen+2vAriFGexr6W5+P4l9+HJrB39GG+oRg=="+ },+ "node_modules/@nivo/tooltip": {+ "version": "0.88.0",+ "resolved": "https://registry.npmjs.org/@nivo/tooltip/-/tooltip-0.88.0.tgz",+ "integrity": "sha512-iEjVfQA8gumAzg/yUinjTwswygCkE5Iwuo8opwnrbpNIqMrleBV+EAKIgB0PrzepIoW8CFG/SJhoiRfbU8jhOw==",+ "dependencies": {+ "@nivo/core": "0.88.0",+ "@react-spring/web": "9.4.5 || ^9.7.2"+ },+ "peerDependencies": {+ "react": ">= 16.14.0 < 19.0.0"+ }+ },+ "node_modules/@nivo/voronoi": {+ "version": "0.88.0",+ "resolved": "https://registry.npmjs.org/@nivo/voronoi/-/voronoi-0.88.0.tgz",+ "integrity": "sha512-MyiNLvODthFoMjQ7Wjp693nogbTmVEx8Yn/7QkJhyPQbFyyA37TF/D1a/ox4h2OslXtP6K9QFN+42gB/zu7ixw==",+ "dependencies": {+ "@nivo/core": "0.88.0",+ "@nivo/tooltip": "0.88.0",+ "@types/d3-delaunay": "^6.0.4",+ "@types/d3-scale": "^4.0.8",+ "d3-delaunay": "^6.0.4",+ "d3-scale": "^4.0.2"+ },+ "peerDependencies": {+ "react": ">= 16.14.0 < 19.0.0"+ }+ },"node_modules/@nodelib/fs.scandir": {"version": "2.1.5","resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",@@ -619,6 +829,103 @@"node": ">=14"}},+ "node_modules/@radix-ui/react-compose-refs": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.1.tgz",+ "integrity": "sha512-Y9VzoRDSJtgFMUCoiZBDVo084VQ5hfpXxVE+NgkdNsjiDBByiImMZKKhxMwCbdHvhlENG6a833CbFkOQvTricw==",+ "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-slot": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.1.tgz",+ "integrity": "sha512-RApLLOcINYJA+dMVbOju7MYv1Mb2EBp2nH4HdDzXTSyaR5optlm6Otrz1euW3HbdOR8UmmFK06TD+A9frYWv+g==",+ "dependencies": {+ "@radix-ui/react-compose-refs": "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-spring/animated": {+ "version": "9.7.5",+ "resolved": "https://registry.npmjs.org/@react-spring/animated/-/animated-9.7.5.tgz",+ "integrity": "sha512-Tqrwz7pIlsSDITzxoLS3n/v/YCUHQdOIKtOJf4yL6kYVSDTSmVK1LI1Q3M/uu2Sx4X3pIWF3xLUhlsA6SPNTNg==",+ "dependencies": {+ "@react-spring/shared": "~9.7.5",+ "@react-spring/types": "~9.7.5"+ },+ "peerDependencies": {+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0"+ }+ },+ "node_modules/@react-spring/core": {+ "version": "9.7.5",+ "resolved": "https://registry.npmjs.org/@react-spring/core/-/core-9.7.5.tgz",+ "integrity": "sha512-rmEqcxRcu7dWh7MnCcMXLvrf6/SDlSokLaLTxiPlAYi11nN3B5oiCUAblO72o+9z/87j2uzxa2Inm8UbLjXA+w==",+ "dependencies": {+ "@react-spring/animated": "~9.7.5",+ "@react-spring/shared": "~9.7.5",+ "@react-spring/types": "~9.7.5"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/react-spring/donate"+ },+ "peerDependencies": {+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0"+ }+ },+ "node_modules/@react-spring/rafz": {+ "version": "9.7.5",+ "resolved": "https://registry.npmjs.org/@react-spring/rafz/-/rafz-9.7.5.tgz",+ "integrity": "sha512-5ZenDQMC48wjUzPAm1EtwQ5Ot3bLIAwwqP2w2owG5KoNdNHpEJV263nGhCeKKmuA3vG2zLLOdu3or6kuDjA6Aw=="+ },+ "node_modules/@react-spring/shared": {+ "version": "9.7.5",+ "resolved": "https://registry.npmjs.org/@react-spring/shared/-/shared-9.7.5.tgz",+ "integrity": "sha512-wdtoJrhUeeyD/PP/zo+np2s1Z820Ohr/BbuVYv+3dVLW7WctoiN7std8rISoYoHpUXtbkpesSKuPIw/6U1w1Pw==",+ "dependencies": {+ "@react-spring/rafz": "~9.7.5",+ "@react-spring/types": "~9.7.5"+ },+ "peerDependencies": {+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0"+ }+ },+ "node_modules/@react-spring/types": {+ "version": "9.7.5",+ "resolved": "https://registry.npmjs.org/@react-spring/types/-/types-9.7.5.tgz",+ "integrity": "sha512-HVj7LrZ4ReHWBimBvu2SKND3cDVUPWKLqRTmWe/fNY6o1owGOX0cAHbdPDTMelgBlVbrTKrre6lFkhqGZErK/g=="+ },+ "node_modules/@react-spring/web": {+ "version": "9.7.5",+ "resolved": "https://registry.npmjs.org/@react-spring/web/-/web-9.7.5.tgz",+ "integrity": "sha512-lmvqGwpe+CSttsWNZVr+Dg62adtKhauGwLyGE/RRyZ8AAMLgb9x3NDMA5RMElXo+IMyTkPp7nxTB8ZQlmhb6JQ==",+ "dependencies": {+ "@react-spring/animated": "~9.7.5",+ "@react-spring/core": "~9.7.5",+ "@react-spring/shared": "~9.7.5",+ "@react-spring/types": "~9.7.5"+ },+ "peerDependencies": {+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0",+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"+ }+ },"node_modules/@swc/counter": {"version": "0.1.3","resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz",@@ -632,6 +939,106 @@"tslib": "^2.8.0"}},+ "node_modules/@tanstack/query-core": {+ "version": "5.64.2",+ "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.64.2.tgz",+ "integrity": "sha512-hdO8SZpWXoADNTWXV9We8CwTkXU88OVWRBcsiFrk7xJQnhm6WRlweDzMD+uH+GnuieTBVSML6xFa17C2cNV8+g==",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/tannerlinsley"+ }+ },+ "node_modules/@tanstack/query-devtools": {+ "version": "5.64.2",+ "resolved": "https://registry.npmjs.org/@tanstack/query-devtools/-/query-devtools-5.64.2.tgz",+ "integrity": "sha512-3DautR5UpVZdk/qNIhioZVF7g8fdQZ1U98sBEEk4Tzz3tihSBNMPgwlP40nzgbPEDBIrn/j/oyyvNBVSo083Vw==",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/tannerlinsley"+ }+ },+ "node_modules/@tanstack/react-query": {+ "version": "5.64.2",+ "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.64.2.tgz",+ "integrity": "sha512-3pakNscZNm8KJkxmovvtZ4RaXLyiYYobwleTMvpIGUoKRa8j8VlrQKNl5W8VUEfVfZKkikvXVddLuWMbcSCA1Q==",+ "dependencies": {+ "@tanstack/query-core": "5.64.2"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/tannerlinsley"+ },+ "peerDependencies": {+ "react": "^18 || ^19"+ }+ },+ "node_modules/@tanstack/react-query-devtools": {+ "version": "5.64.2",+ "resolved": "https://registry.npmjs.org/@tanstack/react-query-devtools/-/react-query-devtools-5.64.2.tgz",+ "integrity": "sha512-+ZjJVnPzc8BUV/Eklu2k9T/IAyAyvwoCHqOaOrk2sbU33LFhM52BpX4eyENXn0bx5LwV3DJZgEQlIzucoemfGQ==",+ "dependencies": {+ "@tanstack/query-devtools": "5.64.2"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/tannerlinsley"+ },+ "peerDependencies": {+ "@tanstack/react-query": "^5.64.2",+ "react": "^18 || ^19"+ }+ },+ "node_modules/@types/d3-color": {+ "version": "3.1.3",+ "resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.1.3.tgz",+ "integrity": "sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A=="+ },+ "node_modules/@types/d3-delaunay": {+ "version": "6.0.4",+ "resolved": "https://registry.npmjs.org/@types/d3-delaunay/-/d3-delaunay-6.0.4.tgz",+ "integrity": "sha512-ZMaSKu4THYCU6sV64Lhg6qjf1orxBthaC161plr5KuPHo3CNm8DTHiLw/5Eq2b6TsNP0W0iJrUOFscY6Q450Hw=="+ },+ "node_modules/@types/d3-format": {+ "version": "1.4.5",+ "resolved": "https://registry.npmjs.org/@types/d3-format/-/d3-format-1.4.5.tgz",+ "integrity": "sha512-mLxrC1MSWupOSncXN/HOlWUAAIffAEBaI4+PKy2uMPsKe4FNZlk7qrbTjmzJXITQQqBHivaks4Td18azgqnotA=="+ },+ "node_modules/@types/d3-path": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.1.0.tgz",+ "integrity": "sha512-P2dlU/q51fkOc/Gfl3Ul9kicV7l+ra934qBFXCFhrZMOL6du1TM0pm1ThYvENukyOn5h9v+yMJ9Fn5JK4QozrQ=="+ },+ "node_modules/@types/d3-scale": {+ "version": "4.0.8",+ "resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.8.tgz",+ "integrity": "sha512-gkK1VVTr5iNiYJ7vWDI+yUFFlszhNMtVeneJ6lUTKPjprsvLLI9/tgEGiXJOnlINJA8FyA88gfnQsHbybVZrYQ==",+ "dependencies": {+ "@types/d3-time": "*"+ }+ },+ "node_modules/@types/d3-scale-chromatic": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/@types/d3-scale-chromatic/-/d3-scale-chromatic-3.1.0.tgz",+ "integrity": "sha512-iWMJgwkK7yTRmWqRB5plb1kadXyQ5Sj8V/zYlFGMUBbIPKQScw+Dku9cAAMgJG+z5GYDoMjWGLVOvjghDEFnKQ=="+ },+ "node_modules/@types/d3-shape": {+ "version": "3.1.7",+ "resolved": "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-3.1.7.tgz",+ "integrity": "sha512-VLvUQ33C+3J+8p+Daf+nYSOsjB4GXp19/S/aGo60m9h1v6XaxjiT82lKVWJCfzhtuZ3yD7i/TPeC/fuKLLOSmg==",+ "dependencies": {+ "@types/d3-path": "*"+ }+ },+ "node_modules/@types/d3-time": {+ "version": "1.1.4",+ "resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-1.1.4.tgz",+ "integrity": "sha512-JIvy2HjRInE+TXOmIGN5LCmeO0hkFZx5f9FZ7kiN+D+YTcc8pptsiLiuHsvwxwC7VVKmJ2ExHUgNlAiV7vQM9g=="+ },+ "node_modules/@types/d3-time-format": {+ "version": "2.3.4",+ "resolved": "https://registry.npmjs.org/@types/d3-time-format/-/d3-time-format-2.3.4.tgz",+ "integrity": "sha512-xdDXbpVO74EvadI3UDxjxTdR6QIxm1FKzEA/+F8tL4GWWUg/hgvBqf6chql64U5A9ZUGWo7pEu4eNlyLwbKdhg=="+ },"node_modules/@types/node": {"version": "20.17.16","resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.16.tgz",@@ -641,6 +1048,11 @@"undici-types": "~6.19.2"}},+ "node_modules/@types/prop-types": {+ "version": "15.7.14",+ "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.14.tgz",+ "integrity": "sha512-gNMvNH49DJ7OJYv+KAKn0Xp45p8PLl6zo2YnvDIbTd4J6MER2BmWN49TG7n9LvkyihINxeKW8+3bfS2yDC9dzQ=="+ },"node_modules/@types/react": {"version": "19.0.8","resolved": "https://registry.npmjs.org/@types/react/-/react-19.0.8.tgz",@@ -822,11 +1234,30 @@"node": ">= 6"}},+ "node_modules/class-variance-authority": {+ "version": "0.7.1",+ "resolved": "https://registry.npmjs.org/class-variance-authority/-/class-variance-authority-0.7.1.tgz",+ "integrity": "sha512-Ka+9Trutv7G8M6WT6SeiRWz792K5qEqIGEGzXKhAE6xOWAY6pPH8U+9IY3oCMv6kqTmLsv7Xh/2w2RigkePMsg==",+ "dependencies": {+ "clsx": "^2.1.1"+ },+ "funding": {+ "url": "https://polar.sh/cva"+ }+ },"node_modules/client-only": {"version": "0.0.1","resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz","integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA=="},+ "node_modules/clsx": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",+ "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==",+ "engines": {+ "node": ">=6"+ }+ },"node_modules/color": {"version": "4.2.3","resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz",@@ -909,6 +1340,130 @@"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==","dev": true},+ "node_modules/d3-array": {+ "version": "3.2.4",+ "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz",+ "integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==",+ "dependencies": {+ "internmap": "1 - 2"+ },+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/d3-color": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz",+ "integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==",+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/d3-delaunay": {+ "version": "6.0.4",+ "resolved": "https://registry.npmjs.org/d3-delaunay/-/d3-delaunay-6.0.4.tgz",+ "integrity": "sha512-mdjtIZ1XLAM8bm/hx3WwjfHt6Sggek7qH043O8KEjDXN40xi3vx/6pYSVTwLjEgiXQTbvaouWKynLBiUZ6SK6A==",+ "dependencies": {+ "delaunator": "5"+ },+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/d3-format": {+ "version": "1.4.5",+ "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-1.4.5.tgz",+ "integrity": "sha512-J0piedu6Z8iB6TbIGfZgDzfXxUFN3qQRMofy2oPdXzQibYGqPB/9iMcxr/TGalU+2RsyDO+U4f33id8tbnSRMQ=="+ },+ "node_modules/d3-interpolate": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz",+ "integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==",+ "dependencies": {+ "d3-color": "1 - 3"+ },+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/d3-path": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz",+ "integrity": "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==",+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/d3-scale": {+ "version": "4.0.2",+ "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz",+ "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==",+ "dependencies": {+ "d3-array": "2.10.0 - 3",+ "d3-format": "1 - 3",+ "d3-interpolate": "1.2.0 - 3",+ "d3-time": "2.1.1 - 3",+ "d3-time-format": "2 - 4"+ },+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/d3-scale-chromatic": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/d3-scale-chromatic/-/d3-scale-chromatic-3.1.0.tgz",+ "integrity": "sha512-A3s5PWiZ9YCXFye1o246KoscMWqf8BsD9eRiJ3He7C9OBaxKhAd5TFCdEx/7VbKtxxTsu//1mMJFrEt572cEyQ==",+ "dependencies": {+ "d3-color": "1 - 3",+ "d3-interpolate": "1 - 3"+ },+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/d3-scale/node_modules/d3-time": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz",+ "integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==",+ "dependencies": {+ "d3-array": "2 - 3"+ },+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/d3-shape": {+ "version": "3.2.0",+ "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz",+ "integrity": "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==",+ "dependencies": {+ "d3-path": "^3.1.0"+ },+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/d3-time": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-1.1.0.tgz",+ "integrity": "sha512-Xh0isrZ5rPYYdqhAVk8VLnMEidhz5aP7htAADH6MfzgmmicPkTo8LhkLxci61/lCB7n7UmE3bN0leRt+qvkLxA=="+ },+ "node_modules/d3-time-format": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-3.0.0.tgz",+ "integrity": "sha512-UXJh6EKsHBTjopVqZBhFysQcoXSv/5yLONZvkQ5Kk3qbwiUYkdX17Xa1PT6U1ZWXGGfB1ey5L8dKMlFq2DO0Ag==",+ "dependencies": {+ "d3-time": "1 - 2"+ }+ },+ "node_modules/delaunator": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/delaunator/-/delaunator-5.0.1.tgz",+ "integrity": "sha512-8nvh+XBe96aCESrGOqMp/84b13H9cdKbG5P2ejQCh4d4sK9RL4371qou9drQjMhvnPmhWl5hnmqbEE0fXr9Xnw==",+ "dependencies": {+ "robust-predicates": "^3.0.2"+ }+ },"node_modules/detect-libc": {"version": "2.0.3","resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz",@@ -1074,6 +1629,14 @@"node": ">= 0.4"}},+ "node_modules/internmap": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz",+ "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==",+ "engines": {+ "node": ">=12"+ }+ },"node_modules/is-arrayish": {"version": "0.3.2","resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz",@@ -1176,6 +1739,11 @@"jiti": "bin/jiti.js"}},+ "node_modules/js-tokens": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",+ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="+ },"node_modules/lilconfig": {"version": "3.1.3","resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz",@@ -1194,12 +1762,36 @@"integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==","dev": true},+ "node_modules/lodash": {+ "version": "4.17.21",+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",+ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="+ },+ "node_modules/loose-envify": {+ "version": "1.4.0",+ "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",+ "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",+ "dependencies": {+ "js-tokens": "^3.0.0 || ^4.0.0"+ },+ "bin": {+ "loose-envify": "cli.js"+ }+ },"node_modules/lru-cache": {"version": "10.4.3","resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz","integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==","dev": true},+ "node_modules/lucide-react": {+ "version": "0.474.0",+ "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.474.0.tgz",+ "integrity": "sha512-CmghgHkh0OJNmxGKWc0qfPJCYHASPMVSyGY8fj3xgk4v84ItqDg64JNKFZn5hC6E0vHi6gxnbCgwhyVB09wQtA==",+ "peerDependencies": {+ "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0"+ }+ },"node_modules/merge2": {"version": "1.4.1","resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",@@ -1327,6 +1919,15 @@}}},+ "node_modules/next-themes": {+ "version": "0.4.4",+ "resolved": "https://registry.npmjs.org/next-themes/-/next-themes-0.4.4.tgz",+ "integrity": "sha512-LDQ2qIOJF0VnuVrrMSMLrWGjRMkq+0mpgl6e0juCLqdJ+oo8Q84JRWT6Wh11VDQKkMMe+dVzDKLWs5n87T+PkQ==",+ "peerDependencies": {+ "react": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc",+ "react-dom": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc"+ }+ },"node_modules/next/node_modules/postcss": {"version": "8.4.31","resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz",@@ -1367,7 +1968,6 @@"version": "4.1.1","resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz","integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",- "dev": true,"engines": {"node": ">=0.10.0"}@@ -1596,6 +2196,16 @@"integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==","dev": true},+ "node_modules/prop-types": {+ "version": "15.8.1",+ "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",+ "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==",+ "dependencies": {+ "loose-envify": "^1.4.0",+ "object-assign": "^4.1.1",+ "react-is": "^16.13.1"+ }+ },"node_modules/queue-microtask": {"version": "1.2.3","resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",@@ -1635,6 +2245,11 @@"react": "^19.0.0"}},+ "node_modules/react-is": {+ "version": "16.13.1",+ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",+ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="+ },"node_modules/read-cache": {"version": "1.0.0","resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz",@@ -1686,6 +2301,11 @@"node": ">=0.10.0"}},+ "node_modules/robust-predicates": {+ "version": "3.0.2",+ "resolved": "https://registry.npmjs.org/robust-predicates/-/robust-predicates-3.0.2.tgz",+ "integrity": "sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg=="+ },"node_modules/run-parallel": {"version": "1.2.0","resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",@@ -1975,6 +2595,15 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/tailwind-merge": {+ "version": "2.6.0",+ "resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-2.6.0.tgz",+ "integrity": "sha512-P+Vu1qXfzediirmHOC3xKGAYeZtPcV9g76X+xg2FD4tYgR71ewMA35Y3sCz3zhiN/dwefRpJX0yBcgwi1fXNQA==",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/dcastil"+ }+ },"node_modules/tailwindcss": {"version": "3.4.17","resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.17.tgz",@@ -2012,6 +2641,14 @@"node": ">=14.0.0"}},+ "node_modules/tailwindcss-animate": {+ "version": "1.0.7",+ "resolved": "https://registry.npmjs.org/tailwindcss-animate/-/tailwindcss-animate-1.0.7.tgz",+ "integrity": "sha512-bl6mpH3T7I3UFxuvDEXLxy/VuFxBk5bbzplh7tXI68mwMokNYd1t9qPBHlnyTwfa4JGC4zP516I1hYYtQ/vspA==",+ "peerDependencies": {+ "tailwindcss": ">=3.0.0 || insiders"+ }+ },"node_modules/thenify": {"version": "3.3.1","resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz",diff --git a/client/package.json b/client/package.jsonindex c1a1ec9d4..4a0e84b1e 100644--- a/client/package.json+++ b/client/package.json@@ -3,22 +3,35 @@"version": "0.1.0","private": true,"scripts": {- "dev": "next dev --turbopack -p 4000",+ "dev": "next dev --turbopack -p 3002","build": "next build",- "start": "next start -p 4000",+ "start": "next start -p 3002","lint": "next lint"},"dependencies": {+ "@clickhouse/client": "^1.10.1",+ "@nivo/bar": "^0.88.0",+ "@nivo/core": "^0.88.0",+ "@nivo/line": "^0.88.0",+ "@radix-ui/react-slot": "^1.1.1",+ "@tanstack/react-query": "^5.64.2",+ "@tanstack/react-query-devtools": "^5.64.2",+ "class-variance-authority": "^0.7.1",+ "clsx": "^2.1.1",+ "lucide-react": "^0.474.0",+ "next": "15.1.6",+ "next-themes": "^0.4.4","react": "^19.0.0","react-dom": "^19.0.0",- "next": "15.1.6"+ "tailwind-merge": "^2.6.0",+ "tailwindcss-animate": "^1.0.7"},"devDependencies": {- "typescript": "^5","@types/node": "^20","@types/react": "^19","@types/react-dom": "^19","postcss": "^8",- "tailwindcss": "^3.4.1"+ "tailwindcss": "^3.4.1",+ "typescript": "^5"}}diff --git a/client/src/app/actions/actions.ts b/client/src/app/actions/actions.tsnew file mode 100644index 000000000..467815052--- /dev/null+++ b/client/src/app/actions/actions.ts@@ -0,0 +1,29 @@+"use server";++import { clickhouse } from "@/lib/clickhouse";++export async function getPageViews(days: number = 1) {+ const query = `+ SELECT+ formatDateTime(toTimeZone(toStartOfHour(timestamp), 'America/Los_Angeles'), '%Y-%m-%d %H:%M:%S', 'America/Los_Angeles') AS hour,+ count() AS pageviews+ FROM pageviews+ WHERE timestamp >= toTimeZone(now() - INTERVAL ${days} DAY, 'America/Los_Angeles')+ GROUP BY hour+ ORDER BY hour ASC+ `;++ try {+ const result = await clickhouse.query({+ query,+ format: "JSONEachRow",+ });++ const data = await result.json();+ console.info(data);+ return { data };+ } catch (error) {+ console.error("Error fetching pageviews:", error);+ return { error: "Failed to fetch pageviews" };+ }+}diff --git a/client/src/app/api/stats/pageviews/route.ts b/client/src/app/api/stats/pageviews/route.tsnew file mode 100644index 000000000..b460a1720--- /dev/null+++ b/client/src/app/api/stats/pageviews/route.ts@@ -0,0 +1,33 @@+import { NextResponse } from "next/server";+import { clickhouse } from "@/lib/clickhouse";++export async function GET(request: Request) {+ try {+ const { searchParams } = new URL(request.url);+ const days = Number(searchParams.get("days")) || 1;++ const query = `+ SELECT+ formatDateTime(toTimeZone(toStartOfHour(timestamp), 'America/Los_Angeles'), '%Y-%m-%d %H:%M:%S', 'America/Los_Angeles') AS hour,+ count() AS pageviews+ FROM pageviews+ WHERE timestamp >= toTimeZone(now() - INTERVAL ${days} DAY, 'America/Los_Angeles')+ GROUP BY hour+ ORDER BY hour ASC;+ `;++ const result = await clickhouse.query({+ query,+ format: "JSONEachRow",+ });++ const data = await result.json();+ return NextResponse.json({ data });+ } catch (error) {+ console.error("Error fetching pageviews:", error);+ return NextResponse.json(+ { error: "Failed to fetch pageviews" },+ { status: 500 }+ );+ }+}diff --git a/client/src/app/components/PageViews.tsx b/client/src/app/components/PageViews.tsxnew file mode 100644index 000000000..f1d017771--- /dev/null+++ b/client/src/app/components/PageViews.tsx@@ -0,0 +1,88 @@+"use client";++import { useQuery } from "@tanstack/react-query";+import { getPageViews } from "../actions/actions";+import { ResponsiveBar } from "@nivo/bar";++export function PageViews() {+ const { data, isLoading, error } = useQuery({+ queryKey: ["pageviews"],+ queryFn: () => getPageViews(1),+ });++ if (isLoading) return <div>Loading...</div>;+ if (error) return <div>Error loading data</div>;++ // Transform data for the bar chart+ const chartData =+ data?.data?.map((item: any) => ({+ hour: new Date(item.hour).toLocaleTimeString([], {+ hour: "2-digit",+ hour12: true,+ }),+ pageviews: item.pageviews,+ })) || [];++ return (+ <div className="p-4">+ <h2 className="text-2xl font-bold mb-4">Page Views (Last 24 Hours)</h2>+ <div className="h-[400px] w-full border rounded-lg p-4 bg-card">+ <ResponsiveBar+ data={chartData}+ keys={["pageviews"]}+ indexBy="hour"+ margin={{ top: 20, right: 20, bottom: 50, left: 60 }}+ padding={0.3}+ valueScale={{ type: "linear" }}+ colors={{ scheme: "category10" }}+ theme={{+ axis: {+ ticks: {+ text: {+ fill: "var(--foreground)",+ },+ },+ legend: {+ text: {+ fill: "var(--foreground)",+ },+ },+ },+ legends: {+ text: {+ fill: "var(--foreground)",+ },+ },+ tooltip: {+ container: {+ background: "var(--background)",+ color: "var(--foreground)",+ fontSize: 12,+ },+ },+ }}+ axisLeft={{+ tickSize: 5,+ tickPadding: 5,+ tickRotation: 0,+ legend: "Pageviews",+ legendPosition: "middle",+ legendOffset: -40,+ }}+ axisBottom={{+ tickSize: 5,+ tickPadding: 5,+ tickRotation: -45,+ legend: "Hour",+ legendPosition: "middle",+ legendOffset: 40,+ }}+ labelSkipWidth={12}+ labelSkipHeight={12}+ role="application"+ ariaLabel="Pageviews bar chart"+ />+ </div>+ </div>+ );+}diff --git a/client/src/app/globals.css b/client/src/app/globals.cssindex 6b717ad34..4a7a3caf0 100644--- a/client/src/app/globals.css+++ b/client/src/app/globals.css@@ -2,20 +2,63 @@@tailwind components;@tailwind utilities;-:root {- --background: #ffffff;- --foreground: #171717;+body {+ font-family: Arial, Helvetica, sans-serif;}-@media (prefers-color-scheme: dark) {+@layer base {:root {- --background: #0a0a0a;- --foreground: #ededed;+ --background: 0 0% 100%;+ --foreground: 240 10% 3.9%;+ --card: 0 0% 100%;+ --card-foreground: 240 10% 3.9%;+ --popover: 0 0% 100%;+ --popover-foreground: 240 10% 3.9%;+ --primary: 240 5.9% 10%;+ --primary-foreground: 0 0% 98%;+ --secondary: 240 4.8% 95.9%;+ --secondary-foreground: 240 5.9% 10%;+ --muted: 240 4.8% 95.9%;+ --muted-foreground: 240 3.8% 46.1%;+ --accent: 240 4.8% 95.9%;+ --accent-foreground: 240 5.9% 10%;+ --destructive: 0 84.2% 60.2%;+ --destructive-foreground: 0 0% 98%;+ --border: 240 5.9% 90%;+ --input: 240 5.9% 90%;+ --ring: 240 5.9% 10%;+ --radius: 0.3rem;+ --chart-1: 12 76% 61%;+ --chart-2: 173 58% 39%;+ --chart-3: 197 37% 24%;+ --chart-4: 43 74% 66%;+ --chart-5: 27 87% 67%;}-}-body {- color: var(--foreground);- background: var(--background);- font-family: Arial, Helvetica, sans-serif;+ .dark {+ --background: 240 10% 3.9%;+ --foreground: 0 0% 98%;+ --card: 240 10% 3.9%;+ --card-foreground: 0 0% 98%;+ --popover: 240 10% 3.9%;+ --popover-foreground: 0 0% 98%;+ --primary: 0 0% 98%;+ --primary-foreground: 240 5.9% 10%;+ --secondary: 240 3.7% 15.9%;+ --secondary-foreground: 0 0% 98%;+ --muted: 240 3.7% 15.9%;+ --muted-foreground: 240 5% 64.9%;+ --accent: 240 3.7% 15.9%;+ --accent-foreground: 0 0% 98%;+ --destructive: 0 62.8% 30.6%;+ --destructive-foreground: 0 0% 98%;+ --border: 240 3.7% 15.9%;+ --input: 240 3.7% 15.9%;+ --ring: 240 4.9% 83.9%;+ --chart-1: 220 70% 50%;+ --chart-2: 160 60% 45%;+ --chart-3: 30 80% 55%;+ --chart-4: 280 65% 60%;+ --chart-5: 340 75% 55%;+ }}diff --git a/client/src/app/layout.tsx b/client/src/app/layout.tsxindex f7fa87eb8..28bae0a1f 100644--- a/client/src/app/layout.tsx+++ b/client/src/app/layout.tsx@@ -1,33 +1,33 @@import type { Metadata } from "next";-import { Geist, Geist_Mono } from "next/font/google";+import { Inter } from "next/font/google";import "./globals.css";+import QueryProvider from "@/providers/QueryProvider";+import { ThemeProvider } from "@/providers/ThemeProvider";+import { TopBar } from "@/components/TopBar";-const geistSans = Geist({- variable: "--font-geist-sans",- subsets: ["latin"],-});--const geistMono = Geist_Mono({- variable: "--font-geist-mono",- subsets: ["latin"],-});+const inter = Inter({ subsets: ["latin"] });export const metadata: Metadata = {- title: "Create Next App",- description: "Generated by create next app",+ title: "Frogstats Analytics",+ description: "Analytics dashboard for your web applications",};export default function RootLayout({children,-}: Readonly<{+}: {children: React.ReactNode;-}>) {+}) {return (- <html lang="en">- <body- className={`${geistSans.variable} ${geistMono.variable} antialiased`}- >- {children}+ <html lang="en" className="h-full" suppressHydrationWarning>+ <body className={`${inter.className} h-full`}>+ <ThemeProvider>+ <QueryProvider>+ <div className="min-h-full">+ <TopBar />+ <main className="flex-1">{children}</main>+ </div>+ </QueryProvider>+ </ThemeProvider></body></html>);diff --git a/client/src/app/page.tsx b/client/src/app/page.tsxindex 3eee0141a..55b1bb7e2 100644--- a/client/src/app/page.tsx+++ b/client/src/app/page.tsx@@ -1,101 +1,11 @@-import Image from "next/image";+import { PageViews } from "./components/PageViews";export default function Home() {return (- <div className="grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var(--font-geist-sans)]">- <main className="flex flex-col gap-8 row-start-2 items-center sm:items-start">- <Image- className="dark:invert"- src="/next.svg"- alt="Next.js logo"- width={180}- height={38}- priority- />- <ol className="list-inside list-decimal text-sm text-center sm:text-left font-[family-name:var(--font-geist-mono)]">- <li className="mb-2">- Get started by editing{" "}- <code className="bg-black/[.05] dark:bg-white/[.06] px-1 py-0.5 rounded font-semibold">- src/app/page.tsx- </code>- .- </li>- <li>Save and see your changes instantly.</li>- </ol>-- <div className="flex gap-4 items-center flex-col sm:flex-row">- <a- className="rounded-full border border-solid border-transparent transition-colors flex items-center justify-center bg-foreground text-background gap-2 hover:bg-[#383838] dark:hover:bg-[#ccc] text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5"- href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"- target="_blank"- rel="noopener noreferrer"- >- <Image- className="dark:invert"- src="/vercel.svg"- alt="Vercel logomark"- width={20}- height={20}- />- Deploy now- </a>- <a- className="rounded-full border border-solid border-black/[.08] dark:border-white/[.145] transition-colors flex items-center justify-center hover:bg-[#f2f2f2] dark:hover:bg-[#1a1a1a] hover:border-transparent text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5 sm:min-w-44"- href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"- target="_blank"- rel="noopener noreferrer"- >- Read our docs- </a>- </div>- </main>- <footer className="row-start-3 flex gap-6 flex-wrap items-center justify-center">- <a- className="flex items-center gap-2 hover:underline hover:underline-offset-4"- href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"- target="_blank"- rel="noopener noreferrer"- >- <Image- aria-hidden- src="/file.svg"- alt="File icon"- width={16}- height={16}- />- Learn- </a>- <a- className="flex items-center gap-2 hover:underline hover:underline-offset-4"- href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"- target="_blank"- rel="noopener noreferrer"- >- <Image- aria-hidden- src="/window.svg"- alt="Window icon"- width={16}- height={16}- />- Examples- </a>- <a- className="flex items-center gap-2 hover:underline hover:underline-offset-4"- href="https://nextjs.org?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"- target="_blank"- rel="noopener noreferrer"- >- <Image- aria-hidden- src="/globe.svg"- alt="Globe icon"- width={16}- height={16}- />- Go to nextjs.org →- </a>- </footer>- </div>+ <main className="flex min-h-screen flex-col items-center p-24">+ <div className="w-full max-w-4xl">+ <PageViews />+ </div>+ </main>);}diff --git a/client/src/app/settings/page.tsx b/client/src/app/settings/page.tsxnew file mode 100644index 000000000..35632637d--- /dev/null+++ b/client/src/app/settings/page.tsx@@ -0,0 +1,24 @@+export default function SettingsPage() {+ return (+ <div className="container max-w-6xl py-6">+ <div className="space-y-6">+ <div>+ <h3 className="text-lg font-medium">Settings</h3>+ <p className="text-sm text-muted-foreground">+ Manage your analytics preferences and configurations.+ </p>+ </div>+ <div className="border rounded-lg p-4">+ <div className="space-y-4">+ <div>+ <h4 className="text-sm font-medium">Coming Soon</h4>+ <p className="text-sm text-muted-foreground">+ Settings configuration options will be available here.+ </p>+ </div>+ </div>+ </div>+ </div>+ </div>+ );+}diff --git a/client/src/components/ThemeToggle.tsx b/client/src/components/ThemeToggle.tsxnew file mode 100644index 000000000..cbb5240b0--- /dev/null+++ b/client/src/components/ThemeToggle.tsx@@ -0,0 +1,22 @@+"use client";++import { Moon, Sun } from "lucide-react";+import { useTheme } from "next-themes";++import { Button } from "@/components/ui/button";++export function ThemeToggle() {+ const { theme, setTheme } = useTheme();++ return (+ <Button+ variant="ghost"+ size="icon"+ onClick={() => setTheme(theme === "light" ? "dark" : "light")}+ >+ <Sun className="h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" />+ <Moon className="absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" />+ <span className="sr-only">Toggle theme</span>+ </Button>+ );+}diff --git a/client/src/components/TopBar.tsx b/client/src/components/TopBar.tsxnew file mode 100644index 000000000..327748fb7--- /dev/null+++ b/client/src/components/TopBar.tsx@@ -0,0 +1,33 @@+import Link from "next/link";+import { ThemeToggle } from "./ThemeToggle";++export function TopBar() {+ return (+ <div className="border-b">+ <div className="flex h-16 items-center px-4">+ <div className="flex items-center space-x-4">+ <Link href="/" className="font-bold text-xl">+ 🐸 Frogstats+ </Link>+ </div>+ <div className="ml-auto flex items-center space-x-4">+ <nav className="flex items-center space-x-4">+ <Link+ href="/"+ className="text-sm font-medium transition-colors hover:text-primary"+ >+ Dashboard+ </Link>+ <Link+ href="/settings"+ className="text-sm font-medium text-muted-foreground transition-colors hover:text-primary"+ >+ Settings+ </Link>+ </nav>+ <ThemeToggle />+ </div>+ </div>+ </div>+ );+}diff --git a/client/src/components/ui/button.tsx b/client/src/components/ui/button.tsxnew file mode 100644index 000000000..be0dce840--- /dev/null+++ b/client/src/components/ui/button.tsx@@ -0,0 +1,57 @@+import * as React from "react"+import { Slot } from "@radix-ui/react-slot"+import { cva, type VariantProps } from "class-variance-authority"++import { cn } from "@/lib/utils"++const buttonVariants = cva(+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-neutral-950 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 dark:focus-visible:ring-neutral-300",+ {+ variants: {+ variant: {+ default:+ "bg-neutral-900 text-neutral-50 shadow hover:bg-neutral-900/90 dark:bg-neutral-50 dark:text-neutral-900 dark:hover:bg-neutral-50/90",+ destructive:+ "bg-red-500 text-neutral-50 shadow-sm hover:bg-red-500/90 dark:bg-red-900 dark:text-neutral-50 dark:hover:bg-red-900/90",+ outline:+ "border border-neutral-200 bg-white shadow-sm hover:bg-neutral-100 hover:text-neutral-900 dark:border-neutral-800 dark:bg-neutral-950 dark:hover:bg-neutral-800 dark:hover:text-neutral-50",+ secondary:+ "bg-neutral-100 text-neutral-900 shadow-sm hover:bg-neutral-100/80 dark:bg-neutral-800 dark:text-neutral-50 dark:hover:bg-neutral-800/80",+ ghost: "hover:bg-neutral-100 hover:text-neutral-900 dark:hover:bg-neutral-800 dark:hover:text-neutral-50",+ link: "text-neutral-900 underline-offset-4 hover:underline dark:text-neutral-50",+ },+ size: {+ default: "h-9 px-4 py-2",+ sm: "h-8 rounded-md px-3 text-xs",+ lg: "h-10 rounded-md px-8",+ icon: "h-9 w-9",+ },+ },+ defaultVariants: {+ variant: "default",+ size: "default",+ },+ }+)++export interface ButtonProps+ extends React.ButtonHTMLAttributes<HTMLButtonElement>,+ VariantProps<typeof buttonVariants> {+ asChild?: boolean+}++const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(+ ({ className, variant, size, asChild = false, ...props }, ref) => {+ const Comp = asChild ? Slot : "button"+ return (+ <Comp+ className={cn(buttonVariants({ variant, size, className }))}+ ref={ref}+ {...props}+ />+ )+ }+)+Button.displayName = "Button"++export { Button, buttonVariants }diff --git a/client/src/lib/clickhouse.ts b/client/src/lib/clickhouse.tsnew file mode 100644index 000000000..24c82eb01--- /dev/null+++ b/client/src/lib/clickhouse.ts@@ -0,0 +1,14 @@+import { createClient } from "@clickhouse/client";++// When running locally with npm run dev, use localhost+// When running in Docker, use container name+const isDevelopment = process.env.NODE_ENV === "development";+const host = isDevelopment ? "http://localhost:8123" : "http://clickhouse:8123";++// Override for development purposes for when you want to connect to a prod database+const clickhouseHostOverride = process.env.CLICKHOUSE_HOST;++export const clickhouse = createClient({+ host: clickhouseHostOverride || host,+ database: "analytics",+});diff --git a/client/src/lib/utils.ts b/client/src/lib/utils.tsnew file mode 100644index 000000000..bd0c391dd--- /dev/null+++ b/client/src/lib/utils.ts@@ -0,0 +1,6 @@+import { clsx, type ClassValue } from "clsx"+import { twMerge } from "tailwind-merge"++export function cn(...inputs: ClassValue[]) {+ return twMerge(clsx(inputs))+}diff --git a/client/src/providers/QueryProvider.tsx b/client/src/providers/QueryProvider.tsxnew file mode 100644index 000000000..0d1b30873--- /dev/null+++ b/client/src/providers/QueryProvider.tsx@@ -0,0 +1,20 @@+"use client";++import { QueryClient, QueryClientProvider } from "@tanstack/react-query";+import { ReactQueryDevtools } from "@tanstack/react-query-devtools";+import { useState } from "react";++export default function QueryProvider({+ children,+}: {+ children: React.ReactNode;+}) {+ const [queryClient] = useState(() => new QueryClient());++ return (+ <QueryClientProvider client={queryClient}>+ {children}+ <ReactQueryDevtools initialIsOpen={false} />+ </QueryClientProvider>+ );+}diff --git a/client/src/providers/ThemeProvider.tsx b/client/src/providers/ThemeProvider.tsxnew file mode 100644index 000000000..7d744e16f--- /dev/null+++ b/client/src/providers/ThemeProvider.tsx@@ -0,0 +1,17 @@+"use client";++import * as React from "react";+import { ThemeProvider as NextThemesProvider } from "next-themes";++export function ThemeProvider({ children }: { children: React.ReactNode }) {+ return (+ <NextThemesProvider+ attribute="class"+ defaultTheme="system"+ enableSystem+ disableTransitionOnChange+ >+ {children}+ </NextThemesProvider>+ );+}diff --git a/client/tailwind.config.ts b/client/tailwind.config.tsindex 109807be0..c05b2ff60 100644--- a/client/tailwind.config.ts+++ b/client/tailwind.config.ts@@ -1,18 +1,76 @@-import type { Config } from "tailwindcss";--export default {+/** @type {import('tailwindcss').Config} */+module.exports = {+ darkMode: ["class"],content: [- "./src/pages/**/*.{js,ts,jsx,tsx,mdx}",- "./src/components/**/*.{js,ts,jsx,tsx,mdx}",- "./src/app/**/*.{js,ts,jsx,tsx,mdx}",+ "./pages/**/*.{ts,tsx}",+ "./components/**/*.{ts,tsx}",+ "./app/**/*.{ts,tsx}",+ "./src/**/*.{ts,tsx}",],theme: {+ container: {+ center: true,+ padding: "2rem",+ screens: {+ "2xl": "1400px",+ },+ },extend: {colors: {- background: "var(--background)",- foreground: "var(--foreground)",+ border: "hsl(var(--border))",+ input: "hsl(var(--input))",+ ring: "hsl(var(--ring))",+ background: "hsl(var(--background))",+ foreground: "hsl(var(--foreground))",+ primary: {+ DEFAULT: "hsl(var(--primary))",+ foreground: "hsl(var(--primary-foreground))",+ },+ secondary: {+ DEFAULT: "hsl(var(--secondary))",+ foreground: "hsl(var(--secondary-foreground))",+ },+ destructive: {+ DEFAULT: "hsl(var(--destructive))",+ foreground: "hsl(var(--destructive-foreground))",+ },+ muted: {+ DEFAULT: "hsl(var(--muted))",+ foreground: "hsl(var(--muted-foreground))",+ },+ accent: {+ DEFAULT: "hsl(var(--accent))",+ foreground: "hsl(var(--accent-foreground))",+ },+ popover: {+ DEFAULT: "hsl(var(--popover))",+ foreground: "hsl(var(--popover-foreground))",+ },+ card: {+ DEFAULT: "hsl(var(--card))",+ foreground: "hsl(var(--card-foreground))",+ },+ },+ borderRadius: {+ lg: "var(--radius)",+ md: "calc(var(--radius) - 2px)",+ sm: "calc(var(--radius) - 4px)",+ },+ keyframes: {+ "accordion-down": {+ from: { height: 0 },+ to: { height: "var(--radix-accordion-content-height)" },+ },+ "accordion-up": {+ from: { height: "var(--radix-accordion-content-height)" },+ to: { height: 0 },+ },+ },+ animation: {+ "accordion-down": "accordion-down 0.2s ease-out",+ "accordion-up": "accordion-up 0.2s ease-out",},},},- plugins: [],-} satisfies Config;+ plugins: [require("tailwindcss-animate")],+};diff --git a/docker-compose.yml b/docker-compose.ymlindex b6c795597..de8821a56 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -12,12 +12,6 @@ services:environment:- CLICKHOUSE_DB=analytics- ALLOW_EMPTY_PASSWORD=yes- # healthcheck:- # test: wget --no-verbose --tries=1 --spider http://localhost:8123/ping || exit 1- # interval: 5s- # timeout: 10s- # retries: 3- # start_period: 10spostgres:image: postgres:latest@@ -31,7 +25,6 @@ services:volumes:- postgres-data:/var/lib/postgresql/data-backend:container_name: backendbuild:@@ -42,7 +35,6 @@ services:environment:- NODE_ENV=development- CLICKHOUSE_HOST=http://clickhouse:8123- - CLICKHOUSE_PORT=8123- CLICKHOUSE_DB=analytics- POSTGRES_HOST=postgres- POSTGRES_PORT=5432@@ -62,7 +54,7 @@ services:context: ./clientdockerfile: Dockerfileports:- - "4000:4000"+ - "3002:3002"environment:- NODE_ENV=productiondepends_on: