This is an e-commerce app with an admin dashboard and a user facing dashboard using Turborepo in a single monorepo.
- Mongo DB running either locally or on cloud.
- A super secret key to be used for JWT signature
-
Clone the repository locally.
git clone [email protected]:Mnyu/dukaan-app.git
-
Open the folder
dukaan-app
in VSCode. -
Inside
apps -> api
folder, create a copy of.env.example
with file name as.env
. -
In the
.env
file, replace the values ofMONGO_URI
,JWT_SECRET
andJWT_LIFETIME
as per your environment.
Possible values forJWT_LIFETIME
could be 60 or 1h or 1d -
Open new terminal in VSCode and run
yarn install
-
Build common package
cd packages/common/ yarn build
-
Build store package
cd ../store/ yarn build
-
Now run
cd ../.. yarn run dev
-
Following statements should be visible in logs :
Database connection successful.
Server is listening on port 5000...
-
Admin Dashboard :
http://localhost:3000/
User Dashboard :http://localhost:3001/
yarn run build
- throws following error atdukaan-app
level :
docs:build: ReferenceError: document is not defined
docs:build: at getUrlBasedHistory (/Users/abhimgup/manyu/react/cohort/dukaan-app/apps/docs/.next/server/chunks/876.js:406:14)
docs:build: at Object.createBrowserHistory (/Users/abhimgup/manyu/react/cohort/dukaan-app/apps/docs/.next/server/chunks/876.js:239:10)
docs:build: at exports.modules.8292.e.BrowserRouter (/Users/abhimgup/manyu/react/cohort/dukaan-app/apps/docs/.next/server/chunks/876.js:20055:14758)
docs:build: at Ue (/Users/abhimgup/manyu/react/cohort/dukaan-app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:113:273)
docs:build: at Z (/Users/abhimgup/manyu/react/cohort/dukaan-app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:120:91)
docs:build: at Ve (/Users/abhimgup/manyu/react/cohort/dukaan-app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:123:155)
docs:build: at Xe (/Users/abhimgup/manyu/react/cohort/dukaan-app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:122:289)
docs:build: at Z (/Users/abhimgup/manyu/react/cohort/dukaan-app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:120:350)
docs:build: at Ue (/Users/abhimgup/manyu/react/cohort/dukaan-app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:118:191)
docs:build: at Z (/Users/abhimgup/manyu/react/cohort/dukaan-app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:120:91)
web:build: ReferenceError: document is not defined
web:build: at getUrlBasedHistory (/Users/abhimgup/manyu/react/cohort/dukaan-app/apps/web/.next/server/chunks/876.js:406:14)
web:build: at Object.createBrowserHistory (/Users/abhimgup/manyu/react/cohort/dukaan-app/apps/web/.next/server/chunks/876.js:239:10)
web:build: at exports.modules.8292.e.BrowserRouter (/Users/abhimgup/manyu/react/cohort/dukaan-app/apps/web/.next/server/chunks/876.js:20053:14758)
web:build: at Ue (/Users/abhimgup/manyu/react/cohort/dukaan-app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:113:273)
web:build: at Z (/Users/abhimgup/manyu/react/cohort/dukaan-app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:120:91)
web:build: at Ve (/Users/abhimgup/manyu/react/cohort/dukaan-app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:123:155)
web:build: at Xe (/Users/abhimgup/manyu/react/cohort/dukaan-app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:122:289)
web:build: at Z (/Users/abhimgup/manyu/react/cohort/dukaan-app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:120:350)
web:build: at Ue (/Users/abhimgup/manyu/react/cohort/dukaan-app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:118:191)
web:build: at Z (/Users/abhimgup/manyu/react/cohort/dukaan-app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:120:91)
docs:build:
docs:build: Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
docs:build: ReferenceError: document is not defined
docs:build: at getUrlBasedHistory (/Users/abhimgup/manyu/react/cohort/dukaan-app/apps/docs/.next/server/chunks/876.js:406:14)
docs:build: at Object.createBrowserHistory (/Users/abhimgup/manyu/react/cohort/dukaan-app/apps/docs/.next/server/chunks/876.js:239:10)
docs:build: at exports.modules.8292.e.BrowserRouter (/Users/abhimgup/manyu/react/cohort/dukaan-app/apps/docs/.next/server/chunks/876.js:20055:14758)
docs:build: at Ue (/Users/abhimgup/manyu/react/cohort/dukaan-app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:113:273)
docs:build: at Z (/Users/abhimgup/manyu/react/cohort/dukaan-app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:120:91)
docs:build: at Ve (/Users/abhimgup/manyu/react/cohort/dukaan-app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:123:155)
docs:build: at Xe (/Users/abhimgup/manyu/react/cohort/dukaan-app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:122:289)
docs:build: at Z (/Users/abhimgup/manyu/react/cohort/dukaan-app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:120:350)
docs:build: at Ue (/Users/abhimgup/manyu/react/cohort/dukaan-app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:118:191)
docs:build: at Z (/Users/abhimgup/manyu/react/cohort/dukaan-app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:120:91)
=========================================================================
This is an official starter Turborepo.
Run the following command:
npx create-turbo@latest
This Turborepo includes the following packages/apps:
docs
: a Next.js appweb
: another Next.js appui
: a stub React component library shared by bothweb
anddocs
applicationseslint-config-custom
:eslint
configurations (includeseslint-config-next
andeslint-config-prettier
)tsconfig
:tsconfig.json
s used throughout the monorepo
Each package/app is 100% TypeScript.
This Turborepo has some additional tools already setup for you:
- TypeScript for static type checking
- ESLint for code linting
- Prettier for code formatting
To build all apps and packages, run the following command:
cd my-turborepo
pnpm build
To develop all apps and packages, run the following command:
cd my-turborepo
pnpm dev
Turborepo can use a technique known as Remote Caching to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines.
By default, Turborepo will cache locally. To enable Remote Caching you will need an account with Vercel. If you don't have an account you can create one, then enter the following commands:
cd my-turborepo
npx turbo login
This will authenticate the Turborepo CLI with your Vercel account.
Next, you can link your Turborepo to your Remote Cache by running the following command from the root of your Turborepo:
npx turbo link
Learn more about the power of Turborepo: