{"id":23670094,"url":"https://github.com/manuelalejandrojimeneztorres/surveyhub-server","last_synced_at":"2026-04-07T22:32:17.826Z","repository":{"id":270146670,"uuid":"904819506","full_name":"manuelalejandrojimeneztorres/surveyhub-server","owner":"manuelalejandrojimeneztorres","description":"RESTful API built with Node.js, Express.js, Sequelize, and MySQL. Provides secure data management, JWT-based authentication, role-based access control, and seamless integration with SurveyHub applications.","archived":false,"fork":false,"pushed_at":"2025-02-22T18:36:11.000Z","size":201,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-21T04:09:20.395Z","etag":null,"topics":["expressjs","jwt","mysql","nodejs","restful-api","sequelize"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/manuelalejandrojimeneztorres.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","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-12-17T16:00:48.000Z","updated_at":"2025-02-22T18:46:14.000Z","dependencies_parsed_at":"2025-01-17T21:31:20.579Z","dependency_job_id":null,"html_url":"https://github.com/manuelalejandrojimeneztorres/surveyhub-server","commit_stats":null,"previous_names":["manuelalejandrojimeneztorres/surveyhub-server"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/manuelalejandrojimeneztorres/surveyhub-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manuelalejandrojimeneztorres%2Fsurveyhub-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manuelalejandrojimeneztorres%2Fsurveyhub-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manuelalejandrojimeneztorres%2Fsurveyhub-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manuelalejandrojimeneztorres%2Fsurveyhub-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manuelalejandrojimeneztorres","download_url":"https://codeload.github.com/manuelalejandrojimeneztorres/surveyhub-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manuelalejandrojimeneztorres%2Fsurveyhub-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31532291,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"ssl_error","status_checked_at":"2026-04-07T16:28:06.951Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["expressjs","jwt","mysql","nodejs","restful-api","sequelize"],"created_at":"2024-12-29T09:30:24.916Z","updated_at":"2026-04-07T22:32:17.798Z","avatar_url":"https://github.com/manuelalejandrojimeneztorres.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SurveyHub Backend (Server)\n\n![Node.js](https://img.shields.io/badge/Node.js-20.17.0-brightgreen?style=for-the-badge\u0026logo=node.js)\n![Express.js](https://img.shields.io/badge/Express.js-4.21.0-lightgrey?style=for-the-badge\u0026logo=express)\n![Sequelize](https://img.shields.io/badge/Sequelize-6.37.4-blue?style=for-the-badge\u0026logo=sequelize)\n![MySQL](https://img.shields.io/badge/MySQL-8.x-orange?style=for-the-badge\u0026logo=mysql)\n![JWT](https://img.shields.io/badge/JWT-Security-critical?style=for-the-badge\u0026logo=jsonwebtokens)\n![License](https://img.shields.io/badge/License-Apache%202.0-blue?style=for-the-badge)\n![Build Status](https://img.shields.io/github/actions/workflow/status/manuelalejandrojimeneztorres/surveyhub-server/backend-ci.yml?style=for-the-badge)\n![Coverage](https://img.shields.io/codecov/c/github/manuelalejandrojimeneztorres/surveyhub-server?style=for-the-badge)\n![Dependencies](https://img.shields.io/badge/Dependencies-Up%20to%20date-brightgreen?style=for-the-badge)\n\n## Description\n\nThe **SurveyHub Backend** is a robust, scalable, and enterprise-grade server-side application designed to support comprehensive online survey management. Built using **Node.js** and **Express.js**, this backend implements a secure, efficient, and extensible RESTful API that integrates seamlessly with the **SurveyHub Mobile Application** and **MySQL database**. It serves as the central hub for managing survey data, enforcing business logic, and ensuring secure user interactions.\n\n---\n\n## Table of Contents\n\n1. [Key Features](#key-features)\n2. [Architecture Overview](#architecture-overview)\n3. [Prerequisites](#prerequisites)\n4. [Installation](#installation)\n   - [Project Setup](#project-setup)\n   - [Environment Configuration](#environment-configuration)\n   - [Database Setup](#database-setup)\n   - [Start the Server](#start-the-server)\n5. [Technologies and Tools Used](#technologies-and-tools-used)\n6. [Dependencies](#dependencies)\n7. [Troubleshooting](#troubleshooting)\n8. [Contributing Guidelines](#contributing-guidelines)\n9. [Support](#support)\n10. [License](#license)\n11. [Acknowledgments](#acknowledgments)\n\n---\n\n## Key Features\n\n- **RESTful API**: Robust endpoints for managing surveys, users, and roles.\n- **Role-Based Access Control (RBAC)**: Granular permissions based on user roles (System Administrator, Survey Manager, and Respondent).\n- **Authentication**: Secure user authentication using **JWT**.\n- **Data Validation**: Comprehensive validation for data integrity and consistency.\n- **Scalability**: Designed for horizontal and vertical scaling.\n- **File Uploads**: Secure profile picture uploads using **Multer**.\n- **Database Management**: Seamless integration with **MySQL**, leveraging **Sequelize ORM**.\n\n[🔼 Back to Top](#table-of-contents)\n\n---\n\n## Architecture Overview\n\nThe SurveyHub Backend follows a modular architecture, ensuring maintainability and scalability. Key components include:\n\n- **Layered Architecture**: Combines the **Model-View-Controller (MVC)** pattern with middleware to ensure modularity, maintainability, and scalability.\n- **Database Integration**: Utilizes **Sequelize ORM** for robust schema definitions, efficient data operations, and relationship management.\n- **API Layer**: Provides secure endpoints for CRUD operations, user authentication, and data processing.\n- **Security Measures**: Implements JWT-based authentication, BCrypt for password hashing, and CORS for cross-origin requests.\n- **File Management**: Handles multipart form data using Multer for secure profile picture uploads.\n\n[🔼 Back to Top](#table-of-contents)\n\n---\n\n## Prerequisites\n\nEnsure the following tools are installed:\n\n- [Git](https://git-scm.com/downloads) - Version control system\n- [Node.js (20.17.0)](https://nodejs.org/) - JavaScript runtime\n- [npm (10.9.0)](https://www.npmjs.com/) - Package manager\n- [MySQL (8.x)](https://dev.mysql.com/downloads/) - Relational database management system\n- **Optional**:\n  - [Postman](https://www.postman.com/) - API testing tool\n\n[🔼 Back to Top](#table-of-contents)\n\n---\n\n## Installation\n\n### Project Setup\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/manuelalejandrojimeneztorres/surveyhub-server.git\n   ```\n\n2. Navigate to the project directory:\n\n   ```bash\n   cd surveyhub-server\n   ```\n\n3. Install the dependencies:\n\n   ```bash\n   npm install\n   ```\n\n[🔼 Back to Top](#table-of-contents)\n\n### Environment Configuration\n\n1. Create a `.env` file in the root directory and define the following variables:\n\n   ```env\n   JWT_SECRET=YourStrongJWTSecret\n   MYSQL_DATABASE=surveyhub\n   MYSQL_USER=root\n   MYSQL_PASSWORD=YourStrongDatabasePassword\n   MYSQL_ROOT_PASSWORD=YourStrongDatabasePassword\n   DB_HOST=localhost\n   NODE_ENV=development\n   ```\n\n[🔼 Back to Top](#table-of-contents)\n\n### Database Setup\n\n1. Start your MySQL server and create the database:\n\n   ```sql\n   CREATE DATABASE surveyhub;\n   ```\n\n2. Run Sequelize migrations to set up the database schema:\n\n   ```bash\n   npx sequelize-cli db:migrate\n   ```\n\n[🔼 Back to Top](#table-of-contents)\n\n### Start the Server\n\n1. Launch the server:\n\n   ```bash\n   node app.js\n   ```\n\n\u003e [!NOTE]\n\u003e The backend will be accessible at `http://localhost:8080`.\n\n[🔼 Back to Top](#table-of-contents)\n\n---\n\n## Technologies and Tools Used\n\n- **Backend**:\n  - Node.js: High-performance JavaScript runtime\n  - Express.js: Minimalist web framework\n  - Sequelize: Database ORM\n  - MySQL: Relational database\n\n- **Security**:\n  - bcryptjs: Password hashing\n  - jsonwebtoken: Authentication\n  - cors: Cross-origin request handling\n\n- **Development Tools**:\n  - Postman: API testing\n  - Visual Studio Code: Code editor\n  - MySQL Workbench: Database management\n\n[🔼 Back to Top](#table-of-contents)\n\n---\n\n## Dependencies\n\nKey dependencies include:\n\n- `express` (4.21.0): Web framework\n- `sequelize` (6.37.4): ORM for MySQL\n- `mysql2` (3.11.3): MySQL client\n- `jsonwebtoken` (9.0.2): Token-based authentication\n- `bcryptjs` (2.4.3): Password encryption\n- `dotenv` (16.4.5): Environment variable management\n- `multer` (1.4.5-lts.1): File uploads\n\n\u003e [!NOTE]\n\u003e For a full list, see the `package.json` file.\n\n[🔼 Back to Top](#table-of-contents)\n\n---\n\n## Troubleshooting\n\n### Common Issues\n\n- **Database Connection Errors**:\n  - Ensure MySQL is running and credentials in the `.env` file are correct.\n  - Check if the database exists and migrations have been executed.\n\n- **Missing Dependencies**:\n  - Run `npm install` to ensure all required packages are installed.\n\n- **Server Not Starting**:\n  - Check the logs for detailed error messages.\n\n### Logs\n\nUse the following command to view logs:\n\n```bash\nnpm run logs\n```\n\n[🔼 Back to Top](#table-of-contents)\n\n---\n\n## Contributing Guidelines\n\nWe welcome contributions to improve the SurveyHub Backend. To contribute:\n\n1. Fork the repository.\n2. Create a new branch for your feature or bug fix:\n\n   ```bash\n   git checkout -b feature/your-feature-name\n   ```\n\n3. Commit your changes with detailed messages:\n\n   ```bash\n   git commit -m \"Add: Description of your feature\"\n   ```\n\n4. Push your branch and open a pull request.\n\n\u003e [!NOTE]\n\u003e For guidelines, see [CONTRIBUTING.md](CONTRIBUTING.md).\n\n[🔼 Back to Top](#table-of-contents)\n\n---\n\n## Support\n\nFor support, contact:\n\n- **Email**: support@surveyhub.com\n- **Documentation**: [SurveyHub API Wiki](https://github.com/manuelalejandrojimeneztorres/surveyhub-server/wiki)\n\n[🔼 Back to Top](#table-of-contents)\n\n---\n\n## License\n\nThis project is licensed under the **Apache License 2.0**. See the [LICENSE.txt](LICENSE.txt) file for more details.\n\n[🔼 Back to Top](#table-of-contents)\n\n---\n\n## Acknowledgments\n\nSpecial thanks to:\n\n- The [Node.js](https://nodejs.org/) and [Express.js](https://expressjs.com/) communities for exceptional frameworks.\n- [Sequelize](https://sequelize.org/) for simplifying database operations.\n- [GitHub](https://github.com/) for enabling collaboration and version control.\n\n[🔼 Back to Top](#table-of-contents)\n\n---\n\nFor more information, visit [SurveyHub Mobile](https://github.com/manuelalejandrojimeneztorres/surveyhub-mobile) or [SurveyHub Desktop](https://github.com/manuelalejandrojimeneztorres/surveyhub-desktop).\n\nEnjoy using the **SurveyHub Backend** and feel free to contribute to its development! 🚀\n\n[🔼 Back to Top](#table-of-contents)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanuelalejandrojimeneztorres%2Fsurveyhub-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanuelalejandrojimeneztorres%2Fsurveyhub-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanuelalejandrojimeneztorres%2Fsurveyhub-server/lists"}