diff --git a/Channel-Backend/src/seed-minio.ts b/Channel-Backend/src/seed-minio.ts index 20125aa..b5655a0 100644 --- a/Channel-Backend/src/seed-minio.ts +++ b/Channel-Backend/src/seed-minio.ts @@ -7,7 +7,7 @@ async function migrateLocalUploads() { console.log('[Migration] Starting local uploads migration to MinIO...'); await ensureBucketExists(); - const localUploadsDir = path.join(__dirname, '../../uploads'); + const localUploadsDir = path.join(__dirname, '../../minio-seed'); if (!fs.existsSync(localUploadsDir)) { console.log('[Migration] No local uploads directory found.'); return; diff --git a/README.md b/README.md index d6af7e3..1c0ff75 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,76 @@ -# React + TypeScript + Vite +# Tech4Biz Channel Partner Onboarding & Secure Asset Management -This template provides a minimal setup to get React working in Vite with HMR and some Oxlint rules. +An enterprise-grade, secure, multi-tenant portal designed for onboarding channel partners, managing digital assets, and orchestrating NDA/MSA legal workflows. -Currently, two official plugins are available: +--- -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs) -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) +## 🛠️ Technology Stack +* **Frontend**: React (Vite, TypeScript, Tailwind CSS, Axios) +* **Backend**: Node.js (Express, TypeScript, Prisma ORM, JWT, Helmet) +* **Databases**: PostgreSQL (Relational metadata storage) +* **Object Storage**: MinIO (Private, S3-compatible asset storage container) -## React Compiler +--- -The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation). +## 🚀 Quick Start (Development) -## Expanding the Oxlint configuration +### Prerequisites +* Ensure **Docker** and **Node.js** are installed and running. +* The startup scripts automatically detect and terminate any processes occupying backend/frontend ports to prevent crash loops. -If you are developing a production application, we recommend enabling type-aware lint rules by installing `oxlint-tsgolint` and editing `.oxlintrc.json`: +### Step 1: Start Backend, Database, & Storage +From the project root: +```bash +./run-backend.sh +``` +This script will: +1. Spin up the Postgres and MinIO containers. +2. Generate environment variables. +3. Align the database schemas via Prisma. +4. Run database seeders (Admin/Partner mock accounts). +5. **Automatically seed the MinIO bucket with static documents.** +6. Free port `5000` (if in use) and launch the backend server. -```json -{ - "$schema": "./node_modules/oxlint/configuration_schema.json", - "plugins": ["react", "typescript", "oxc"], - "options": { - "typeAware": true - }, - "rules": { - "react/rules-of-hooks": "error", - "react/only-export-components": ["warn", { "allowConstantExport": true }] - } -} +### Step 2: Start Frontend App +From the project root: +```bash +./run-frontend.sh +``` +This script will resolve dependencies, free port `5173` (if in use), and launch the Vite development server on [http://localhost:5173](http://localhost:5173). + +--- + +## 📂 MinIO Seeding & Data Transfer + +### How Asset Seeding Works +To ensure that digital assets (like product guides and NDA templates) are transferred when cloning the repository: +1. Standard assets are committed to the **`minio-seed/`** directory in the repository root (not ignored by Git). +2. During server start (via `./run-backend.sh`), the backend runs the S3 seeder command: + ```bash + npx ts-node src/seed-minio.ts + ``` +3. The script initializes the `secure-assets` bucket in MinIO and uploads any files found in the local `/minio-seed/` folder to the bucket, preserving exact filenames, MIME types, and sizes. + +### Manual Seeding / Restore Command +If you ever reset your MinIO volume and need to re-populate the S3 bucket with the committed repository assets, run the following commands: +```bash +cd Channel-Backend +npx ts-node src/seed-minio.ts ``` -See the [Oxlint rules documentation](https://oxc.rs/docs/guide/usage/linter/rules) for the full list of rules and categories. +--- + +## 🔑 Default Credentials & Admin Ports + +### Web Interfaces +* **Frontend Dashboard**: [http://localhost:5173](http://localhost:5173) +* **MinIO Console Dashboard**: [http://localhost:9090](http://localhost:9090) + +### Login Credentials +| System | User/ID | Password/Secret | +| :--- | :--- | :--- | +| **Admin Account** | `admin@tech4biz.com` | `Password123` | +| **Partner (Approved)** | `active-partner@partner.com` | `Password123` | +| **Partner (Pending NDA)** | `pending-onboarding@partner.com` | `Password123` | +| **MinIO Console** | `minio_admin` | `minio_password_2026` | +| **JWT Secrets** | *Auto-generated in `.env`* | `super-secret-jwt-key-2026-world-class` | diff --git a/minio-seed/1783584634114-350366184.png b/minio-seed/1783584634114-350366184.png new file mode 100644 index 0000000..fc3431d Binary files /dev/null and b/minio-seed/1783584634114-350366184.png differ diff --git a/minio-seed/1783584835913-404486304.zip b/minio-seed/1783584835913-404486304.zip new file mode 100644 index 0000000..98eab2a Binary files /dev/null and b/minio-seed/1783584835913-404486304.zip differ diff --git a/minio-seed/1783587276072-982233853.pdf b/minio-seed/1783587276072-982233853.pdf new file mode 100644 index 0000000..cbbab4d Binary files /dev/null and b/minio-seed/1783587276072-982233853.pdf differ diff --git a/run-backend.sh b/run-backend.sh index b70f3c3..a55ddf3 100755 --- a/run-backend.sh +++ b/run-backend.sh @@ -76,6 +76,9 @@ npx prisma db push info "Running database seeding..." npx ts-node seed.ts +info "Running MinIO storage seeding..." +npx ts-node src/seed-minio.ts + # Check if port 5000 is occupied and free it if lsof -i :5000 &> /dev/null; then PORT_PID=$(lsof -t -i :5000)