{"_id":"@denispro2006/duke-storage","name":"@denispro2006/duke-storage","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@denispro2006/duke-storage","version":"1.0.0","description":"Stateless file storage microservice for the Duke Messenger platform","main":"src/app.js","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/denispro2006/duke-storage.git"},"scripts":{"start":"node src/app.js","dev":"nodemon src/app.js","test":"jest --runInBand","test:unit":"jest tests/unit --runInBand","test:integration":"jest tests/integration --runInBand","lint":"eslint src/**/*.js"},"dependencies":{"express":"^4.18.2","multer":"^1.4.5-lts.1","uuid":"^9.0.0","pg":"^8.11.3","minio":"^7.1.3","file-type":"^16.5.4","jsonwebtoken":"^9.0.2","pino":"^8.17.2","pino-pretty":"^10.3.1","dotenv":"^16.3.1","cors":"^2.8.5","helmet":"^7.1.0","axios":"^1.6.5"},"devDependencies":{"nodemon":"^3.0.2","jest":"^29.7.0","supertest":"^6.3.4","eslint":"^8.56.0"},"engines":{"node":">=20.0.0"},"license":"MIT","_id":"@denispro2006/duke-storage@1.0.0","gitHead":"67b32089ace424654fed3578e685efea2ccce793","bugs":{"url":"https://github.com/denispro2006/duke-storage/issues"},"homepage":"https://github.com/denispro2006/duke-storage#readme","_nodeVersion":"20.20.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-4bQywJ8l1hmOLascTUChJu7cx/oe/5J3oa0USO48WenIAXRjxGbfa7Y8gU3hECzI3YSad29o+RYJIxPkof6GEQ==","shasum":"ccfd43cfe53fb17f24d1093576423e914c0e9bba","tarball":"https://registry.npmjs.org/@denispro2006/duke-storage/-/duke-storage-1.0.0.tgz","fileCount":24,"unpackedSize":29239,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDcIpLIJOlgFEptu9Nzbgf2a3tCRxmlsQAXxQOngJmRZQIgddqMysMvk1bEocGnCUxQ3XkW5yuK9QiWRkk/IagD0is="}]},"_npmUser":{"name":"denispro2006","email":"ntvelksina5@gmail.com"},"directories":{},"maintainers":[{"name":"denispro2006","email":"ntvelksina5@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/duke-storage_1.0.0_1778130450331_0.058737612171195774"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-07T05:07:30.198Z","1.0.0":"2026-05-07T05:07:30.471Z","modified":"2026-05-07T05:07:30.682Z"},"maintainers":[{"name":"denispro2006","email":"ntvelksina5@gmail.com"}],"description":"Stateless file storage microservice for the Duke Messenger platform","homepage":"https://github.com/denispro2006/duke-storage#readme","repository":{"type":"git","url":"git+https://github.com/denispro2006/duke-storage.git"},"bugs":{"url":"https://github.com/denispro2006/duke-storage/issues"},"license":"MIT","readme":"# duke-storage\n\nStateless file storage microservice for the [Duke Messenger](https://github.com/duke-messenger) platform. Abstracts over multiple storage backends behind a single REST API with file validation, metadata persistence, and streaming delivery.\n\n## Quick Start\n\n```bash\n# 1. Install dependencies\ncd duke-storage\nnpm install\n\n# 2. Configure environment\ncp .env.example .env\n# Edit .env — at minimum set STORAGE_BACKEND and DATABASE_URL\n\n# 3. Run database migration (if using PostgreSQL)\npsql $DATABASE_URL -f docs/migration.sql\n\n# 4. Start the service\nnpm run dev\n```\n\nService starts on `http://localhost:3001` by default.\n\n## Docker Compose\n\n```bash\ncp .env.example .env\ndocker compose up -d\ncurl http://localhost:3001/healthz\n```\n\n## Architecture\n\n```\nClient\n  │ HTTP REST\n  ▼\nAPI Layer (Express + multer)\n  │ Auth middleware → Validation → Controller\n  ▼\nStorage Adapter (StorageProvider interface)\n  ├── LocalStorage  (dev / single-node)\n  └── MinioStorage  (production / multi-node)\n\nMetadata Store (PostgreSQL)\n```\n\n## API\n\n| Method | Path | Description |\n|--------|------|-------------|\n| `POST` | `/upload` | Upload a file (multipart/form-data) |\n| `GET` | `/files/:id/:filename` | Download / stream a file |\n| `GET` | `/files/:id/meta` | Get file metadata |\n| `DELETE` | `/files/:id` | Delete a file |\n| `GET` | `/buckets/:bucket/files` | List files in a bucket |\n| `GET` | `/healthz` | Health check (no auth) |\n\nSee [docs/api.md](docs/api.md) for the full reference.\n\n## Storage Backends\n\n| Backend | `STORAGE_BACKEND` | Use case |\n|---------|------------------|----------|\n| Local Disk | `local` | Development, single-node |\n| MinIO | `minio` | Production, multi-node |\n\n## Environment Variables\n\nCopy `.env.example` to `.env`. Key variables:\n\n```\nSTORAGE_BACKEND=local          # or minio\nDATABASE_URL=postgres://...    # PostgreSQL connection string\nJWT_SECRET=your-secret         # for token verification\nMAX_FILE_SIZE=52428800         # 50 MB default\nALLOWED_MIME_TYPES=image/,video/,audio/,application/pdf\n```\n\n## Scripts\n\n```bash\nnpm start          # Production\nnpm run dev        # Hot reload (nodemon)\nnpm test           # All tests\nnpm run test:unit  # Unit tests only\n```\n\n## License\n\nMIT © duke-messenger contributors\n","readmeFilename":"README.md","_rev":"1-6b4c3928a92fdef4e312eacbaa1488fb"}