Top

Next.Js Documentation

E-Commerce offers stunning and one-of-a-kind website demos tailored to your grocery, bakery, and online store needs. With E-Commerce, you'll find everything you require to craft the ideal website for your business. E-Commerce - your all-in-one solution!

Getting Started

How to start

Welcome to Next.js! Next.js helps you build modern applications for the web, mobile, or desktop.

For getting started an Next.js application you needs two things as Prerequisites.

Prerequisites

For getting started an Next.js application you needs two things as Prerequisites.

    • Before you begin, make sure your development environment includes Node and an npm package manager.

Node.js

  1. Download latest version of node.js from nodejs.org
  2. Install Node.js using downloaded file
  3. To check your node version, run node -v in a terminal/console window.

Npm package manager

  1. Next.js apps depend on features and functionality provided by libraries that are available as npm packages. To download and install npm packages, you must have an, you must have an npm package manager.
  2. This Quick Start uses the npm client command line interface, which is installed with Node.js by default. To check that you have the npm client installed, run npm -v in a terminal/console window.
  3. For better understanding Next.js we suggest you to once go through official documentation of Next.js from Next.js Docs.

Next.js setup

If you want E-Commerce theme setup then directly follow next E-Commerce setup section

🚀 Installing Next.js

Follow the below steps to set up the project on your local machine.

  • Make sure you have the following installed:
  • Node.js v18 or higher
  • PostgreSQL v15 or higher
  • npm or yarn
  • Git
    • command:
    git clone https://github.com/sagardhavade/goodesiProduction.git

    clone Repo

NPM Install

    cd goodesi
    cd goodesiBackend
    cd goodesiNode
    • Run the npm command a npm install, as shown here:
    npm install
    # or
    yarn install

Serve Application

  1. Launch the server by using the npm command npm run dev
  2. npm run dev

E-Commerce setup

If you have already download and install node.js and Next.js then ignore prerequisites accordingly.

Once you serve your application by default it will take their defalult port so you can open port using localhost:3000

Make sure you are not running any other Next.js project in local if so then use new generated port from terminal with label called app running at:

Setup environments

You must need to setup environment url If you using different port you need configure in environment.ts file

For example your local server url is http://localhost:3000/ then your environment URL should be like http://localhost:3000/api

Note:- We are using mock json data that's why we have configured url using like this http://localhost:3000/api if you are using Your Api then you can change accordingly as per your requirement

You must need to setup environment url If you using different port you need configure in environment.ts file

/** @type {import('next').NextConfig} */
const nextConfig = {
    env: {
        API_PROD_URL: "Your Api",
        
        API_DEV_URL: "http://localhost:3000/api/",
    },

}

module.exports = nextConfig

Use environment

import axios from "axios";
import getCookie from "../CustomFunctions/GetCookie";

const client = axios.create({
  baseURL: process.env.API_PROD_URL,
  headers: {
    Accept: "application/json",
  },
});

const request = async ({ ...options }, router) => {
  client.defaults.headers.common.Authorization = `Bearer ${getCookie("uat")}`;
  try {
    const response = await client(options);
    // onSuccess Function
    return onSuccess(response);
  } catch (error) {
    // onError Function
    return onError(error);
  }
};

export default request;
Some Common solution if you do not run project successfully
  • Use Latest Version of node.js
  • Remove node_module , package-lock.json and .next file again do npm install
  • You can again download theme from themeforst and then again run
  • Then also if you don't solve issue you can generate a ticket.
  • Build Application

      • Build you application for host on server using below command:
      npm run build