integrate_minio_seeding_and_docs

This commit is contained in:
kenilkb 2026-07-09 17:39:02 +05:30
parent a87fd01ec8
commit b7efb22ed1
6 changed files with 70 additions and 23 deletions

View File

@ -7,7 +7,7 @@ async function migrateLocalUploads() {
console.log('[Migration] Starting local uploads migration to MinIO...'); console.log('[Migration] Starting local uploads migration to MinIO...');
await ensureBucketExists(); await ensureBucketExists();
const localUploadsDir = path.join(__dirname, '../../uploads'); const localUploadsDir = path.join(__dirname, '../../minio-seed');
if (!fs.existsSync(localUploadsDir)) { if (!fs.existsSync(localUploadsDir)) {
console.log('[Migration] No local uploads directory found.'); console.log('[Migration] No local uploads directory found.');
return; return;

View File

@ -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) ## 🛠️ Technology Stack
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) * **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 ### Step 2: Start Frontend App
{ From the project root:
"$schema": "./node_modules/oxlint/configuration_schema.json", ```bash
"plugins": ["react", "typescript", "oxc"], ./run-frontend.sh
"options": { ```
"typeAware": true This script will resolve dependencies, free port `5173` (if in use), and launch the Vite development server on [http://localhost:5173](http://localhost:5173).
},
"rules": { ---
"react/rules-of-hooks": "error",
"react/only-export-components": ["warn", { "allowConstantExport": true }] ## 📂 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` |

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 KiB

Binary file not shown.

Binary file not shown.

View File

@ -76,6 +76,9 @@ npx prisma db push
info "Running database seeding..." info "Running database seeding..."
npx ts-node seed.ts 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 # Check if port 5000 is occupied and free it
if lsof -i :5000 &> /dev/null; then if lsof -i :5000 &> /dev/null; then
PORT_PID=$(lsof -t -i :5000) PORT_PID=$(lsof -t -i :5000)