{"id":24308822,"url":"https://github.com/markma512/blog-server","last_synced_at":"2026-04-12T00:50:58.152Z","repository":{"id":271379332,"uuid":"912658538","full_name":"MarkMa512/blog-server","owner":"MarkMa512","description":"A Backend System for Personal Blog built with Spring Boot","archived":false,"fork":false,"pushed_at":"2025-02-03T15:42:32.000Z","size":49,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-06T20:17:06.091Z","etag":null,"topics":["cicd","docker","mvc-architecture","postgresql","rest-api","spring-boot","tdd"],"latest_commit_sha":null,"homepage":"https://blogserver-3d7e486c7e82.herokuapp.com/","language":"Java","has_issues":false,"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/MarkMa512.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":"2025-01-06T06:02:45.000Z","updated_at":"2025-02-03T15:43:45.000Z","dependencies_parsed_at":"2025-01-07T11:30:39.482Z","dependency_job_id":"ebe3c4c7-f4a9-432c-9d71-7d28f97d2494","html_url":"https://github.com/MarkMa512/blog-server","commit_stats":null,"previous_names":["markma512/blog-server"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MarkMa512/blog-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkMa512%2Fblog-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkMa512%2Fblog-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkMa512%2Fblog-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkMa512%2Fblog-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MarkMa512","download_url":"https://codeload.github.com/MarkMa512/blog-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkMa512%2Fblog-server/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265787188,"owners_count":23828379,"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":["cicd","docker","mvc-architecture","postgresql","rest-api","spring-boot","tdd"],"created_at":"2025-01-17T05:11:40.968Z","updated_at":"2026-04-12T00:50:58.119Z","avatar_url":"https://github.com/MarkMa512.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Blog Server with Spring Boot \n\n![Java CI with Maven](https://github.com/MarkMa512/blog-server/actions/workflows/maven.yml/badge.svg)\n\n## Built with\n1. Spring Boot\n2. PostgreSQL\n3. Docker\n\n## Key Features\n\n### REST API\n- This project aims to implement a set of **RESTful API** for blog post management. \n- Supporting essential **CRUD Operations**\n  - Create: Add new blog posts\n  \n  **Localhost Testing:** \n  ```\n  POST http://localhost:8080/api/posts\n  ```\n  - Read: Fetch individual/all blog post\n  ```\n  GET http://localhost:8080/api/posts\n  ```\n  - Update: Modify existing blog posts\n  ```\n  PUT http://localhost:8080/api/posts/{id}\n  ```\n  - Delete: Remove blog posts from the database\n  ```\n  DELETE http://localhost:8080/api/posts/{id}\n  ```\n\nThe application is currently deployed on Heroku at: https://blogserver-3d7e486c7e82.herokuapp.com/\n(for cost and security purposes it is usually placed under maintenance mode).\n\n- Follows the best practice for REST API design, including proper use of \n  - HTTP Method\n  - HTTP Status code\n  - Request and Response Structure\n\nFor more details, please refer to [api/post.http](api/post.http)\n\n### MVC Models: Model View Controller\n- **Packaged by feature**: This project follows this convention for better encapsulation, \nmaintainability and clarity. \n  - Each feature (eg. post) is a package that contains its own domain model, controller, repository, and relevant\n  exceptions. \n  - Eg: \n\n```\npost/\n    - Post.java                     //Record: domain model for a blog post  \n    - PostController.java           //Class: handles HTTP requests and responses\n    - PostNotFoundException         //Class: custom exception for missing posts\n    - PostRepository                //Interface: data access logic using Spring Data JPA\n```\n\n### Test Driven Development\n- Emphasizes **Test-Driven-Development(TDD)** for robust and reliable code.\n\n#### Unit Test\n- Unit Tests for `PostController`: [`PostControllerTest.java`](src/test/java/com/ningzhi/blog_server/post/PostControllerTest.java)\n    - Validates the behavior of the PostController in isolation.\n    - Ensures the correctness of the REST endpoints.\n#### Integration Test\n- Integration Test for `PostController`: [`PostControllerIntegrationTest.java`](src/test/java/com/ningzhi/blog_server/post/PostControllerIntegrationTest.java)\n  - Test the interaction between PostController, PostRepository and the Database. \n  - Utilizing In-memory H2 database for realistic testing. \n  - Verifies the complete workflow, from API calls to database operations.\n\n#### Tools Used\n- **JUnit**: For writing and running tests.\n- **Mockito**: For mocking dependencies in unit tests.\n- **Spring Boot Test**: For integration testing with embedded contexts.\n\n### CI/CD \nThe CI/CD pipeline for this project is implemented using **GitHub Action** that automatically build, test, and \ndeployment workflows. Key features include:\n\n#### Continuous Integration (CI):\n- Automatically triggered on every push or pull request to the main branch.\n- Executes build and test steps using Maven, ensuring the codebase remains functional and maintainable.\n- Uploads build artifacts (JAR files) for further deployment stages.\n\n#### Continuous Deployment (CD): \n- It is currently successfully deployed on Heroku at: https://blogserver-3d7e486c7e82.herokuapp.com/ \n(for cost and security purposes it is usually placed under maintenance mode). \n- Supports integration with deployment platforms like AWS Elastic Beanstalk, enabling automated deployments of the \nbuilt application.\n- Containerized deployment with Docker can also be incorporated for platform independence.\nThis setup ensures rapid feedback on code changes and streamlines the deployment process, promoting a seamless \ndevelopment lifecycle.\n\nFor the details for the GitHub Action workflow, please refer to [.github/workflows/maven.yml](.github/workflows/maven.yml)\n\n### Version Control\nA structured approach to version control is employed to maintain consistency and clarity in the project’s history. \nThe following commit message labels are used to categorize changes:\n\n| Label  | Stand for     | Description                                      | Example                                         | \n|--------|---------------|--------------------------------------------------|-------------------------------------------------|\n| `feat` | feature       | Introduces a new feature or enhancement.         | `feat: implement API for fetching posts`        |\n| `doc`  | documentation | Adds or updates documentation (e.g., README).    | `doc: update README with CI/CD details`         | \n| `dep`  | dependency    | Updates dependencies (e.g., Maven, Docker, etc). | `dep: upgrade Spring Boot to version x.y.z`     | \n| `test` | test          | Adds or modifies tests (unit, integration, etc). | `test: add integration test for PostController` |\n\nBy adhering to these labels, the project history remains organized, making it easier for collaborators to track and \nunderstand changes over time.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkma512%2Fblog-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkma512%2Fblog-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkma512%2Fblog-server/lists"}