{"id":23769486,"url":"https://github.com/paxsenix0/example-express-swagger","last_synced_at":"2025-04-12T16:16:47.079Z","repository":{"id":269953611,"uuid":"908939830","full_name":"Paxsenix0/example-express-swagger","owner":"Paxsenix0","description":"An easy example how to make Rest API with Documentation Swagger UI.","archived":false,"fork":false,"pushed_at":"2025-03-02T08:38:09.000Z","size":147,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"initial","last_synced_at":"2025-04-12T16:16:20.999Z","etag":null,"topics":["api","api-rest","express","express-js","expressjs","nodejs","rest-api","restful-api","swagger","swagger-ui"],"latest_commit_sha":null,"homepage":"https://api.paxsenix.biz.id/docs","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Paxsenix0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2024-12-27T10:47:31.000Z","updated_at":"2025-03-07T20:17:44.000Z","dependencies_parsed_at":"2025-02-21T03:38:02.685Z","dependency_job_id":null,"html_url":"https://github.com/Paxsenix0/example-express-swagger","commit_stats":null,"previous_names":["paxsenix0/example-express-swagger"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Paxsenix0%2Fexample-express-swagger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Paxsenix0%2Fexample-express-swagger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Paxsenix0%2Fexample-express-swagger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Paxsenix0%2Fexample-express-swagger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Paxsenix0","download_url":"https://codeload.github.com/Paxsenix0/example-express-swagger/tar.gz/refs/heads/initial","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248594191,"owners_count":21130316,"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","api-rest","express","express-js","expressjs","nodejs","rest-api","restful-api","swagger","swagger-ui"],"created_at":"2025-01-01T02:21:26.618Z","updated_at":"2025-04-12T16:16:47.059Z","avatar_url":"https://github.com/Paxsenix0.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# example-express-swagger\nA Boilerplate for creating express.js APIs with Swagger documentation setup. this project makes it easy to document and test your API endpoints while providing a clean project structure and customization options.\n\n# Features\n\n- **express.js**: lightweight and flexible framework for building web APIs.\n\n- **swagger-ui**: auto-generated and interactive API documentation.\n\n- **mongodb support**: easily integrate with a mongodb database using DB_URI.\n\n- **vercel deployment**: one-click deployment to vercel for instant hosting.\n\n- **organized structure**: routes and configuration neatly organized for scalability.\n\n\n# Project structure\n```\nexample-express-swagger/\n├── config/  \n│   └── db.config.js         # connect mongodb\n├── middlewares/  \n│   └── rateLimit.middleware.js    # do checking ip address\n├── models/  \n│   └── ip.model.js          # Mongodb ip address scheme\n├── plugins/  \n│   ├── nova-ai.js           # examples of data\n│   ├── startnest.js           # examples of data\n│   └── index.js             # main entry point to handles data\n├── routes/  \n│   └── chat.route.js        # handles 'chat' related API endpoints\n├── services/  \n│   └── ip.service.js        # all functions to insert, check usage of ip address for rate limit.\n├── index.js                 # main app initialization  \n├── swagger.js               # swagger ui file  \n├── package.json             # npm dependencies and scripts  \n└── README.md                # project documentation (you’re here)\n```\n# Installation\n\n1. Clone the repo:\n```bash\ngit clone https://github.com/Paxsenix0/example-express-swagger.git  \ncd example-express-swagger\n```\n\n2. Install dependencies:\n```bash\nnpm install\n```\n\n3. Configure Environment variables:\ncreate a .env file in the root directory and add your mongodb uri:\n```bash\nDB_URI=mongodb+srv://\u003cusername\u003e:\u003cpassword\u003e@cluster.mongodb.net/\u003cdbname\u003e?retryWrites=true\u0026w=majority\n```\n\n4. Start the server:\n```bash\nnpm start\n```\n\n5. Open Swagger UI:\ngo to http://localhost:3000/docs in your browser to view your API documentation.\n\n\n# Vercel Deployment\nTo deploy this project to vercel:\n## 1-Click-Deploy\n[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FPaxsenix0%2Fexample-express-swagger\u0026env=DB_URI\u0026envDescription=DB_URI%20is%20needed%20for%20this%20for%20mongodb%20to%20be%20working%20fine\u0026envLink=https%3A%2F%2Fwww.mongodb.com%2F\u0026project-name=example-express-swagger\u0026repository-name=example-express-swagger\u0026redirect-url=https%3A%2F%2Fgithub.com%2FPaxsenix0%2Fexample-express-swagger)\n\n\n# Swagger Configuration\n\nSwagger Options are defined in index.js. Here's an overview of the configuration:\n```javascript\nconst swaggerOptions = {  \n  definition: {  \n    openapi: '3.0.0',  \n    info: {  \n      title: 'example-rest-api',  \n      version: '1.0.0',  \n      description: 'your description!',  \n      contact: {  \n        name: 'PaxSenix0',  \n        url: 'https://api.paxsenix.biz.id',  \n        email: 'alex24dzn@proton.me'  \n      },  \n      license: {  \n        name: 'MIT LICENSE',  \n        url: 'https://github.com/Paxsenix0/example-express-swagger/blob/initial/LICENSE'  \n      }  \n    },  \n    servers: [  \n      {  \n        url: 'https://example-express-swagger.vercel.app',  \n        description: 'BASE URL API'  \n      }  \n    ],  \n    tags: [  \n      { name: 'AI' }  \n    ]  \n  },  \n  apis: ['./routes/*.route.js'] // adjust based on route file naming  \n};\n```\n\n# License\n\nThis project is licensed under the MIT license. see [LICENSE](https://github.com/Paxsenix0/example-express-swagger/blob/initial/LICENSE) for details.\n\n# Contact\n\nTelegram: [@paxsenix0](https://t.me/paxsenix0)\n\nEmail: alex24dzn@proton.me\n\nMy Rest-API website: https://api.paxsenix.biz.id","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaxsenix0%2Fexample-express-swagger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaxsenix0%2Fexample-express-swagger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaxsenix0%2Fexample-express-swagger/lists"}