Git Product home page Git Product logo

ecommerce-nextjs's Introduction

A Next.js 14 E-Commerce App and Admin Dashboard/CMS

A Next.js 14 E-Commerce App and Admin Dashboard/CMS

Ask Me Anything! GitHub license Maintenance GitHub branches Github commits Vercel status GitHub issues GitHub pull requests

๐Ÿ“” Table of Contents

โ€ผ๏ธ Folder Structure

Here is the folder structure of this app.

ecommerce-nextjs/
  |- ecommerce-admin/
    |-- actions/
    |-- app/
        |--- (auth)/routes/
            |---- sign-in/
            |---- sign-up/
        |--- (dashboard)/[storeId]/(routes)/
            |---- billboards/
            |---- categories/
            |---- colors/
            |---- orders/
            |---- products/
            |---- settings/
            |---- sizes/
        |--- api/
            |---- [storeId]/
                |----- billboards/
                |----- categories/
                |----- checkout/
                |----- colors/
                |----- products/
                |----- sizes/
            |---- stores/[storeId]/
            |---- webhook/
        |--- favicon.ico
        |--- globals.css
    |-- components/
        |--- modals/
        |--- ui/
    |-- constants/
    |-- hooks/
    |-- lib/
    |-- prisma/
    |-- providers/
    |-- public/
        |--- icons/
        |--- site.webmanifest/
    |-- .env.local
    |-- .env.example
    |-- components.json
    |-- middleware.ts
    |-- next.config.js
    |-- package-lock.json
    |-- package.json
    |-- postcss.config.js
    |-- tailwind.config.ts
    |-- tsconfig.json
  |- ecommerce-store/
    |-- actions/
    |-- app/
        |--- (routes)/
            |---- cart/
            |---- category/[categoryId]/
            |---- product/[productId]/
        |--- favicon.ico
        |--- globals.css
    |-- components/
        |--- gallery/
        |--- ui/
    |-- constants/
    |-- hooks/
    |-- lib/
    |-- providers/
    |-- public/
        |--- icons/
        |--- site.webmanifest/
    |-- .env.local
    |-- .env.example
    |-- next.config.js
    |-- package-lock.json
    |-- package.json
    |-- postcss.config.js
    |-- tailwind.config.ts
    |-- tsconfig.json
    |-- types.ts

๐Ÿงฐ Getting Started

  1. Make sure Git and NodeJS is installed.
  2. Clone this repository to your local computer.
  3. Create .env.local file in both ecommerce-admin/ and ecommerce-store/ folder.
  4. Contents of ecommerce-admin/.env.local:
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_XXXXXXXXXXXXXXXXXXXXXXXXXX
CLERK_SECRET_KEY=sk_test_XXXXXXXXXXXXXXXXXXXXXXXXXXXX
STRIPE_API_KEY=sk_test_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
STRIPE_WEBHOOK_SECRET=whsec_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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_FRONTEND_STORE_URL=http://localhost:3001

DATABASE_URL=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME="xxxxxxxxxx"
NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET="xxxxxxxxxxx"
  1. Contents of ecommerce-store/.env.local:
NEXT_PUBLIC_API_URL=http://localhost:3000/api/<your-api-key>
NEXT_PUBLIC_BILLBOARD_ID=<your-billboard-id>
  1. Clerk Keys:
    • NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY and CLERK_SECRET_KEY are provided by Clerk. You need to sign up for an account on Clerk (https://www.clerk.dev/), log in, and access these keys in your account settings.

Copy Clerk Secret and Publishable Key

  1. Stripe Secret Key:
    • STRIPE_API_KEY is provided by Stripe in order to setup online payments. You need to sign up for an account on Stripe (https://stripe.com/), log in, and access these keys in your account dashboard.

Copy Stripe Secret Key

  1. Stripe Webhook Secret:

    • STRIPE_WEBHOOK_SECRET is required for handling Stripe webhooks securely. Follow these steps to obtain the webhook secret:
      • Sign in to your Stripe account (https://dashboard.stripe.com/).
      • In the Dashboard, go to "Developers" > "Webhooks".
      • Click the "Add endpoint" button.
      • Set up the endpoint details and select checkout.session.completed event.
      • After saving, you'll see the webhook signing secret. Copy this value to use as STRIPE_WEBHOOK_SECRET.
  2. URLs for Clerk:

    • NEXT_PUBLIC_CLERK_SIGN_IN_URL, NEXT_PUBLIC_CLERK_SIGN_UP_URL, NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL, and NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL are endpoints or URLs related to your Clerk setup. You can configure these in your Clerk dashboard.
  3. Prisma Database URL:

  • DATABASE_URL is the connection URL for your Aiven MySQL database. You will need to create a Aiven account (https://aiven.io/) or use an existing one. Obtain the connection URL from your Aiven dashboard.

Copy Aiven MySQL Database Auth URL

  1. Cloudinary Keys:

    • Cloud Name: The NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME is associated with your Cloudinary account. To find your Cloud Name: - Log in to your Cloudinary account. - Navigate to the Dashboard. - You will find your Cloud Name displayed on the Dashboard.

    • Upload Preset: The NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET is used for unsigned uploads. To create an unsigned upload preset: - In your Cloudinary Dashboard, go to the Settings. - Scroll down to the "Upload presets" section. - Click the "Add upload preset" button. - Configure the preset settings as needed (e.g., folder, tags). - Click the "Save" button. - Your new upload preset will be listed on the Upload Presets page. Copy the name of the preset.

  2. Public API URL:

    • NEXT_PUBLIC_API_URL are endpoints or URLs related to your Admin APIs. You can configure/copy this from your Admin Dashboard Settings Panel.
  3. Active Billboard Id:

    • NEXT_PUBLIC_BILLBOARD_ID is the id of billboard which you want to display on home page. You can copy this either from dashboard/billboards page or directly from database by running npm run prisma:studio
  4. Install required packages using npm install --legacy-peer-deps or yarn install --legacy-peer-deps.

  5. Run both admin and store separately on ports 3000 and 3001 respectively.

๐Ÿ“š Additional Resources

NOTE: Please make sure to keep your API keys and configuration values secure and do not expose them publicly.

๐Ÿ“ท Screenshots:

E-Commerce Store

View Product Categories

View Product Info

View Shopping Cart

E-Commerce Admin

Create Store

View Categories

Create Product

โš™๏ธ Tech Stack

React JS Next JS Typescript Tailwind CSS Vercel Prisma

๐Ÿ”ง Stats

E-Commerce Store

Stats for E-Commerce Store

E-Commerce Admin

Stats for E-Commerce Admin

๐Ÿ™Œ Contribute

You might encounter some bugs while using this app. You are more than welcome to contribute. Just submit changes via pull request and I will review them before merging. Make sure you follow community guidelines.

๐Ÿ’Ž Acknowledgements

Useful resources and libraries that are used in My Portfolio

โ˜• Buy Me a Coffee

๐Ÿš€ Follow Me

GitHub followers Twitter YouTube

๐Ÿ“š Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

๐Ÿ“ƒ Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out Next.js deployment documentation for more details.

โญ Give A Star

You can also give this repository a star to show more people and they can use this repository.

๐ŸŒŸ Star History

Star History Chart

(back to top)

ecommerce-nextjs's People

Contributors

sanidhyy avatar dependabot[bot] avatar

Stargazers

Mark avatar Karthik Raju avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.