From a26f63003c5a8f2b888e2938824dad75ccf350d8 Mon Sep 17 00:00:00 2001 From: Wajahat Islam Gul Date: Fri, 5 Sep 2025 11:22:37 +0500 Subject: [PATCH 1/2] fix: Fix product service not found error on render --- Dockerfile | 2 +- ecosystem.config.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index f162e34..18d6d66 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,7 +29,7 @@ WORKDIR /app RUN apk add --no-cache openssl # Copy built output and minimal files -COPY --from=base /app/apps /app/apps +COPY --from=base /app/dist /app/dist COPY --from=base /app/node_modules /app/node_modules COPY --from=base /app/prisma /app/prisma COPY --from=base /app/.env* ./ diff --git a/ecosystem.config.js b/ecosystem.config.js index e25e42d..6334d8b 100644 --- a/ecosystem.config.js +++ b/ecosystem.config.js @@ -2,27 +2,27 @@ module.exports = { apps: [ { name: 'auth-service', - script: 'apps/auth-service/dist/main.js', + script: 'dist/apps/auth-service/main.js', env: { PORT: 6001 }, }, { name: 'product-service', - script: 'apps/product-service/dist/main.js', + script: 'dist/apps/product-service/main.js', env: { PORT: 6002 }, }, { name: 'order-service', - script: 'apps/order-service/dist/main.js', + script: 'dist/apps/order-service/main.js', env: { PORT: 6004 }, }, { name: 'chat-service', - script: 'apps/chat-service/dist/main.js', + script: 'dist/apps/chat-service/main.js', env: { PORT: 6005 }, }, { name: 'api-gateway', - script: 'apps/api-gateway/dist/main.js', + script: 'dist/apps/api-gateway/main.js', env: { PORT: 8080 }, }, ], From cccac2a98c4651fdc7709a8124d2bd24daa57a68 Mon Sep 17 00:00:00 2001 From: Wajahat Islam Gul Date: Mon, 8 Sep 2025 22:02:42 +0500 Subject: [PATCH 2/2] feat: Add vercel config to deploy FE --- README.md | 46 +++++++++++++++++-- apps/seller-ui/next.config.js | 9 +++- apps/seller-ui/package.json | 31 ++++++++++++- .../src/app/(routes)/dashboard/inbox/page.tsx | 12 ++++- apps/user-ui/next.config.js | 8 +++- apps/user-ui/package.json | 34 +++++++++++++- .../components/rich-text-editor/index.tsx | 15 +++++- 7 files changed, 143 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index ce6f52a..f52c276 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,15 @@ -# +# ✨ Your new, shiny [Nx workspace](https://nx.dev) is almost ready ✨. -[Learn more about this workspace setup and its capabilities](https://nx.dev/nx-api/node?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects) or run `npx nx graph` to visually explore what was created. Now, let's get you up to speed! +[Learn more about this workspace setup and its capabilities](https://nx.dev/nx-api/node?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects) or run `npx nx graph` to visually explore what was created. Now, let's get you up to speed! ## Finish your CI setup [Click here to finish setting up your workspace!](https://cloud.nx.app/connect/rtuLBlFOCR) - ## Run tasks To run the dev server for your app, use: @@ -57,7 +56,6 @@ You can use `npx nx list` to get a list of installed plugins. Then, run `npx nx [Learn more about Nx plugins »](https://nx.dev/concepts/nx-plugins?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects) | [Browse the plugin registry »](https://nx.dev/plugin-registry?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects) - [Learn more about Nx on CI](https://nx.dev/ci/intro/ci-with-nx#ready-get-started-with-your-provider?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects) ## Install Nx Console @@ -70,13 +68,51 @@ Nx Console is an editor extension that enriches your developer experience. It le Learn more: -- [Learn more about this workspace setup](https://nx.dev/nx-api/node?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects) +- [Learn more about this workspace setup](https://nx.dev/nx-api/node?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects) - [Learn about Nx on CI](https://nx.dev/ci/intro/ci-with-nx?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects) - [Releasing Packages with Nx release](https://nx.dev/features/manage-releases?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects) - [What are Nx plugins?](https://nx.dev/concepts/nx-plugins?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects) And join the Nx community: + - [Discord](https://go.nx.dev/community) - [Follow us on X](https://twitter.com/nxdevtools) or [LinkedIn](https://www.linkedin.com/company/nrwl) - [Our Youtube channel](https://www.youtube.com/@nxdevtools) - [Our blog](https://nx.dev/blog?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects) + +## Deploying seller-ui and user-ui to Vercel + +Create two Vercel projects, one for each Next.js app. Use these settings: + +1. Project → Settings → General + + - Root Directory: `apps/seller-ui` (Project 1) and `apps/user-ui` (Project 2) + - Framework Preset: Next.js + - Node Version: 20 (we set `"engines": { "node": "20.x" }` in each app) + - Install Command: leave default (`npm install`) + - Build Command: leave default (`next build`) + - Output Directory: leave default (managed by Next on Vercel) + +2. Project → Settings → Environment Variables + + - seller-ui + - `NEXT_PUBLIC_SERVER_URI` → Your API base URL (e.g. `https://api.example.com`) + - `NEXT_PUBLIC_CHAT_WEBSOCKET_URI` → WebSocket URL (use `wss://.../chat` in prod) + - `NEXT_PUBLIC_USER_UI_LINK` → Public URL of user-ui (e.g. `https://user.example.com`) + - user-ui + - `NEXT_PUBLIC_SERVER_URI` → Your API base URL (e.g. `https://api.example.com`) + - `NEXT_PUBLIC_CHAT_WEBSOCKET_URI` → WebSocket URL (use `wss://.../chat` in prod) + - `NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY` → Your Stripe publishable key + +3. (Optional) Ignore builds when a project has no changes + - Project → Settings → Git → Ignored Build Step + - Command: + ```bash + git diff --quiet ${VERCEL_GIT_PREVIOUS_SHA:-HEAD^} ${VERCEL_GIT_COMMIT_SHA:-HEAD} -- . || exit 1 + ``` + - This runs builds only when files in the project’s root directory changed. + +Notes + +- Each app has `build`/`dev` scripts and Node 20 engines in its `package.json`. +- Next Image remote host `ik.imagekit.io` is already allowed in both apps. diff --git a/apps/seller-ui/next.config.js b/apps/seller-ui/next.config.js index 37596d6..aa7e7a2 100644 --- a/apps/seller-ui/next.config.js +++ b/apps/seller-ui/next.config.js @@ -1,6 +1,5 @@ //@ts-check -// eslint-disable-next-line @typescript-eslint/no-var-requires const { composePlugins, withNx } = require('@nx/next'); /** @@ -20,6 +19,14 @@ const nextConfig = { }, ], }, + + // Disable type-checking and ESLint during build on Vercel + typescript: { + ignoreBuildErrors: true, + }, + eslint: { + ignoreDuringBuilds: true, + }, }; const plugins = [ diff --git a/apps/seller-ui/package.json b/apps/seller-ui/package.json index 689dba5..ab3acd9 100644 --- a/apps/seller-ui/package.json +++ b/apps/seller-ui/package.json @@ -2,9 +2,38 @@ "name": "@./seller-ui", "version": "0.0.1", "private": true, + "scripts": { + "build": "next build", + "start": "next start -p $PORT", + "dev": "next dev -p 3000" + }, + "engines": { + "node": "20.x" + }, "dependencies": { + "@nx/next": "^20.6.1", + "@tanstack/react-query": "^5.83.0", + "@tanstack/react-table": "^8.21.3", + "axios": "^1.10.0", + "jotai": "^2.12.5", + "lucide-react": "^0.525.0", "next": "~15.1.4", "react": "19.0.0", - "react-dom": "19.0.0" + "react-dom": "19.0.0", + "react-hook-form": "^7.60.0", + "react-hot-toast": "^2.5.2", + "react-quill-new": "^3.6.0", + "styled-components": "^6.1.19", + "tailwind-merge": "^3.3.1", + "canvas-confetti": "^1.9.3" + }, + "devDependencies": { + "autoprefixer": "10.4.13", + "postcss": "8.4.38", + "tailwindcss": "3.4.3", + "typescript": "~5.7.2", + "@types/react": "19.0.0", + "@types/react-dom": "19.0.0", + "@types/node": "~18.16.9" } } diff --git a/apps/seller-ui/src/app/(routes)/dashboard/inbox/page.tsx b/apps/seller-ui/src/app/(routes)/dashboard/inbox/page.tsx index 6a40c9c..3cefdb7 100644 --- a/apps/seller-ui/src/app/(routes)/dashboard/inbox/page.tsx +++ b/apps/seller-ui/src/app/(routes)/dashboard/inbox/page.tsx @@ -1,12 +1,12 @@ 'use client'; -import React, { useState, useEffect } from 'react'; +import React, { Suspense, useState, useEffect } from 'react'; import { useSearchParams, useRouter } from 'next/navigation'; import { useWebSocket } from 'apps/seller-ui/src/context/websocket-context'; import { useConversations } from 'apps/seller-ui/src/hooks/chat'; import { ChatHeader, ChatWindow, ConversationList, EmptyChatState } from 'apps/seller-ui/src/shared/organisms'; -const InboxPage: React.FC = () => { +const InboxPageInner: React.FC = () => { const [selectedConversationId, setSelectedConversationId] = useState(null); const [selectedUser, setSelectedUser] = useState(null); @@ -107,4 +107,12 @@ const InboxPage: React.FC = () => { ); }; +const InboxPage: React.FC = () => { + return ( + }> + + + ); +}; + export default InboxPage; diff --git a/apps/user-ui/next.config.js b/apps/user-ui/next.config.js index 64ae0f5..6648e0e 100644 --- a/apps/user-ui/next.config.js +++ b/apps/user-ui/next.config.js @@ -1,6 +1,5 @@ //@ts-check -// eslint-disable-next-line @typescript-eslint/no-var-requires const { composePlugins, withNx } = require('@nx/next'); /** @@ -19,6 +18,13 @@ const nextConfig = { }, ], }, + // Disable type-checking and ESLint during build on Vercel + typescript: { + ignoreBuildErrors: true, + }, + eslint: { + ignoreDuringBuilds: true, + }, }; const plugins = [ diff --git a/apps/user-ui/package.json b/apps/user-ui/package.json index 6118f63..eca31f6 100644 --- a/apps/user-ui/package.json +++ b/apps/user-ui/package.json @@ -2,9 +2,41 @@ "name": "@./user-ui", "version": "0.0.1", "private": true, + "scripts": { + "build": "next build", + "start": "next start -p $PORT", + "dev": "next dev -p 3001" + }, + "engines": { + "node": "20.x" + }, "dependencies": { + "@nx/next": "^20.6.1", + "@stripe/react-stripe-js": "^3.9.1", + "@stripe/stripe-js": "^7.8.0", + "@tanstack/react-query": "^5.83.0", + "@tanstack/react-table": "^8.21.3", + "canvas-confetti": "^1.9.3", + "axios": "^1.10.0", + "lucide-react": "^0.525.0", "next": "~15.1.4", "react": "19.0.0", - "react-dom": "19.0.0" + "react-dom": "19.0.0", + "react-hook-form": "^7.60.0", + "react-hot-toast": "^2.5.2", + "react-image-magnify": "^2.7.4", + "tailwind-merge": "^3.3.1", + "ua-parser-js": "^2.0.4", + "zustand": "^5.0.7", + "react-quill-new": "^3.6.0" + }, + "devDependencies": { + "autoprefixer": "10.4.13", + "postcss": "8.4.38", + "tailwindcss": "3.4.3", + "typescript": "~5.7.2", + "@types/react": "19.0.0", + "@types/react-dom": "19.0.0", + "@types/node": "~18.16.9" } } diff --git a/packages/components/rich-text-editor/index.tsx b/packages/components/rich-text-editor/index.tsx index 7bf5c80..5ca43bc 100644 --- a/packages/components/rich-text-editor/index.tsx +++ b/packages/components/rich-text-editor/index.tsx @@ -1,7 +1,20 @@ +'use client'; + import React, { useEffect, useState } from 'react'; -import ReactQuill from 'react-quill-new'; +import dynamic from 'next/dynamic'; import 'react-quill-new/dist/quill.snow.css'; +const ReactQuill = dynamic(() => import('react-quill-new'), { + ssr: false, + loading: () => ( +
+
+
+
+
+ ), +}); + interface RichTextEditorProps { value: string; onChange: (content: string) => void;