{"id":27607817,"url":"https://github.com/fitri-hy/restfull-api-starter-nodejs","last_synced_at":"2026-04-08T20:47:18.167Z","repository":{"id":288211077,"uuid":"967205802","full_name":"fitri-hy/restfull-api-starter-nodejs","owner":"fitri-hy","description":"Starter Kit for building modern RESTful APIs with scalable 🏗️, modular 🧩, and secure 🔐 architecture. Suitable for use as an initial foundation for developing small to large scale backend applications, equipped with various built-in features that are ready to use 🧰 and easy to develop further 🚧.","archived":false,"fork":false,"pushed_at":"2025-04-21T02:11:05.000Z","size":115,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-22T22:07:33.036Z","etag":null,"topics":["api","backend","express","jwt","mysql","nodejs","postgresql","redis","rest-api","restful-api","scalable-architecture","sequelize","starter-kit"],"latest_commit_sha":null,"homepage":"","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/fitri-hy.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,"zenodo":null}},"created_at":"2025-04-16T05:11:49.000Z","updated_at":"2025-04-21T02:13:22.000Z","dependencies_parsed_at":"2025-04-21T02:43:58.540Z","dependency_job_id":null,"html_url":"https://github.com/fitri-hy/restfull-api-starter-nodejs","commit_stats":null,"previous_names":["fitri-hy/rest-api-starter-nodejs","fitri-hy/restfull-api-starter-nodejs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fitri-hy/restfull-api-starter-nodejs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fitri-hy%2Frestfull-api-starter-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fitri-hy%2Frestfull-api-starter-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fitri-hy%2Frestfull-api-starter-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fitri-hy%2Frestfull-api-starter-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fitri-hy","download_url":"https://codeload.github.com/fitri-hy/restfull-api-starter-nodejs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fitri-hy%2Frestfull-api-starter-nodejs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31573788,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"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":["api","backend","express","jwt","mysql","nodejs","postgresql","redis","rest-api","restful-api","scalable-architecture","sequelize","starter-kit"],"created_at":"2025-04-22T22:07:07.537Z","updated_at":"2026-04-08T20:47:18.161Z","avatar_url":"https://github.com/fitri-hy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 RESTful-API Starter Kit\n\nStarter Kit for building modern RESTful APIs with scalable 🏗️, modular 🧩, and secure 🔐 architecture. Suitable for use as an initial foundation for developing small to large scale backend applications, equipped with various built-in features that are ready to use 🧰 and easy to develop further 🚧.\n\n---\n\n## 🚀 Built-in Features\n\n- ✅ Authentication\n- 🧼 Input Validation \u0026 Sanitation\n- 🔐 Password Hashing\n- 🔑 JWT Token Auth\n- 🔄 Database Switching (MySQL / PostgreSQL)\n- 🧩 Modular\n- 📦 ORM Sequelize\n- 🧯 Handling errors\n- 🏗️ Scalable Project Structure\n- 🛡️ Rate Limiting\n- 📛 Security Headers\n- ⚡ Redis Caching\n- ❤️ Health Check \u0026 Monitoring\n- 🐂 Asynchronous Task Handling (Bull Queue)\n- 📥 Upload File Handlers\n- 🔁 Graceful Shutdown\n- 🎛️ Request Profiling\n- 🔒 HTTP Compression\n- 🚨 Anomaly Detection\n- 🌐 Webhook\n\n---\n\n## Quick Start\n\n```\ngit clone https://github.com/fitri-hy/restfull-api-starter-nodejs.git\ncd restfull-api-starter-nodejs\ncp .env.example .env\nnpm install\nnpm run dev\n```\n\n---\n\n## 🧾 Configuration `.env` Variables\n\n| Variable             | Function                                                                |\n|----------------------|-------------------------------------------------------------------------|\n| HOST                 | Server host address                                                     |\n| PORT                 | Port number the application listens on                                  |\n| NODE_ENV             | Application mode (`development` / `production`)                         |\n| API_KEY_ENABLE       | Enable API key protection                                               |\n| API_KEY              | API key value for authentication                                        |\n| CORS_ORIGIN          | Allowed origin domain for API access (CORS)                             |\n| DB                   | Database type (`mysql` / `postgres`)                                    |\n| DB_HOST              | Database host address                                                   |\n| DB_USER              | Database username                                                       |\n| DB_PASS              | Database password                                                       |\n| DB_NAME              | Database name                                                           |\n| DB_PORT              | Database port number                                                    |\n| WEBHOOK_ENABLE       | Enable webhook notifications                                            |\n| WEBHOOK_URL          | Webhook target URL                                                      |\n| JWT_SECRET           | Secret key to generate JWT tokens                                       |\n| JWT_EXPIRATION       | JWT token expiration time (e.g., `1h`, `30m`)                           |\n| RATE_LIMIT_MAX       | Maximum number of requests before rate limiting                         |\n| RATE_LIMIT_WINDOW_MS | Rate limit window in milliseconds                                       |\n| REDIS_CACHE_ENABLE   | Enable Redis caching                                                    |\n| REDIS_TASK_ENABLE    | Enable Redis task queue                                                 |\n| REDIS_HOST           | Redis host address                                                      |\n| REDIS_PORT           | Redis port number                                                       |\n| REDIS_TTL            | Time-to-live (TTL) for Redis cache (in seconds)                         |\n| FILE_MAX_SIZE        | Maximum file upload size (in bytes)                                     |\n| FILE_UPLOAD_PATH     | Directory path for file uploads                                         |\n| FILE_ALLOWED_TYPES   | Allowed file types for upload                                           |\n| COMPRESSION_ENABLE   | Enable response compression                                             |\n| COMPRESSION_THRESHOLD| Minimum response size to be compressed                                  |\n| COMPRESSION_LEVEL    | Compression level (0-9)                                                 |\n| ANOMALY_ENABLED      | Enable anomaly detection for requests                                   |\n| ANOMALY_TIME         | Time interval for detecting anomalies (in milliseconds)                 |\n| ANOMALY_REQUEST      | Number of suspicious requests before being flagged as an anomaly        |\n| ANOMALY_URL_LENGTH   | Maximum URL length for anomaly detection                                |\n\n---\n\n## 📊 Status Monitoring\n\n#### Endpoint\n\n```\nGET http://localhost:5000/status\n```\n\n---\n\n## 🐂 Task Handling\n\n#### Endpoint\n\n```\nPOST http://localhost:5000/api/v1/tasks/add\n```\n\n#### Header Request (If using ApiKey)\n\n| Key             | Value                           |\n|:----------------|:--------------------------------|\n| x-api-key       | my_secret_api_key               |\n\n\n---\n\n## 🧠 Redis Caching\n\n#### Endpoint\n\n```\nGET http://localhost:5000/api/v1/data/:key\n```\n\n#### Header Request (If using ApiKey)\n\n| Key             | Value                           |\n|:----------------|:--------------------------------|\n| x-api-key       | my_secret_api_key               |\n\n\n---\n\n## 👤 Example Case (Login, Register, Get All User, User Detail, Edit User Detail)\n\n\u003e *For testing purposes, you can import the `sample.sql` sample file available in the `/src/config/sample.sql` directory.*\n\n#### 📬 Postman Collection\n\nDownload \u0026 Import:  \n[RESTful-API_Starter_Kit.postman_collection.json](./src/config/RESTful-API_Starter_Kit.postman_collection.json)\n\n\n### Register\n\n#### Endpoint\n```\nPOST http://localhost:5000/api/v1/auth/register\n```\n\n#### Header Request (If using ApiKey)\n\n| Key             | Value                           |\n|:----------------|:--------------------------------|\n| x-api-key       | my_secret_api_key               |\n\n#### Body Request\n\n```\n{\n  \"name\": \"John Doe\",\n  \"email\": \"johndoe@example.com\",\n  \"password\": \"securepassword\"\n}\n```\n\n#### Response\n\n```\n{\n  \"message\": \"Registration successful\",\n  \"user\": {\n    \"name\": \"John Doe\",\n    \"email\": \"johndoe@example.com\",\n    \"password\": \"securepassword\"\n  }\n}\n```\n\n### Login\n\n#### Endpoint\n\n```\nPOST http://localhost:5000/api/v1/auth/login\n```\n\n#### Header Request (If using ApiKey)\n\n| Key             | Value                           |\n|:----------------|:--------------------------------|\n| x-api-key       | my_secret_api_key               |\n\n#### Body Request\n\n```\n{\n  \"email\": \"johndoe@example.com\",\n  \"password\": \"securepassword\"\n}\n```\n\n#### Response\n\n```\n{\n  \"message\": \"Login successful\",\n  \"token\": \"your_jwt_token_here\"\n}\n```\n\n### All Users\n\n#### Endpoint\n\n```\nGET http://localhost:5000/api/v1/auth/users\n```\n\n#### Header Request (If using ApiKey)\n\n| Key             | Value                           |\n|:----------------|:--------------------------------|\n| x-api-key       | my_secret_api_key               |\n\n\n#### Header Authorization:\n\n| Key             | Value                           |\n|:----------------|:--------------------------------|\n| Authorization   | Bearer `\u003cyour_jwt_token_here\u003e`  |\n\n#### Response\n\n```\n[\n  {\n    \"id\": 1,\n    \"name\": \"John Doe\",\n    \"email\": \"johndoe@example.com\"\n  }\n  ...\n]\n```\n\n### Users Detail\n\n#### Endpoint\n\n```\nGET http://localhost:5000/api/v1/auth/profile\n```\n\n#### Header Request (If using ApiKey)\n\n| Key             | Value                           |\n|:----------------|:--------------------------------|\n| x-api-key       | my_secret_api_key               |\n\n\n#### Header Authorization:\n\n| Key             | Value                           |\n|:----------------|:--------------------------------|\n| Authorization   | Bearer `\u003cyour_jwt_token_here\u003e`  |\n\n#### Response\n\n```\n{\n  \"id\": 1,\n  \"name\": \"John Doe\",\n  \"email\": \"johndoe@example.com\",\n  \"createdAt\": \"2025-04-21T00:42:41.000Z\"\n}\n```\n\n### Users Edit\n\n#### Endpoint\n\n```\nPUT http://localhost:5000/api/v1/auth/profile\n```\n\n#### Header Request (If using ApiKey)\n\n| Key             | Value                           |\n|:----------------|:--------------------------------|\n| x-api-key       | my_secret_api_key               |\n\n\n#### Header Authorization:\n\n| Key             | Value                           |\n|:----------------|:--------------------------------|\n| Authorization   | Bearer `\u003cyour_jwt_token_here\u003e`  |\n\n#### Body Request\n\n```\n{\n  \"name\": \"John New\",\n  \"email\": \"Johnnew@example.com\",\n  \"password\": \"123456\"\n}\n```\n\n#### Response\n\n```\n{\n    \"message\": \"Profile updated successfully\",\n    \"user\": {\n        \"id\": 1,\n        \"name\": \"John New\",\n        \"email\": \"Johnnew@example.com\",\n        \"createdAt\": \"2025-04-21T01:13:14.000Z\",\n        \"updatedAt\": \"2025-04-21T01:13:45.000Z\"\n    }\n}\n```\n\n---\n\n## File Upload\n#### Endpoint\n\n```\nPOST http://localhost:5000/api/v1/upload/:folderName\n\nDefault Location: public/uploads\n```\n\n#### Header Request (If using ApiKey)\n\n| Key             | Value                           |\n|:----------------|:--------------------------------|\n| x-api-key       | my_secret_api_key               |\n\n\n#### Body Request (form-data)\n\n| Key           | Type\t\t| Value                    |\n|:--------------|:----------|:-------------------------|\n| file       \t| file\t\t| Select File         |\n\n\n#### Response\n\n```\n{\n    \"message\": \"File uploaded successfully\",\n    \"file\": {\n        \"fieldname\": \"file\",\n        \"originalname\": \"your-image.jpeg\",\n        \"encoding\": \"7bit\",\n        \"mimetype\": \"image/jpeg\",\n        \"destination\": \"public/uploads/\",\n        \"filename\": \"1744786296980-815431101.jpeg\",\n        \"path\": \"public\\\\uploads\\\\1744786296980-815431101.jpeg\",\n        \"size\": 582884\n    }\n}\n```\n\n---\n\n## 🗂️ Folder Structure\n\n```\nrest-api-starter/\n├── src/\n│   ├── config/\n│   ├── controllers/\n│   ├── middleware/\n│   ├── models/\n│   ├── routes/\n│   ├── service/\n│   └── utils/\n├── .env\n├── .gitignore\n├── package.json\n└── app.js\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffitri-hy%2Frestfull-api-starter-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffitri-hy%2Frestfull-api-starter-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffitri-hy%2Frestfull-api-starter-nodejs/lists"}