{"id":15105254,"url":"https://github.com/zaber-dev/MVC-Python","last_synced_at":"2025-03-28T07:32:02.826Z","repository":{"id":257273273,"uuid":"857787644","full_name":"zaber-dev/MVC-Python","owner":"zaber-dev","description":"Flask-based web application following the MVC (Model-View-Controller) structure, with the added feature of integrating a Discord bot. The structure is flexible, allowing you to expand it for more parallel tasks, or easily adjust it to run a single task as needed.","archived":false,"fork":false,"pushed_at":"2024-09-16T20:15:12.000Z","size":65,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-08T18:47:47.580Z","etag":null,"topics":["discord","discord-bot","disnake","disnake-template","flask","flask-application","flask-mvc","flask-mvc-structure","flask-mvc-template","mvc","mvc-architecture","mvc-framework","mvc-python","python","python-mvc","python3","sqlalchemy"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zaber-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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-09-15T16:01:50.000Z","updated_at":"2024-09-16T20:15:16.000Z","dependencies_parsed_at":"2024-10-31T04:41:48.616Z","dependency_job_id":null,"html_url":"https://github.com/zaber-dev/MVC-Python","commit_stats":{"total_commits":23,"total_committers":2,"mean_commits":11.5,"dds":"0.30434782608695654","last_synced_commit":"a09d464a5ba579056e509c853dfdb118b0cdba3f"},"previous_names":["mahedizaber51/mvc-python","zaber-dev/mvc-python"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaber-dev%2FMVC-Python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaber-dev%2FMVC-Python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaber-dev%2FMVC-Python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaber-dev%2FMVC-Python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zaber-dev","download_url":"https://codeload.github.com/zaber-dev/MVC-Python/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245440592,"owners_count":20615633,"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":["discord","discord-bot","disnake","disnake-template","flask","flask-application","flask-mvc","flask-mvc-structure","flask-mvc-template","mvc","mvc-architecture","mvc-framework","mvc-python","python","python-mvc","python3","sqlalchemy"],"created_at":"2024-09-25T20:22:14.170Z","updated_at":"2025-03-28T07:32:02.821Z","avatar_url":"https://github.com/zaber-dev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flask MVC Structure with Discord Integration\n\nWelcome to the **Flask MVC Structure with Discord Integration**! This project is primarily a **Flask-based web application** following the MVC (Model-View-Controller) structure, with the added feature of integrating a **Discord bot** using **Disnake**. This setup allows you to build a web app while also having a Discord bot running in parallel, enabling additional functionality. The structure is flexible, allowing you to expand it for more parallel tasks, or easily adjust it to run a single task as needed.\n\n\n\n## Project Structure\n\n```bash\n.\n├── app\n│   ├── Actions             # Utility functions (pagination, embeds, webhook handling, etc.)\n│   ├── Commands            # Discord command handling\n│   │   ├── Context         # Traditional Discord commands\n│   │   └── Slash           # Slash commands for Discord\n│   ├── Controllers         # Controller logic for Flask and Discord\n│   │   ├── Flask           # Controllers specific to Flask web app\n│   │   └── Discord         # Controllers for Discord bot\n│   ├── Models              # Data models for the application\n│   └── Views               # Dynamic Flask views/templates structures\n├── config\n│   └── boot.py             # Main entry point to boot up the program (Flask + Discord)\n├── database\n│   └── db.py               # Database interactions (abstraction layer)\n├── resources                # Static and template files for Flask\n│   ├── css                 # CSS files\n│   ├── js                  # JavaScript files\n│   └── views               # HTML templates\n├── routes\n│   ├── api.py              # Routes for API endpoints\n│   └── web.py              # Routes for web pages\n├── storage                  # User file storage (uploads, etc.)\n├── vendor                   # Placeholder for third-party integrations (collaborations welcome)\n├── requirements.txt         # Python dependencies\n├── Dockerfile               # Docker containerization file\n└── .env                     # Environment configuration variables\n```\n\n## Features Implemented\n\n### Flask\n- **MVC Structure**: Organized codebase that follows the MVC pattern for better separation of concerns:\n  - **Models** handle data.\n  - **Views** are rendered by Flask, found in `resources/views`.\n  - **Controllers** handle business logic for web and API routes.\n- **Routing**: \n  - API routes are defined in `routes/api.py`.\n  - Web routes are in `routes/web.py`.\n- **Database Abstraction**: Easy-to-extend database layer (`database/db.py`) for managing models.\n- **Templates \u0026 Static Files**: Resources such as HTML, CSS, and JavaScript are stored in `resources/`.\n\n### Discord Bot (Using Discord.py)\n- **Commands**: \n  - Traditional text-based Discord commands in `app/Commands/Context`.\n  - Slash commands in `app/Commands/Slash`.\n- **Parallel Execution**: The Discord bot runs alongside the Flask application for seamless interaction between web and Discord functionalities.\n- **Utility Actions**: Functions like pagination, embeds, and webhook handling in `app/Actions`.\n\n### Docker\n- **Containerization**: Provided `Dockerfile` allows you to run the entire application in a Docker container, simplifying the setup process.\n\n## What's Next?\n\n### To-Do\n- [ ] **Vendor Integrations**: Open for contributions to implement third-party integrations or plugins within the `vendor/` directory.\n- [ ] **Authentication**: Integrate authentication (OAuth or token-based) for the web app and APIs.\n- [ ] **File Management**: Add advanced handling for user uploads within the `storage/` folder.\n- [ ] **Error Handling \u0026 Logging**: Enhance error handling across both Flask and Discord components, with proper logging.\n\n## Collaboration\n\nContributions are welcome! If you'd like to collaborate, feel free to fork this repository and submit a pull request. Potential areas of contribution include:\n- Implementing additional Flask features.\n- Expanding Discord bot functionalities (commands, event listeners, etc.).\n- Integrating new third-party APIs or services.\n- Improving the MVC structures\n  \nCheck out the **issues** section for current needs, or suggest your own enhancements!\n\n## Getting Started\n\n1. **Clone the Repository**:\n   ```bash\n   git clone https://github.com/MahediZaber51/MVC-Python.git\n   cd MVC-Python\n   ```\n\n2. **Install Dependencies**:\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n3. **Set up Environment Variables**:\n   Create a `.env` file in the root directory with the required environment variables for Flask and Discord (check the `.env-example` file).\n\n4. **Run the Application**:\n   ```bash\n   python config/boot.py\n   ```\n\n5. **Run in Docker**:\n   ```bash\n   docker build -t flask-discord-app .\n   docker run -d -p 5000:5000 flask-discord-app\n   ```\n\n## License\n\nThis project is licensed under the GNU General Public License v3.0.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzaber-dev%2FMVC-Python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzaber-dev%2FMVC-Python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzaber-dev%2FMVC-Python/lists"}