# MongoDB Integration Guide

To store user transactions, order details, and customer data efficiently, you can set up MongoDB, a NoSQL database known for scalability and flexibility.

## Get a MongoDB Connection URL and Set Up a Database

1. Go to MongoDB Atlas and sign up (or log in if you already have an account https://www.mongodb.com/).
2. Click 'Create a Cluster' and choose the free tier (Shared).
3. Select a cloud provider and region (closest to your users).
4. Click 'Create Cluster' (it may take a few minutes to set up).

# Create a Database & Collection

1. In the MongoDB Atlas Dashboard, go to Database Browse Collections.
2. Click 'Add My Own Data' and enter a Database Name and Collection Name (e.g., your product name).
3. Click Create.

## Get Your Connection URL

1. Go to Database Connect and choose 'Connect your application'.
2. Select 'Node.js' as the driver and choose the latest version.
3. Copy the provided connection string, which will look like this:
   
   `MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/database?retryWrites=true&w=majority`
   
   Replace Username → Your MongoDB username  
   Password → Your MongoDB password  
   Dbname → Your database name

## Store It in Your .env.local File

1. Add inside .env.local file in your Next.js project root  
2. `MONGODB_URI=mongodb+srv://yourUsername:yourPassword@cluster0.mongodb.net/yourDatabase?retryWrites=true&w=majority`  
3. Configure network access (IP whitelist)  
4. Get your connection string

## Test the API

Now MongoDB is fully set up and ready to use in your Next.js project! 🚀

```bash
npm run dev
```

# Supabase Integration Guide

## Setting Up Supabase Project

1. Visit supabase.com and sign up for an account
2. Click New Project and choose your organization
3. Set up your database password and choose a region

## Project Configuration

1. Go to Project Settings → API to find your credentials
2. Copy your Project URL and anon/public API key

```bash
# .env.local
SUPABASE_URL=your-project-url
SUPABASE_ANON_KEY=your-anon-key
```
