Quick start
1. Setup the environment variables
MONGO_URI
- If you're using a local MongoDB instance, the URI may look like mongodb://localhost:27017/mydatabase, where mydatabase is the name of your database.
- Obtain the URI for your MongoDB database. This usually involves setting up a MongoDB instance either locally or on a cloud-based service.
- If you're using a cloud-based MongoDB service, follow the service's documentation to obtain the appropriate URI.
DOMAIN
- Determine the domain or URL where your front-end app will be hosted.
- Replace https://www.example.com with the actual domain or URL of your app.
- Make sure to include the protocol (http:// or https://) and exclude any trailing slashes.
Cloudinary Integration:
- Sign up for a Cloudinary account at https://cloudinary.com if you haven't already.
- Once logged in, go to your Cloudinary dashboard.
- Obtain the values for CLOUDINARY_PUBLISHABLE_KEY, CLOUDINARY_SECRET_KEY, and CLOUDINARY_CLOUD_NAME from the dashboard.
- These values are unique to your Cloudinary account and can be found in the account settings or API configuration section.
Stripe Integration:
- Sign up for a Stripe account at https://stripe.com if you haven't already.
- After logging in, go to the Stripe Dashboard.
- Obtain the values for STRIPE_PUBLISHABLE_KEY and STRIPE_SECRET_KEY from the dashboard.
- These values are specific to your Stripe account and can be found in the API settings or developers section.
EmailJS Integration:
- Sign up for an EmailJS account at https://www.emailjs.com if you haven't already.
- Once registered, go to the EmailJS dashboard.
- Create a service and template within EmailJS, which will provide you with the necessary IDs.
- Obtain the values for EMAILJS_SERVICE_ID, EMAILJS_TEMPLATE_ID, and EMAILJS_USER_ID from the EmailJS dashboard.
- These values are unique to your EmailJS account and can be found in the service and template settings.
SHIPPING_FEE:
- Decide on the default shipping fee or cost applied to orders during checkout.
- Specify the amount in the currency of your choice.
- Example: SHIPPING_FEE=50
BASE_CURRENCY:
- Determine the base currency used for pricing and transactions within your app.
- Use the standard three-letter currency code, such as USD for US dollars, EUR for euros, etc.
- Example: BASE_CURRENCY=USD
2. Installation
To install the required node_modules and start the server for your Next.js front-end app, follow these steps:
- Open your terminal or command prompt.
- Navigate to the root directory of your front-end app where the package.json file is located.
-
Run the following command to install the required dependencies:
npm install
This command will read the package.json file and install all the necessary packages defined in the dependencies section.
- Wait for the installation process to complete. It may take some time depending on the number of dependencies and your internet connection speed.
-
Once the installation is finished, you can start the server by
running the following command:
npm run dev
This command starts the development server using the scripts defined in the package.json file.
- Wait for the server to start. You should see logs in the terminal indicating that the server has started successfully. It will typically mention the port number where your app is running (e.g., http://localhost:3000).
- Open your web browser and enter the URL shown in the terminal (e.g., http://localhost:3000).
- Congratulations! Your front-end app should now be running, and you can begin testing and interacting with it.
Note: Make sure you have Node.js installed on your machine before executing the above steps. You can download and install Node.js from the official Node.js website (https://nodejs.org).