{"id":33164980,"url":"https://github.com/osopromadze/Spring-Boot-Blog-REST-API","last_synced_at":"2025-11-16T12:01:02.910Z","repository":{"id":37766706,"uuid":"156704256","full_name":"osopromadze/Spring-Boot-Blog-REST-API","owner":"osopromadze","description":"Restful CRUD Blog API using Spring Boot, Spring Security, JWT, Mysql, JPA","archived":false,"fork":false,"pushed_at":"2024-06-06T15:35:00.000Z","size":312,"stargazers_count":726,"open_issues_count":8,"forks_count":331,"subscribers_count":13,"default_branch":"main","last_synced_at":"2024-07-29T11:35:21.309Z","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":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/osopromadze.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"docs/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":"osopromadze","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2018-11-08T12:32:38.000Z","updated_at":"2024-07-29T07:57:26.000Z","dependencies_parsed_at":"2024-05-11T01:28:43.242Z","dependency_job_id":"1dd05d48-89f3-4d7c-822a-56647210ef9d","html_url":"https://github.com/osopromadze/Spring-Boot-Blog-REST-API","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/osopromadze/Spring-Boot-Blog-REST-API","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osopromadze%2FSpring-Boot-Blog-REST-API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osopromadze%2FSpring-Boot-Blog-REST-API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osopromadze%2FSpring-Boot-Blog-REST-API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osopromadze%2FSpring-Boot-Blog-REST-API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/osopromadze","download_url":"https://codeload.github.com/osopromadze/Spring-Boot-Blog-REST-API/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osopromadze%2FSpring-Boot-Blog-REST-API/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284704131,"owners_count":27049848,"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","status":"online","status_checked_at":"2025-11-16T02:00:05.974Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-11-16T00:00:31.634Z","updated_at":"2025-11-16T12:01:02.904Z","avatar_url":"https://github.com/osopromadze.png","language":"Java","funding_links":["https://patreon.com/osopromadze"],"categories":["Educational GitHub Projects"],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.com/coma123/Spring-Boot-Blog-REST-API.svg?branch=development)](https://travis-ci.com/coma123/Spring-Boot-Blog-REST-API) [![Sonarcloud Status](https://sonarcloud.io/api/project_badges/measure?project=coma123_Spring-Boot-Blog-REST-API\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=coma123_Spring-Boot-Blog-REST-API) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/3706/badge)](https://bestpractices.coreinfrastructure.org/projects/3706)\n\n# Spring Boot, MySQL, Spring Security, JWT, JPA, Rest API\n\nBuild Restful CRUD API for a blog using Spring Boot, Mysql, JPA and Hibernate.\n\n## Steps to Setup\n\n**1. Clone the application**\n\n```bash\ngit clone https://github.com/coma123/Spring-Boot-Blog-REST-API.git\n```\n\n**2. Create Mysql database**\n```bash\ncreate database blogapi\n```\n- run `src/main/resources/blogapi.sql`\n\n**3. Change mysql username and password as per your installation**\n\n+ open `src/main/resources/application.properties`\n+ change `spring.datasource.username` and `spring.datasource.password` as per your mysql installation\n\n**4. Run the app using maven**\n\n```bash\nmvn spring-boot:run\n```\nThe app will start running at \u003chttp://localhost:8080\u003e\n\n## Explore Rest APIs\n\nThe app defines following CRUD APIs.\n\n### Auth\n\n| Method | Url | Decription | Sample Valid Request Body | \n| ------ | --- | ---------- | --------------------------- |\n| POST   | /api/auth/signup | Sign up | [JSON](#signup) |\n| POST   | /api/auth/signin | Log in | [JSON](#signin) |\n\n### Users\n\n| Method | Url | Description | Sample Valid Request Body |\n| ------ | --- | ----------- | ------------------------- |\n| GET    | /api/users/me | Get logged in user profile | |\n| GET    | /api/users/{username}/profile | Get user profile by username | |\n| GET    | /api/users/{username}/posts | Get posts created by user | |\n| GET    | /api/users/{username}/albums | Get albums created by user | |\n| GET    | /api/users/checkUsernameAvailability | Check if username is available to register | |\n| GET    | /api/users/checkEmailAvailability | Check if email is available to register | |\n| POST   | /api/users | Add user (Only for admins) | [JSON](#usercreate) |\n| PUT    | /api/users/{username} | Update user (If profile belongs to logged in user or logged in user is admin) | [JSON](#userupdate) |\n| DELETE | /api/users/{username} | Delete user (For logged in user or admin) | |\n| PUT    | /api/users/{username}/giveAdmin | Give admin role to user (only for admins) | |\n| PUT    | /api/users/{username}/TakeAdmin | Take admin role from user (only for admins) | |\n| PUT    | /api/users/setOrUpdateInfo | Update user profile (If profile belongs to logged in user or logged in user is admin) | [JSON](#userinfoupdate) |\n\n### Posts\n\n| Method | Url | Description | Sample Valid Request Body |\n| ------ | --- | ----------- | ------------------------- |\n| GET    | /api/posts | Get all posts | |\n| GET    | /api/posts/{id} | Get post by id | |\n| POST   | /api/posts | Create new post (By logged in user) | [JSON](#postcreate) |\n| PUT    | /api/posts/{id} | Update post (If post belongs to logged in user or logged in user is admin) | [JSON](#postupdate) |\n| DELETE | /api/posts/{id} | Delete post (If post belongs to logged in user or logged in user is admin) | |\n\n### Comments\n\n| Method | Url | Description | Sample Valid Request Body |\n| ------ | --- | ----------- | ------------------------- |\n| GET    | /api/posts/{postId}/comments | Get all comments which belongs to post with id = postId | |\n| GET    | /api/posts/{postId}/comments/{id} | Get comment by id if it belongs to post with id = postId | |\n| POST   | /api/posts/{postId}/comments | Create new comment for post with id = postId (By logged in user) | [JSON](#commentcreate) |\n| PUT    | /api/posts/{postId}/comments/{id} | Update comment by id if it belongs to post with id = postId (If comment belongs to logged in user or logged in user is admin) | [JSON](#commentupdate) |\n| DELETE | /api/posts/{postId}/comments/{id} | Delete comment by id if it belongs to post with id = postId (If comment belongs to logged in user or logged in user is admin) | |\n\n### Albums\n\n| Method | Url | Description | Sample Valid Request Body |\n| ------ | --- | ----------- | ------------------------- |\n| GET    | /api/albums | Get all albums | |\n| GET    | /api/albums/{id} | Get album by id | |\n| POST   | /api/albums | Create new album (By logged in user) | [JSON](#albumcreate) |\n| PUT    | /api/albums/{id} | Update album (If album belongs to logged in user or logged in user is admin) | [JSON](#albumupdate) |\n| DELETE | /api/albums/{id} | Delete album (If album belongs to logged in user or logged in user is admin) | |\n| GET    | /api/albums/{id}/photos | Get all photos which belongs to album with id = id | |\n\n### Photos\n\n| Method | Url | Description | Sample Valid Request Body |\n| ------ | --- | ----------- | ------------------------- |\n| GET    | /api/photos | Get all photos | |\n| GET    | /api/photos/{id} | Get photo by id | |\n| POST   | /api/photos | Create new photo (By logged in user) | [JSON](#photocreate) |\n| PUT    | /api/photos/{id} | Update photo (If photo belongs to logged in user or logged in user is admin) | [JSON](#photoupdate) |\n| DELETE | /api/photos/{id} | Delete photo (If photo belongs to logged in user or logged in user is admin) | |\n\n### Todos\n\n| Method | Url | Description | Sample Valid Request Body |\n| ------ | --- | ----------- | ------------------------- |\n| GET    | /api/todos | Get all todos which belongs to logged in user | |\n| GET    | /api/todos/{id} | Get todo by id (If todo belongs to logged in user) | |\n| POST   | /api/todos | Create new todo (By logged in user) | [JSON](#todocreate) |\n| PUT    | /api/todos/{id} | Update todo (If todo belongs to logged in user) | [JSON](#todoupdate) |\n| DELETE | /api/todos/{id} | Delete todo (If todo belongs to logged in user) | |\n| PUT    | /api/todos/{id}/complete | Mark todo as complete (If todo belongs to logged in user) | |\n| PUT    | /api/todos/{id}/unComplete | Mark todo as uncomplete (If todo belongs to logged in user) | |\n\nTest them using postman or any other rest client.\n\n## Sample Valid JSON Request Bodys\n\n##### \u003ca id=\"signup\"\u003eSign Up -\u003e /api/auth/signup\u003c/a\u003e\n```json\n{\n\t\"firstName\": \"Leanne\",\n\t\"lastName\": \"Graham\",\n\t\"username\": \"leanne\",\n\t\"password\": \"password\",\n\t\"email\": \"leanne.graham@gmail.com\"\n}\n```\n\n##### \u003ca id=\"signin\"\u003eLog In -\u003e /api/auth/signin\u003c/a\u003e\n```json\n{\n\t\"usernameOrEmail\": \"leanne\",\n\t\"password\": \"password\"\n}\n```\n\n##### \u003ca id=\"usercreate\"\u003eCreate User -\u003e /api/users\u003c/a\u003e\n```json\n{\n\t\"firstName\": \"Ervin\",\n\t\"lastName\": \"Howell\",\n\t\"username\": \"ervin\",\n\t\"password\": \"password\",\n\t\"email\": \"ervin.howell@gmail.com\",\n\t\"address\": {\n\t\t\"street\": \"Victor Plains\",\n\t\t\"suite\": \"Suite 879\",\n\t\t\"city\": \"Wisokyburgh\",\n\t\t\"zipcode\": \"90566-7771\",\n\t\t\"geo\": {\n\t\t\t\"lat\": \"-43.9509\",\n\t\t\t\"lng\": \"-34.4618\"\n\t\t}\n\t},\n\t\"phone\": \"010-692-6593 x09125\",\n\t\"website\": \"http://erwinhowell.com\",\n\t\"company\": {\n\t\t\"name\": \"Deckow-Crist\",\n\t\t\"catchPhrase\": \"Proactive didactic contingency\",\n\t\t\"bs\": \"synergize scalable supply-chains\"\n\t}\n}\n```\n\n##### \u003ca id=\"userupdate\"\u003eUpdate User -\u003e /api/users/{username}\u003c/a\u003e\n```json\n{\n\t\"firstName\": \"Ervin\",\n\t\"lastName\": \"Howell\",\n\t\"username\": \"ervin\",\n\t\"password\": \"updatedpassword\",\n\t\"email\": \"ervin.howell@gmail.com\",\n\t\"address\": {\n\t\t\"street\": \"Victor Plains\",\n\t\t\"suite\": \"Suite 879\",\n\t\t\"city\": \"Wisokyburgh\",\n\t\t\"zipcode\": \"90566-7771\",\n\t\t\"geo\": {\n\t\t\t\"lat\": \"-43.9509\",\n\t\t\t\"lng\": \"-34.4618\"\n\t\t}\n\t},\n\t\"phone\": \"010-692-6593 x09125\",\n\t\"website\": \"http://erwinhowell.com\",\n\t\"company\": {\n\t\t\"name\": \"Deckow-Crist\",\n\t\t\"catchPhrase\": \"Proactive didactic contingency\",\n\t\t\"bs\": \"synergize scalable supply-chains\"\n\t}\n}\n```\n\n##### \u003ca id=\"userinfoupdate\"\u003eUpdate User Profile -\u003e /api/users/setOrUpdateInfo\u003c/a\u003e\n```json\n{\n\t\"street\": \"Douglas Extension\",\n\t\"suite\": \"Suite 847\",\n\t\"city\": \"McKenziehaven\",\n\t\"zipcode\": \"59590-4157\",\n\t\"companyName\": \"Romaguera-Jacobson\",\n\t\"catchPhrase\": \"Face to face bifurcated interface\",\n\t\"bs\": \"e-enable strategic applications\",\n\t\"website\": \"http://ramiro.info\",\n\t\"phone\": \"1-463-123-4447\",\n\t\"lat\": \"-68.6102\",\n\t\"lng\": \"-47.0653\"\n}\n```\n\n##### \u003ca id=\"postcreate\"\u003eCreate Post -\u003e /api/posts\u003c/a\u003e\n```json\n{\n\t\"title\": \"sunt aut facere repellat provident occaecati excepturi optio reprehenderit\",\n\t\"body\": \"quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto\"\n}\n```\n\n##### \u003ca id=\"postupdate\"\u003eUpdate Post -\u003e /api/posts/{id}\u003c/a\u003e\n```json\n{\n\t\"title\": \"UPDATED UPDATED UPDATED UPDATED UPDATED UPDATED\",\n\t\"body\": \"UPDATED UPDATED UPDATED UPDATED UPDATED UPDATED UPDATED UPDATED UPDATED UPDATED UPDATED UPDATED \"\n}\n```\n\n##### \u003ca id=\"commentcreate\"\u003eCreate Comment -\u003e /api/posts/{postId}/comments\u003c/a\u003e\n```json\n{\n\t\"body\": \"laudantium enim quasi est quidem magnam voluptate ipsam eos tempora quo necessitatibus dolor quam autem quasi reiciendis et nam sapiente accusantium\"\n}\n```\n\n##### \u003ca id=\"commentupdate\"\u003eUpdate Comment -\u003e /api/posts/{postId}/comments/{id}\u003c/a\u003e\n```json\n{\n\t\"body\": \"UPDATED UPDATED UPDATED UPDATED UPDATED UPDATED UPDATED UPDATED UPDATED UPDATED \"\n}\n```\n\n##### \u003ca id=\"albumcreate\"\u003eCreate Album -\u003e /api/albums\u003c/a\u003e\n```json\n{\n\t\"title\": \"quidem molestiae enim\"\n}\n```\n\n##### \u003ca id=\"albumupdate\"\u003eUpdate Album -\u003e /api/albums/{id}\u003c/a\u003e\n```json\n{\n\t\"title\": \"quidem molestiae enim UPDATED\"\n}\n```\n\n##### \u003ca id=\"photocreate\"\u003eCreate Photo -\u003e /api/photos\u003c/a\u003e\n```json\n{\n\t\"title\": \"accusamus beatae ad facilis cum similique qui sunt\",\n\t\"url\": \"https://via.placeholder.com/600/92c952\",\n\t\"thumbnailUrl\": \"https://via.placeholder.com/150/92c952\",\n\t\"albumId\": 2\n}\n```\n\n##### \u003ca id=\"photoupdate\"\u003eUpdate Photo -\u003e /api/photos{id}\u003c/a\u003e\n```json\n{\n\t\"title\": \"accusamus beatae ad facilis \",\n\t\"url\": \"https://via.placeholder.com/600/771796\",\n\t\"thumbnailUrl\": \"https://via.placeholder.com/150/771796\",\n\t\"albumId\": 4\n}\n```\n\n##### \u003ca id=\"todocreate\"\u003eCreate Todo -\u003e /api/todos\u003c/a\u003e\n```json\n{\n\t\"title\": \"delectus aut autem\",\n\t\"completed\": false\n}\n```\n\n##### \u003ca id=\"todoupdate\"\u003eUpdate Todo -\u003e /api/todos{id}\u003c/a\u003e\n```json\n{\n\t\"title\": \"delectus aut autem Updated\",\n\t\"completed\": true\n}\n```\n![segment](https://api.segment.io/v1/pixel/track?data=ewogICJ3cml0ZUtleSI6ICJwcDJuOTU4VU1NT21NR090MWJXS0JQd0tFNkcydW51OCIsCiAgInVzZXJJZCI6ICIxMjNibG9nYXBpMTIzIiwKICAiZXZlbnQiOiAiQmxvZ0FwaSB2aXNpdGVkIiwKICAicHJvcGVydGllcyI6IHsKICAgICJzdWJqZWN0IjogIkJsb2dBcGkgdmlzaXRlZCIsCiAgICAiZW1haWwiOiAiY29tcy5zcHVyc0BnbWFpbC5jb20iCiAgfQp9)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosopromadze%2FSpring-Boot-Blog-REST-API","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fosopromadze%2FSpring-Boot-Blog-REST-API","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosopromadze%2FSpring-Boot-Blog-REST-API/lists"}