{"id":27388562,"url":"https://github.com/haseebnqureshi/minapi","last_synced_at":"2026-01-22T11:32:43.335Z","repository":{"id":226890397,"uuid":"769907870","full_name":"haseebnqureshi/minAPI","owner":"haseebnqureshi","description":"Minimum viable API w/ authentication and permissions, CRUD and resource management","archived":false,"fork":false,"pushed_at":"2025-04-11T17:46:02.000Z","size":428,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-11T18:47:40.537Z","etag":null,"topics":["api","auth","backend","crud","express","framework","jwt","mongodb","mvp","rest"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/haseebnqureshi.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":"2024-03-10T12:04:51.000Z","updated_at":"2025-04-11T17:46:06.000Z","dependencies_parsed_at":"2024-03-10T13:28:51.678Z","dependency_job_id":"b188a3fd-88fb-4c07-996a-8f8e1e226493","html_url":"https://github.com/haseebnqureshi/minAPI","commit_stats":{"total_commits":78,"total_committers":1,"mean_commits":78.0,"dds":0.0,"last_synced_commit":"5e2852ba09e51f558b5c3a262ad05905ea235004"},"previous_names":["avenuedigital/minapi","avenuedigital/baseapi","haseebnqureshi/minapi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haseebnqureshi%2FminAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haseebnqureshi%2FminAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haseebnqureshi%2FminAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haseebnqureshi%2FminAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haseebnqureshi","download_url":"https://codeload.github.com/haseebnqureshi/minAPI/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248761026,"owners_count":21157476,"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":["api","auth","backend","crud","express","framework","jwt","mongodb","mvp","rest"],"created_at":"2025-04-13T18:33:55.909Z","updated_at":"2026-01-22T11:32:43.293Z","avatar_url":"https://github.com/haseebnqureshi.png","language":"JavaScript","readme":"# MinAPI\n\nMinAPI is a comprehensive API framework built on Express and MongoDB that provides a minimum viable API setup with built-in authentication, permissions, CRUD operations, and resource management.\n\n## Features\n\n- 🔐 Built-in Authentication \u0026 JWT\n- 👥 User Management \u0026 Permissions\n- 📝 CRUD Operations\n- 📨 Email Notifications (Postmark integration)\n- 🗄️ MongoDB Integration\n- 🖼️ File Management \u0026 Image Processing\n- 🎙️ Audio-to-Text Transcription\n- 🔄 File Format Conversions\n- 🔒 Security Features\n- 📱 Phone Number Validation\n- ☁️ AWS S3 Integration\n\n## Installation\n\n```bash\nnpm install minapi\n# or\nyarn add minapi\n```\n\n### System Requirements\n\nThe following system dependencies are required:\n\n#### LibreOffice (for document processing and text-to-image conversion)\n```bash\n# Ubuntu\nsudo apt install libreoffice\n\n# Mac\nbrew install libreoffice\n```\n\n#### Ghostscript (for PDF processing)\n```bash\n# Mac\nbrew install ghostscript\n\n# Ubuntu\nsudo apt-get install ghostscript\n```\n\n#### Google Cloud SDK (for audio transcription)\nTo use the audio transcription features, you'll need Google Cloud credentials:\n\n1. Create a Google Cloud project and enable the Speech-to-Text API\n2. Create a service account with access to the Speech-to-Text API\n3. Download the service account key file (JSON)\n\nThese need to be installed before running `npm install` or `yarn`.\n\n## Quick Start\n\n1. Create a new project and install MinAPI:\n```bash\nmkdir my-api\ncd my-api\nnpm init -y\nnpm install minapi\n```\n\n2. Create a configuration file (`minapi.config.js`):\n```javascript\nmodule.exports = (API) =\u003e {\n  return {\n    mongodb: {\n      uri: 'your-mongodb-uri',\n    },\n    jwt: {\n      secret: 'your-jwt-secret',\n    },\n    // For audio transcription\n    transcription: {\n      enabled: true,\n      provider: '@google/transcription',\n    },\n    providers: {\n      '@google/transcription': {\n        keyFilename: '/path/to/your-google-credentials.json',\n      },\n    },\n    // Add other configurations as needed\n  }\n}\n```\n\n3. Create your main file:\n```javascript\nconst MinAPI = require('minapi');\n\nconst api = new MinAPI({\n  config: require('./minapi.config.js')\n});\n\napi.start();\n```\n\n## Configuration\n\nMinAPI is configured through a `minapi.config.js` file in your project root. Here's a complete configuration reference:\n\n```javascript\nmodule.exports = (API) =\u003e {\n  return {\n    // API Name\n    name: 'Your API Name',\n\n    // Authentication Configuration\n    auth: {\n      // JWT configuration\n      jwt: {\n        expirations: {\n          auth: '7d',    // Authentication token expiration\n          verify: '24h', // Verification token expiration\n          reset: '1h'    // Password reset token expiration\n        }\n      }\n    },\n\n    // Database Models Configuration\n    models: [\n      {\n        _name: 'user',           // Model name\n        _label: 'Users',         // Display label\n        _collection: 'users',    // MongoDB collection name\n        _values: {\n          // Define model fields with their types and CRUD permissions\n          email: ['string', 'c,r,u'],\n          password_hash: ['string', 'c,r'],\n          email_verified: ['boolean', 'c,r,u'],\n          created_at: ['date', 'r'],\n          updated_at: ['date', 'r']\n        }\n      }\n    ],\n\n    // Important: When referencing models in foreign key relationships, always use the\n    // `_collection` name as the prefix for the foreign key field. For example, if a model\n    // has `_collection: 'users'`, other models should reference it as `users_id`, not\n    // `UserId` or `User_id`.\n\n    // Routes Configuration\n    routes: () =\u003e [\n      {\n        _id: '/users(user)',  // Route pattern\n        _create: {\n          allow: true         // Permission rules\n        },\n        _read: {\n          allow: true,\n          where: '_id'        // URL parameter mapping\n        },\n        _update: {\n          allow: '@_user._id=@user._id'  // Permission rule example\n        },\n        _delete: {\n          allow: false\n        }\n      }\n    ],\n\n    // Notification Configuration\n    notifications: {\n      email: {\n        provider: 'postmark',\n        from: 'noreply@yourdomain.com',\n        templates: {\n          welcomeEmail: 'template-id',\n          passwordReset: 'template-id',\n          emailVerification: 'template-id'\n        }\n      }\n    },\n\n    // File Storage Configuration\n    files: {\n      storage: {\n        provider: 's3',    // 's3' or 'local'\n        s3: {\n          bucket: process.env.AWS_BUCKET,\n          region: process.env.AWS_REGION\n        },\n        local: {\n          uploadDir: './uploads'\n        }\n      }\n    }\n  }\n}\n```\n\n### Environment Variables\n\nRequired environment variables:\n\n```bash\n# Server\nPORT=3000\nNODE_ENV=development\n\n# MongoDB\nMONGODB_URI=mongodb://localhost:27017/your-database\nMONGODB_DATABASE=your-database-name\n\n# Authentication\nJWT_SECRET=your-secure-jwt-secret\n\n# AWS S3 (if using S3 storage)\nAWS_ACCESS_KEY_ID=your-access-key\nAWS_SECRET_ACCESS_KEY=your-secret-key\nAWS_REGION=your-region\nAWS_BUCKET=your-bucket-name\n\n# Email (if using Postmark)\nPOSTMARK_SERVER_TOKEN=your-postmark-token\n\n# Application\nAPP_NAME=Your App Name\nAPP_URL_VERIFY=https://your-app.com/verify/:token\nAPP_AUTHOR=Your Name\nAPP_AUTHOR_EMAIL=your@email.com\n```\n\n### Permission Rules\n\nThe `allow` property in routes supports complex permission rules:\n\n```javascript\n// Basic permission\nallow: true  // Allow all\nallow: false // Deny all\n\n// Compare values\nallow: '@_user._id=@user._id'  // Current user matches resource user\n\n// Array membership\nallow: 'admin=in=@_user.roles'  // User has admin role\n\n// Logical operations\nallow: {\n  and: [\n    '@_user._id=@user._id',\n    'admin=in=@_user.roles'\n  ]\n}\nallow: {\n  or: [\n    '@_user._id=@user._id',\n    'admin=in=@_user.roles'\n  ]\n}\n```\n\n## Features in Detail\n\n### Authentication\n- JWT-based authentication\n- Password hashing with bcrypt\n- Two-factor authentication support\n- Password reset functionality\n- Email verification\n\n### File Management\n- Image processing with Sharp\n- AWS S3 integration for file storage\n- Document processing capabilities\n- Text-to-image conversion\n- Audio transcription to text\n\n### Notifications\n- Email notifications via Postmark\n- Customizable email templates\n\n### Database\n- MongoDB integration\n- CRUD operation helpers\n- Query builders\n- Data validation\n\n### File Conversion Capabilities\n\nMinAPI provides robust file conversion capabilities:\n\n| From | To | Provider |\n|------|-----|---------|\n| Documents (.doc, .docx, etc.) | PDF | LibreOffice |\n| PDF | PNG images | Sharp |\n| Images | Optimized PNG | Sharp |\n| Audio files (.mp3, .wav, etc.) | Text (.txt) | Google Transcription |\n| Text (.txt) | Image (.png) | LibreOffice |\n\n#### Converting Audio to Text\n\nWith Google Cloud Speech-to-Text integration, MinAPI can transcribe audio files:\n\n```javascript\n// Example: Convert an audio file to text\nconst result = await API.Files.convertFile({\n  inType: '.mp3', \n  outType: '.txt',\n  inPath: '/path/to/audio.mp3',\n  outPath: '/output/directory'\n});\n```\n\n#### Converting Text to Images\n\nConvert plain text files to PNG images:\n\n```javascript\n// Example: Convert a text file to an image\nconst result = await API.Files.convertFile({\n  inType: '.txt', \n  outType: '.png',\n  inPath: '/path/to/text.txt',\n  outPath: '/output/directory'\n});\n```\n\n## API Reference\n\n[Documentation to be added]\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nMIT © [Haseeb Qureshi (HQ)](https://github.com/avenuedigital/MinAPI)\n\n## Support\n\nFor issues and feature requests, please use the [GitHub issues page](https://github.com/avenuedigital/MinAPI/issues).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaseebnqureshi%2Fminapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaseebnqureshi%2Fminapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaseebnqureshi%2Fminapi/lists"}