{"id":21956778,"url":"https://github.com/tiennhm/x2mint-backend","last_synced_at":"2026-04-13T19:31:52.375Z","repository":{"id":179889830,"uuid":"426548205","full_name":"TienNHM/x2mint-backend","owner":"TienNHM","description":"x2mint APIs","archived":false,"fork":false,"pushed_at":"2026-02-01T12:29:37.000Z","size":646,"stargazers_count":0,"open_issues_count":10,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-02-01T21:58:02.708Z","etag":null,"topics":["cicd","express-js","google","heroku","mail","mongodb","nodejs","rest-api","swagger","swagger-ui","vnpay-api"],"latest_commit_sha":null,"homepage":"https://x2mint-api.onrender.com/doc","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/TienNHM.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-11-10T08:48:11.000Z","updated_at":"2025-06-24T16:29:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"b4fe46a2-6760-4f3e-aa91-a896ef21dba4","html_url":"https://github.com/TienNHM/x2mint-backend","commit_stats":null,"previous_names":["tiennhm/x2mint-backend"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TienNHM/x2mint-backend","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TienNHM%2Fx2mint-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TienNHM%2Fx2mint-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TienNHM%2Fx2mint-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TienNHM%2Fx2mint-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TienNHM","download_url":"https://codeload.github.com/TienNHM/x2mint-backend/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TienNHM%2Fx2mint-backend/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31768636,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T15:25:13.801Z","status":"ssl_error","status_checked_at":"2026-04-13T15:25:09.162Z","response_time":93,"last_error":"SSL_read: 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":["cicd","express-js","google","heroku","mail","mongodb","nodejs","rest-api","swagger","swagger-ui","vnpay-api"],"created_at":"2024-11-29T08:38:51.126Z","updated_at":"2026-04-13T19:31:52.351Z","avatar_url":"https://github.com/TienNHM.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# X2M!NT API\n\n[![](https://img.shields.io/badge/API-Documentation-brightgreen)](https://documenter.getpostman.com/view/13444000/UVJeEbgb)\n\n## Cấu trúc thư mục\n\n\u003cdetails\u003e\n  \u003csummary\u003eXem chi tiết\u003c/summary\u003e\n  \n```\nx2mint-backend\n│   .gitignore\n│   index.js\n│   package-lock.json\n│   package.json\n│   Procfile\n│   README.md\n├───.vscode\n│       settings.json\n└───src\n    ├───middleware\n    │       requireAuth.js\n    ├───models\n    │       Account.js\n    │       Answer.js\n    │       Bill.js\n    │       Contest.js\n    │       enum.js\n    │       Question.js\n    │       TakeTest.js\n    │       TakeTestLogs.js\n    │       Test.js\n    │       User.js\n    ├───routers\n    │       adminRoutes.js\n    │       answerRoutes.js\n    │       authRoutes.js\n    │       billRoutes.js\n    │       contestRoutes.js\n    │       paymentRoutes.js\n    │       questionRoutes.js\n    │       sendMail.js\n    │       takeTestRoutes.js\n    │       testRoutes.js\n    │       userRoutes.js\n    └───utils\n            SortObj.js\n            Timezone.js\n```\n\u003c/details\u003e\n\n## Hướng dẫn cài đặt\n\n- Bước 1: Clone project\n\n```\ngit clone https://github.com/x2mint/x2mint-backend.git\n```\n\n- Bước 2: Install\n\nTại thư mục `x2mint-backend`, mở terminal và gõ lệnh:\n\n```\nnpm install\n```\n\nHoặc:\n```\nyarn install\n```\n\n- Bước 3: Thêm file `.env` chứa thông tin các biến môi trường:\n\n| Tên biến | Mô tả |\n| :--- | :--- |\n| DB_URL | Connection string kết nối cơ sở dữ liệu MongoDB. |\n| REACT_APP_SECRET_HASH_KEY | Hash key bí mật |\n| REACT_APP_ACCESS_TOKEN_SECRET | Token bí mật |\n| REACT_APP_ACTIVATION_TOKEN_SECRET | Token kích hoạt |\n| REACT_APP_GOOGLE_CLIENT_ID | Google Client ID, đăng ký vào tạo mới project. Xem hướng dẫn chi tiết [tại đây](https://dev.to/chandrapantachhetri/sending-emails-securely-using-node-js-nodemailer-smtp-gmail-and-oauth2-g3a#:~:text=Step%201%3A%20Creating%20a%20Google%20Project). |\n| REACT_APP_GOOGLE_SECRET_KEY | Key bí mật của ứng dụng Google. |\n| REACT_APP_MAILING_SERVICE_CLIENT_ID | Google Client ID dùng cho việc gửi mail. |\n| REACT_APP_MAILING_SERVICE_CLIENT_SECRET | Key bí mật của ứng dụng Google dùng cho việc gửi mail. |\n| REACT_APP_MAILING_SERVICE_REFRESH_TOKEN | Refresh token. |\n| REACT_APP_SENDER_EMAIL_ADDRESS | Tài khoản email của ứng dụng, dùng cho việc gửi mail thông báo đến người dùng. |\n| REACT_APP_VNP_TMNCODE | VNPay `tmnCode`, hướng dẫn chi tiết về tạo tài khoản thanh toán VNPay xem [tại đây](https://sandbox.vnpayment.vn/apis/docs/huong-dan-tich-hop/). |\n| REACT_APP_VNP_HASHSECRET| Mã `hashSecret` của VNPay. |\n| REACT_APP_VNP_URL | Endpoint gọi API thanh toán của VNPay, mặc định là: `https://sandbox.vnpayment.vn/paymentv2/vpcpay.html`. |\n| REACT_APP_VNP_EMAIL | Email tài khoản VNPay. |\n| REACT_APP_CLIENT_URL | Link domain của website, VD: `http://x2mint.vercel.app`. Lưu ý: không có dấu `/` ở cuối URL. |\n| REACT_APP_API_ROOT | App root endpoint, VD: `http://api-x2mint.herokuapp.com/app/api/v1`. |\n\n- Bước 4: Khởi chạy\n\nMặc định, server sẽ chạy tại cổng `5005`. Mở terminal và chạy lệnh sau:\n```\nnpm run server\n```\n\n**Kết quả:**\n\n```\n\u003e backend@1.0.0 server\n\u003e nodemon index\n\n[nodemon] 2.0.15\n[nodemon] to restart at any time, enter `rs`\n[nodemon] watching path(s): *.*\n[nodemon] watching extensions: js,mjs,json\n[nodemon] starting `node index index.js`\nExpress server listening on port 5005 in development mode\n Mongoose connected \n```\n\n## Cập nhật swagger\n\nChạy lệnh sau để cập nhật file `swagger-output.json`:\n\n```bash\nnpm run swagger\n```\n\nThông tin API sẽ được cập nhật trong file `swagger-output.json`. Bạn có thể xem Swagger UI tại đường dẫn `/doc`.\n\n## Hướng dẫn deploy lên Heroku\n\n- Bước 1: Tạo tài khoản Heroku [tại đây](https://signup.heroku.com/login). Sau đó, tải và cài đặt Heroku CLI theo hướng dẫn [tại đây](https://devcenter.heroku.com/articles/heroku-cli).\n- Bước 2: Tạo file `Procfile` tại thư mục gốc của project. Lưu ý file trên không có phần mở rộng file. Mở file lên và thêm vào nội dung như sau:\n\n```\nweb: npm run server\n```\n\nSau đó, push code lên master của Github repo.\n- Bước 3: Tạo mới một ứng dụng trên Heroku (`\u003capp_name\u003e`) theo link [này](https://dashboard.heroku.com/new-app).\n  + Bước 3.1: Đặt tên ứng dụng, sau đó bấm `Create app`.\n  + Bước 3.2: Tại mục `Deployment method`, chọn Github để import. Lưu ý, tài khoản phải được kết nối với Github trước đó.\n  + Bước 3.3: Nhập tên Github repo, bấm tìm kiếm. Repo tương ứng hiện ra thì chọn `Connect` để kết nối.\n  + Bước 3.4: Bấm `Deploy branch` để bắt đầu deploy. Chờ quá trình deploy diễn ra thành công và thông báo `Your app was successfully deployed`.\n- Bước 4: Thêm biến môi trường cho ứng dụng.\n  + Bước 4.1: Tại thư mục gốc của project, mở terminal và chạy lệnh sau: `heroku plugins:install heroku-config`. Lưu ý: Bắt buộc đã cài đặt [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli) trước đó.\n  + Bước 4.2: Cập nhật biến môi trường cho ứng dụng Heroku:\n  \n```\nheroku config:push -a \u003capp_name\u003e\n```\n\nTrong đó, `\u003capp_name\u003e` là tên ứng dụng trên Heroku. Ví dụ:\n```\nheroku config:push -a api-x2mint\n```\n- Bước 5: Deploy lại ứng dụng.\n\n## Contributors\n[![](https://avatars.githubusercontent.com/u/33385777?v=4\u0026s=80)](https://github.com/TienNHM)\n[![](https://avatars.githubusercontent.com/u/58748687?v=4\u0026s=80)](https://github.com/timomint)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiennhm%2Fx2mint-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftiennhm%2Fx2mint-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiennhm%2Fx2mint-backend/lists"}