NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_cHJvcGVyLWpheS04Ni5jbGVyay5hY2NvdW50cy5kZXYk CLERK_SECRET_KEY=sk_test_VIVCzvWq0PpgqLrhWYSBeiYU1f0B8eRdSltTogYX3K NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/ NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/
NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME="dn8driyop"
See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema
Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
See the documentation for all the connection string options: https://pris.ly/d/connection-strings
This is a Next.js project bootstrapped with create-next-app.
First, run the development server:
npm run dev
# or
yarn dev
# or
pnpm devOpen http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.
This project uses next/font to automatically optimize and load Inter, a custom Google Font.
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.
First Step: npx create-next-app@latest my-app --typescript --tailwind --eslint
Second Step: npx shadcn-ui@latest init
Third Step: npx shadcn-ui@latest add button
Fourth Step: npm install @clerk/nextjs
https://clerk.com/docs/nextjs/get-started-with-nextjs
<ClerkProvider>
<html lang="en">
<body className={inter.className}>{children}</body>
</html>
</ClerkProvider>
and copy middleware code and paste it on middleware page
Like: (auth) => routes => sign-up => [[ ...sign-up ]] => page.tsx
cope code from clerk docs to page.tsx page.
Do it for sign in also
Like: (auth) => routes => sign-in => [[ ...sign-in ]] => page.tsx
cope code from clerk docs to page.tsx page.
Next, add environment variables for the signIn , signUp and afterSignUp , afterSignIn paths:
==> Now your sign in and sign up authentication is ready, If you want to make it center create a layout page for all group page like: (routes) => layout.tsx it will cover all pages under routes folder. Now you can control your all page layout. Like this
export default function AuthLayout({ children }:{ children: React.ReactNode }) { return(
after sign in by google or your email it will redirect you to root folder page.tsx. It's your admin main page.
<UserButton afterSignOutUrl="/"/>
Step 1: npx shadcn-ui@latest add dialog for adding dialog popup.
Now work on this page.
After completing this page craete a folder namee modals in components folder and the create a file name store-modal.tsx
after completinf this page create a folder in main folder name providers then create file name modal-provider.tsx
Now when you work on this page please make sure you have this packe installed in package.json => @hookform/resolvers and react-hook-form dependencies.
after completing the dynamic form then Install prisma to sent data to db
After complete prisma then create a account on planetscale website: https://planetscale.com
create Databasae there and add prisma connect in env file.
Now Add this code from planetscale to prisma.schema page provider = "mysql" url = env("DATABASE_URL") relationMode = "prisma"
model Store{ id String @id @default(uuid()) name String userId String createdAt DateTime @default(now()) updatedAt DateTime @updatedAt }
NB: If you get any error please check your database url on env file.
It's time to call PAI route to send date to the databse. Go to App folder create a folder name api => create another folder name stores => create a file name route.ts.
after completing this page go to component folder to store modal page now create state for manage user request handle.Like: const [loading, setLoading] = useState(false)
after apply it on button and input Now install a package for axios
after completing this
after complete this page
now you can add toat message
create a folder name (dashboard) on app folder, Now create another folder name [storeId] it's a convention of NEXT 13, it will automatically take store id. Now create a layout.tsx for layout of all store.
After completing layout page Nopw craete
Nopw write the basic code of page.tsx page.
Now create (routes) folder on root folder then move page.tsx to the routes folder.
window.location.assign(/${response.data.id});
Go to dashboard layout for creating navbar.
after basic header is complete let's create a MainNav route on components.
Now create a store switcher as a combo box by this command: npx shadcn-ui@latest add popover and this: npx shadcn-ui@latest add command
after completing switcher page now create
Now create a folder to the settings folder name components and then create a file name settings-from.tsx
Create 2 routes first one is patch for update the store. Second id delete for delete store.
After completing this, Now go to settings-form page for update the actual delete and update operation
add this on settings form page as a component
After this add onDelete method to perform delete operation on settings form page.
After Alert Modal is done
After adding billboard schema now command: npx prisma generate after that another command: npx prisma db push
Now create a page.tsx here. After basic file structure is ready
This structure means it's a server components const BillboardPage = async ({ params }: { params: {billboardId: string} }) =>
and change name to billboard-form.tsx
Copy the preset name and paste it on impage-upload page uploadPreset here
add this on next.config.js
images: { domains: ["res.cloudinary.com"] }
Now create a folder a name [storeId] in api then create another folder billboards in [storeID] folder then a create a file name route.ts
After completing api
and copy the storeId => route file and paste on billboardId route file.
after completing billboard routes go to = >
After getting all billboard number and showed it on billboard title;
Use command: npx shadcn-ui@latest add table and this dependency for this command: npm install @tanstack/react-table
now create page on billboards => components name column.tsx and copy column.tsx file form this link: https://ui.shadcn.com/docs/components/data-table
Now make column.tsx as your need
now create page on components => ui => name data-table.tsx and copy column.tsx file form this link: https://ui.shadcn.com/docs/components/data-table
Now add this page on BillboardClient page.
after completing api then go to prisma.schema and add categoris also make relation with billboard and store with this categories.
Now rename billboard page to CategoriesPage and change other Also do it on API folder to create categories api
Now rename billboard page to SizesPage and change other Also do it on API folder to create sizes api
Now rename sizes page to ColorsPage and change other Also do it on API folder to create colors api
Now rename products page to ProductsPage and change other Also do it on API folder to create products api
Now rename sizes page to OrdersPage and and delete cell-action and [sizeid] no need it and also no need to add api.