{"id":28377452,"url":"https://github.com/eldavido7/ecommerce-dashboard","last_synced_at":"2025-06-26T21:32:19.917Z","repository":{"id":293325703,"uuid":"983594050","full_name":"eldavido7/ecommerce-dashboard","owner":"eldavido7","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-15T12:01:41.000Z","size":1181,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-15T13:18:50.367Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://halaminherbal.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eldavido7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-14T16:02:35.000Z","updated_at":"2025-06-15T12:01:44.000Z","dependencies_parsed_at":"2025-06-15T13:18:36.764Z","dependency_job_id":"1a1bcd3f-3ec8-4aae-9aa6-dece0325da5c","html_url":"https://github.com/eldavido7/ecommerce-dashboard","commit_stats":null,"previous_names":["eldavido7/ecommerce-dashboard"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eldavido7/ecommerce-dashboard","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldavido7%2Fecommerce-dashboard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldavido7%2Fecommerce-dashboard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldavido7%2Fecommerce-dashboard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldavido7%2Fecommerce-dashboard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eldavido7","download_url":"https://codeload.github.com/eldavido7/ecommerce-dashboard/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldavido7%2Fecommerce-dashboard/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262145184,"owners_count":23265885,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-30T01:05:19.454Z","updated_at":"2025-06-26T21:32:19.911Z","avatar_url":"https://github.com/eldavido7.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🌿 Halamin Herbal – eCommerce Admin Dashboard \u0026 Storefront\n\nHalamin Herbal is a full-featured herbal products eCommerce system built with **Next.js**, **Prisma**, **PostgreSQL**, **Neon**, **Cloudinary**, and **Paystack**. It includes a powerful admin dashboard and a lightweight public storefront. Customers can place orders and receive real-time email updates as their order progresses.\n\n---\n\n## 🚀 Features\n\n### 🛒 Storefront\n- Public-facing store with all available products\n- Add-to-cart, checkout, and Paystack payment integration\n- Order confirmation with receipt\n- No user authentication needed – orders are tracked by customer input\n\n### 🧑‍💼 Admin Dashboard\n- Product management (CRUD with image uploads via Cloudinary)\n- Orders module with:\n  - Full CRUD support\n  - Product snapshot at the time of order\n  - Status updates: `pending` → `processing` → `shipped` → `delivered` / `cancelled`\n  - Email notifications sent to customer on every status change\n- Discount and gift code management\n- Inventory tracking and low stock alerts\n- Revenue analytics and charts\n- Shipping settings and admin user management\n- Secure admin authentication\n\n---\n\n## ⚙️ Technologies Used\n\n- **Next.js** – Fullstack framework\n- **Prisma** – ORM for PostgreSQL\n- **Neon** – Scalable PostgreSQL database\n- **Zustand** – Lightweight state management\n- **Cloudinary** – Image hosting and CDN\n- **Paystack** – Payment gateway integration\n- **NodeMailer** – Email notifications\n- **Tailwind CSS** – Styling\n\n---\n\n## 🛠️ Getting Started\n\n### 1. Clone the Repository\n\n```bash\ngit clone https://github.com/your-username/halamin-herbal.git\ncd halamin-herbal\n```\n\n### 2. Install Dependencies\n\n```bash\nnpm install\n```\n\n### 3. Set up Environment Variables\nCreate a .env file in the root with the following:\n```bash\nDATABASE_URL=your-neon-db-url\nCLOUDINARY_CLOUD_NAME=your-cloud-name\nCLOUDINARY_API_KEY=your-cloudinary-api-key\nCLOUDINARY_API_SECRET=your-cloudinary-api-secret\nPAYSTACK_SECRET_KEY=your-paystack-secret-key\nNEXT_PUBLIC_PAYSTACK_PUBLIC_KEY=your-paystack-public-key\nNEXT_PUBLIC_BASE_URL=http://localhost:3000/your-endpoint-url\nGMAIL_USER=your-gmail-address\nGMAIL_APP_PASSWORD=your-google-app-password\nSTORE_NAME=your-store-name\n```\nYou must create accounts on Neon (or local postgre sql instance), Cloudinary, Paystack, and generate a Gmail App Password to use these services.\n\n---\n\n### 🔐 How to Generate a Gmail App Password\n```bash\n1. **Enable 2-Step Verification**\n   - Go to [https://myaccount.google.com/security](https://myaccount.google.com/security)\n   - Under **\"Signing in to Google\"**, enable **2-Step Verification** if not already enabled.\n\n2. **Generate App Password**\n   - After enabling 2FA, go back to [https://myaccount.google.com/security](https://myaccount.google.com/security)\n   - Under **\"Signing in to Google\"**, click **App passwords**\n   - Select:\n     - App: **Mail**\n     - Device: **Other (Custom name)** → e.g., `HalaminMailer`\n   - Click **Generate**\n   - Copy the **16-character app password** shown (e.g., `abcd efgh ijkl mnop`)\n   - Use this value as `GMAIL_APP_PASSWORD` in your .env\n```\n\n### 4. Set Up the Database\n\n```bash\nnpx prisma generate\nnpx prisma db push\n```\nThis will create the necessary tables in your Neon PostgreSQL database.\n\n### 5. Start the Development Server\n\n```bash\nnpm run dev\n```\nVisit http://localhost:3000 to view the app locally.\n\n---\n\n## 👤 Admin User Setup (Important!)\n\nBefore logging into the admin dashboard, you need to manually create your first admin user.\n\n### Option 1: Directly in the Database\nUse a database GUI like **Neon**, **pgAdmin**, or **TablePlus** to insert a new user into the `User` table.\n\n- Make sure the password is **hashed** using **bcrypt** (10-digit salt)\n- You can generate the hash using a tool like https://bcrypt-generator.com or via Node.js:\n\n```bash\nconst bcrypt = require('bcrypt');\nbcrypt.hash('your-password', 10).then(console.log);\n```\n### Option 2: Use the API Endpoint\nMake a POST request (using postman or any tool like that) to:\n```bash\nPOST your-endpoint/api/settings/users or https://localhost:3000/api/settings/users\n```\nWith the following JSON body:\n```bash\n{\n  \"name\": \"Admin\",\n  \"email\": \"admin@example.com\",\n  \"password\": \"$2b$10$yourHashedPasswordHere\"\n}\n```\n❗ Do not send a plain-text password. The password must already be bcrypt-hashed before sending.\n\n---\n\n### 🖼 Image Uploads via Cloudinary\n- Admins can upload product images when creating or editing.\n- Images are uploaded to Cloudinary and served via CDN.\n- Products display their image on both the admin and public-facing sides.\n\n### 💳 Payments with Paystack\n- Checkout uses Paystack to collect payment.\n- After successful payment, the order is recorded in the backend.\n- Customers receive an email receipt and order confirmation.\n\n### 🛒 Storefront\n- Public-facing store with all available products\n- Add-to-cart, checkout, and Paystack payment integration\n- Order confirmation with receipt\n- No user authentication needed – orders are tracked by customer input\n\n### 📧 Email Notifications\n- When an order status is updated (e.g. shipped, delivered), the customer is notified by email.\n- Emails are sent via Gmail SMTP using NodeMailer and Google App Passwords.\n\n### 📊 Analytics Dashboard\n- View revenue, order counts, and top products\n- Analytics are based on real-time data from delivered orders\n\n### 🔐 Admin-Only Routes\n- Admin dashboard is protected with authentication\n- Admin users can manage products, discounts, inventory, shipping, and more\n\n### 🛍️ Storefront Pages\n- /store → Public-facing homepage with all products\n- /store/cart → Add to cart and complete checkout via Paystack\n\n### 📬 Order Flow Summary\n- Customer adds products to cart and completes payment\n- A new order is created upon successful Paystack transaction and the customer is emailed with a receipt.\n- Admin updates status as the order progresses\n- Customer is notified via email of each status update\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldavido7%2Fecommerce-dashboard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feldavido7%2Fecommerce-dashboard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldavido7%2Fecommerce-dashboard/lists"}