{"id":20153153,"url":"https://github.com/hendrowunga/spring-boot-todoapp-jwt","last_synced_at":"2025-03-03T01:22:15.542Z","repository":{"id":256083467,"uuid":"853841782","full_name":"hendrowunga/Spring-Boot-TodoApp-JWT","owner":"hendrowunga","description":"RestApi Todo App : Spring Boot,Docker,Security","archived":false,"fork":false,"pushed_at":"2024-10-09T18:11:30.000Z","size":582,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-13T12:20:25.827Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","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/hendrowunga.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}},"created_at":"2024-09-07T17:25:54.000Z","updated_at":"2024-10-13T17:47:56.000Z","dependencies_parsed_at":"2024-11-14T00:15:43.961Z","dependency_job_id":null,"html_url":"https://github.com/hendrowunga/Spring-Boot-TodoApp-JWT","commit_stats":null,"previous_names":["hendrowunga/spring-boot-todoapp","hendrowunga/spring-boot-todoapp-jwt"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hendrowunga%2FSpring-Boot-TodoApp-JWT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hendrowunga%2FSpring-Boot-TodoApp-JWT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hendrowunga%2FSpring-Boot-TodoApp-JWT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hendrowunga%2FSpring-Boot-TodoApp-JWT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hendrowunga","download_url":"https://codeload.github.com/hendrowunga/Spring-Boot-TodoApp-JWT/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241592969,"owners_count":19987463,"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":[],"created_at":"2024-11-13T23:17:25.095Z","updated_at":"2025-03-03T01:22:15.525Z","avatar_url":"https://github.com/hendrowunga.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# REST API TODOAPP\n\n## USER\n\n### Register a new user\n- **URL**: `{{api_url}}:{{api_port}}/api/v1/auth/register`\n    - **Method**: `POST`\n    - **EndPoint**: `(\"/register\")`\n    - **Description**: Registers a new user in the system. The request body should contain the user's details (e.g., email, password, etc.).\n    - **Request Body Example**:\n        ```json\n        {\n      \"firstname\": \"Hendro\",\n      \"lastname\": \"wunga\",\n      \"email\": \"wunga@gmail.com\",\n      \"username\": \"hendrowunga\",\n      \"password\": \"password123\"\n        }\n        ```\n  - **Successful Response**: HTTP 200 Accepted\n![](picture/register.png)\n\n### Email\n- **URL**: `localhost:1080`\n    - Once users register, they will receive an activation email to verify their email address and activate their account. This email contains a unique activation code, which must be used to activate the account.\n  ![](picture/email.png)\n\n### Activate user account\n- **URL**: `{{api_url}}:{{api_port}}/api/v1/auth/activate-account?token=355034`\n    - **Method**: `GET`\n    - **EndPoint**: `(\"/activate-account\")`\n    - **Description**: Activates a user's account using the token sent via email. This is required after the registration process to verify the user's email.\n    - **Parameters**:\n        - `token`: The token received in the user's email for activation.\n    - **Successful Response**: HTTP 200 OK \n![](picture/activate-account.png)\n\n### Login (Authenticate)\n- **URL**: `{{api_url}}:{{api_port}}/api/v1/auth/authenticate`\n    - **Method**: `POST`\n    - **EndPoint**: `(\"/authenticate\")`\n    - **Description**: Authenticates a user and returns a JWT token. This token is used to access protected resources.\n    - **Request Body Example**:\n    ```json\n    {\n      \"email\": \"wunga@gmail.com\",\n      \"username\": \"hendrowunga\",\n      \"password\": \"password1234\"\n    }\n    ```\n    - **Response**:\n    ```json\n    {\n      \"token\": \"eyJhbGciOiJIUzM4NCJ9.eyJmdWxsTmFtZSI6IkhlbmRybyBXdW5nYSIsInN1YiI6Ind1bmdhQGdtYWlsLmNvbSIsImlhdCI6MTcyNTgxMjUzNCwiZXhwIjoxNzI1ODk4OTM0LCJhdXRob3JpdGllcyI6WyJVU0VSIl19.EnThtLDO60Mzek3B6zwtNBz8EqkerBoUNvs8mKzFEwiO4DpDOLd4VlRjCFHoRIBH\"\n    }\n    ```\n    - **Successful Response**: HTTP 200 OK \n![](picture/login.png)\n\n\n## TODO\n\n### Created Todo\n- **URL**: `http://localhost:8089/todos`\n  - **Method**: `POST`\n  - **Description**: Creating a new Todo\n  - **Request Body Example**:\n      ```json\n      {\n    \"title\": \"Belajar  Java\"\n    }\n      ```\n  - **Successful Response**: HTTP 200 Created \n    ```json\n    {\n    \"id\": 5,\n    \"title\": \"Belajar  Java\",\n    \"completed\": false\n    }\n      ```\n    ![](picture/created.png)\n\n\n### All Todo\n- **URL**: `http://localhost:8089/todos`\n  - **Method**: `GET`\n  - **Description**: take a list of all Todos.\n  - **Successful Response**: HTTP 200 OK \n    ```json\n    {\n    [\n    {\n        \"id\": 2,\n        \"title\": \"Belajar Spring Boot\",\n        \"completed\": false\n    },\n    {\n        \"id\": 3,\n        \"title\": \"Belajar Spring Laravel\",\n        \"completed\": false\n    },\n    {\n        \"id\": 4,\n        \"title\": \"Belajar  HTML\",\n        \"completed\": false\n    },\n    {\n        \"id\": 5,\n        \"title\": \"Belajar  Java\",\n        \"completed\": false\n    }\n    ]\n    \n    }\n      ```\n    ![](picture/GetAll.png)\n\n### Get By ID\n- **URL**: `http://localhost:8089/todos/1`\n  - **Method**: `GET`\n  - **Description**: Retrieving Todo by ID, and this is retrieving by ID if there is none.\n  - **Successful Response**: HTTP 400 NOT FOUND\n  \n    ![](picture/getbyid.png)\n\n  - **URL**: `http://localhost:8089/todos/5`\n    - **Method**: `GET`\n    - **Description**: Retrieving Todo by ID, and this is retrieving by ID if there is none.\n    - **Successful Response**: HTTP 200 OK\n        ```json\n      {\n      \"id\": 5,\n      \"title\": \"Belajar  Java\",\n      \"completed\": false\n      }\n      ```\n    ![](picture/byid.png)\n\n### Update Todo\n- **URL**: `http://localhost:8089/todos/3`\n  - **Method**: `PUT`\n  - **Description**: Update existing Todo based on ID.\n  - **Successful Response**: HTTP 200 OK\n      ```json\n      {\n      \"id\": 3,\n      \"title\": \"Belajar Laravel)\",\n      \"completed\": false\n      }\n      ```\n\n    ![](picture/update.png)\n\n\n### Delete Todo\n- **URL**: `http://localhost:8089/todos/3`\n  - **Method**: `DELETE`\n  - **Description**: Delete Todo by ID.\n  - **Successful Response**: HTTP 204 No Content\n\n    ![](picture/delete.png)\n\n\n\n### Completed Todo\n- **URL**: `http://localhost:8089/todos/3`\n  - **Method**: `PATCH`\n  - **Description**: Mark Todo as complete.\n  - **Successful Response**: HTTP 204 No Content\n\n    ![](picture/completed.png)\n\n## Configuration\n- **docker-compose.yml**: \n  ```\n  services:\n    postgres:\n      container_name: postgres-sql-todo\n      image: postgres\n      environment:\n        POSTGRES_USER: postgres\n        POSTGRES_PASSWORD: postgres\n        PGDATA: /var/lib/postgresql/data\n      volumes:\n        - postgres:/data/postgres\n      ports:\n        - 5432:5432\n      networks:\n        - spring-demo\n      restart: unless-stopped\n    mail-dev:\n      container_name: mail-dev-todo\n      image: maildev/maildev\n      ports:\n        - 1080:1080\n        - 1025:1025\n  networks:\n    spring-demo:\n    driver: bridge\n\n  volumes:\n    postgres:\n    driver: local\n  ```\n\n- **application-dev.yml**:\n  ```\n  spring:\n  datasource:\n    url: jdbc:postgresql://localhost:5432/todoApp\n    username: postgres\n    password: postgres\n    driver-class-name: org.postgresql.Driver\n  jpa:\n    hibernate:\n      ddl-auto: update\n    show-sql: false\n    properties:\n      hibernate:\n        format_sql: true\n    database: postgresql\n    database-platform: org.hibernate.dialect.PostgreSQLDialect\n  mail:\n    host: localhost\n    port: 1025\n    username: ali\n    password: ali\n    properties:\n      mail:\n        smtp:\n          trust: \"*\"\n        auth: true\n        starttls:\n          enabled: true\n        connectiontimeout: 5000\n        timeout: 3000\n        writetimeout: 5000\n  application:\n    security:\n      jwt:\n        secret-key: 404E635266556A586E3272357538782F413F4428472B4B6250645367566B5970\n        expiration: 86400000 # a day\n    mailing:\n      frontend:\n        activation-url: http://localhost:4200/activate-account\n\n  server:\n    port: 8088\n  ```\n- **application.yml**:\n  ```\n  spring:\n  profiles:\n    active: dev\n  springdoc:\n    default-produces-media-type: application/json\n  server:\n    servlet:\n      context-path: /api/v1/\n  ```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhendrowunga%2Fspring-boot-todoapp-jwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhendrowunga%2Fspring-boot-todoapp-jwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhendrowunga%2Fspring-boot-todoapp-jwt/lists"}