{"id":17838145,"url":"https://github.com/sandesh300/book-social-network-angular","last_synced_at":"2026-02-13T16:32:46.362Z","repository":{"id":258316317,"uuid":"873593114","full_name":"sandesh300/Book-Social-Network-Angular","owner":"sandesh300","description":"Book Social Network Angular","archived":false,"fork":false,"pushed_at":"2024-12-03T15:27:56.000Z","size":766,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-08T04:46:00.078Z","etag":null,"topics":["angular","docker","java","javascript","postgresql","rest-api","springboot"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/sandesh300.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-10-16T12:32:28.000Z","updated_at":"2025-02-07T17:01:05.000Z","dependencies_parsed_at":"2024-11-21T13:23:32.423Z","dependency_job_id":"b1ba505b-ef3d-4cfa-b698-281989ee0ec5","html_url":"https://github.com/sandesh300/Book-Social-Network-Angular","commit_stats":null,"previous_names":["sandesh300/book-social-network-angular"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandesh300%2FBook-Social-Network-Angular","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandesh300%2FBook-Social-Network-Angular/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandesh300%2FBook-Social-Network-Angular/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandesh300%2FBook-Social-Network-Angular/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sandesh300","download_url":"https://codeload.github.com/sandesh300/Book-Social-Network-Angular/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246827758,"owners_count":20840464,"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":["angular","docker","java","javascript","postgresql","rest-api","springboot"],"created_at":"2024-10-27T20:52:27.263Z","updated_at":"2026-02-13T16:32:46.326Z","avatar_url":"https://github.com/sandesh300.png","language":"TypeScript","readme":"# Book Social Network\n\nBook Social Network is a full-stack application that enables users to manage their book collections and engage with a community of book enthusiasts. It offers features such as user registration, secure email validation, book management (including creation, updating, sharing, and archiving), book borrowing with checks for availability, book return functionality, and approval of book returns. The application ensures security using JWT tokens and adheres to best practices in REST API design. The backend is built with Spring Boot 3 and Spring Security 6, postgreSQL database, while the frontend is developed using Angular with Bootstrap for styling.\n\n---\n## Features\n\n- **User Registration:** Users can register for a new account.\n- **Email Validation:** Accounts are activated using secure email validation codes.\n- **User Authentication:** Existing users can log in securely.\n- **Book Management:** Users can create, update, share, and archive their books.\n- **Book Borrowing:** Necessary checks to determine if a book can be borrowed.\n- **Book Returning:** Users can return borrowed books.\n- **Book Return Approval:** Functionality to approve book returns.\n\n## Technologies Used\n### Backend \n\n- Spring Boot 3\n- Spring Security 6\n- JWT Token Authentication\n- Spring Data JPA\n- JSR-303 and Spring Validation\n- OpenAPI and Swagger UI Documentation\n- Docker\n\n### Database\n- PostgreSQL\n\n### Frontend \n\n- Angular\n- Component-Based Architecture\n- Lazy Loading\n- Authentication Guard\n- OpenAPI Generator for Angular\n- Bootstrap\n------\n## Learning Objectives\n\nBy following this project, \n\n- Designing a class diagram from business requirements\n- Implementing a mono repo approach\n- Securing an application using JWT tokens with Spring Security\n- Registering users and validating accounts via email\n- Utilizing inheritance with Spring Data JPA\n- Implementing the service layer and handling application exceptions\n- Object validation using JSR-303 and Spring Validation\n- Handling custom exceptions\n- Implementing pagination and REST API best practices\n- Using Spring Profiles for environment-specific configurations\n- Documenting APIs using OpenAPI and Swagger UI\n- Implementing business requirements and handling business exceptions\n- Dockerizing the infrastructure\n- CI/CD pipeline \u0026 deployment\n\n#### Class diagram\n![class-diagram](https://github.com/user-attachments/assets/35de6f59-e51d-461f-b22a-715b4865b025)\n\n------\n## API Endpoints\n\n### OpenAPI Documentation\n![Screenshot (66)](https://github.com/user-attachments/assets/617c9434-71e3-48a0-881a-4163496812e8)\n![Screenshot (67)](https://github.com/user-attachments/assets/d2499c7f-43e0-4a6d-bd68-46cd9e6da2f0)\n\n### **User Authentication**\n\n1. **Register User**\n   - **Method**: `POST`  \n   - **URL**: `http://localhost:8080/api/v1/auth/register`  \n   - **Request Body**:\n     ```json\n     {\n       \"firstname\": \"sandesh\",\n       \"lastname\": \"bhujbal\",\n       \"email\": \"bhujbalsandesh52@gmail.com\",\n       \"password\": \"Password@123\"\n     }\n     ```\n   - **Response**: `202 Accepted`\n\n2. **Activate Account**\n   - **Method**: `GET`  \n   - **URL**: `http://localhost:8080/api/v1/auth/activate-account?token=\u003cactivation_token\u003e`  \n   - **Response**: `200 OK`\n\n3. **Login User**\n   - **Method**: `POST`  \n   - **URL**: `http://localhost:8080/api/v1/auth/authenticate`  \n   - **Request Body**:\n     ```json\n     {\n       \"email\": \"bhujbalsandesh52@gmail.com\",\n       \"password\": \"Password@123\"\n     }\n     ```\n   - **Response**:\n     ```json\n     {\n       \"token\": \"\u003cJWT_access_token\u003e\"\n     }\n     ```\n     - **Success Code**: `200 OK`\n\n---\n\n### **Book Management**\n\n## Authorization\nAll endpoints require a JWT token.  \nInclude the following header in all requests:\n```http\nAuthorization: Bearer \u003cJWT_access_token\u003e\n```\n---\n\n## Endpoints\n\n### 1. **Save Book**\n- **Method**: `POST`  \n- **URL**: `http://localhost:8088/books`  \n- **Request Body**:  \n  ```json\n  {\n    \"title\": \"Java Spring Boot Book\",\n    \"authorName\": \"James Gosling\",\n    \"isbn\": \"4512\",\n    \"synopsis\": \"Book about Java programming\",\n    \"shareable\": true\n  }\n  ```\n- **Response Body**:  \n  ```json\n  {\n    \"id\": 58\n  }\n  ```\n- **Success Code**: `200 OK`\n\n---\n\n### 2. **Find Book by ID**\n- **Method**: `GET`  \n- **URL**: `http://localhost:8088/books/{book-id}`  \n- **Response Body**:  \n  ```json\n  {\n    \"id\": 58,\n    \"title\": \"Java Spring Boot Book\",\n    \"authorName\": \"James Gosling\",\n    \"isbn\": \"4512\",\n    \"synopsis\": \"Book about Java programming\",\n    \"rate\": 4.5,\n    \"bookCover\": \"http://example.com/cover.jpg\",\n    \"shareable\": true,\n    \"archived\": false\n  }\n  ```\n- **Success Code**: `200 OK`\n\n---\n\n### 3. **Find All Books**\n- **Method**: `GET`  \n- **URL**: `http://localhost:8088/books`  \n- **Query Params**:  \n  - `page`: Page number (default: `0`)  \n  - `size`: Number of items per page (default: `10`)  \n- **Response Body**:  \n  ```json\n  {\n    \"content\": [\n      {\n        \"id\": 58,\n        \"title\": \"Java Spring Boot Book\",\n        \"authorName\": \"James Gosling\",\n        \"rate\": 4.5\n      }\n    ],\n    \"number\": 0,\n    \"size\": 10,\n    \"totalElements\": 1,\n    \"totalPages\": 1,\n    \"first\": true,\n    \"last\": true\n  }\n  ```\n- **Success Code**: `200 OK`\n\n---\n\n### 4. **Find Owner's Books**\n- **Method**: `GET`  \n- **URL**: `http://localhost:8088/books/owner`  \n- **Query Params**: Same as Find All Books  \n- **Response Body**:  \n  ```json\n  {\n    \"content\": [\n      {\n        \"id\": 58,\n        \"title\": \"Java Spring Boot Book\",\n        \"authorName\": \"James Gosling\",\n        \"rate\": 4.5\n      }\n    ],\n    \"number\": 0,\n    \"size\": 10,\n    \"totalElements\": 1,\n    \"totalPages\": 1,\n    \"first\": true,\n    \"last\": true\n  }\n  ```\n- **Success Code**: `200 OK`\n\n---\n\n### 5. **Find Borrowed Books**\n- **Method**: `GET`  \n- **URL**: `http://localhost:8088/books/borrowed`  \n- **Query Params**: Same as Find All Books  \n- **Response Body**:  \n  ```json\n  {\n    \"content\": [\n      {\n        \"bookId\": 58,\n        \"title\": \"Java Spring Boot Book\",\n        \"authorName\": \"James Gosling\",\n        \"isbn\": \"4512\",\n        \"borrowed\": true,\n        \"returned\": false,\n        \"returnApproved\": false\n      }\n    ],\n    \"number\": 0,\n    \"size\": 10,\n    \"totalElements\": 1,\n    \"totalPages\": 1,\n    \"first\": true,\n    \"last\": true\n  }\n  ```\n- **Success Code**: `200 OK`\n\n---\n\n### 6. **Find Returned Books**\n- **Method**: `GET`  \n- **URL**: `http://localhost:8088/books/returned`  \n- **Query Params**: Same as Find All Books  \n- **Response Body**:  \n  ```json\n  {\n    \"content\": [\n      {\n        \"bookId\": 58,\n        \"title\": \"Java Spring Boot Book\",\n        \"authorName\": \"James Gosling\",\n        \"isbn\": \"4512\",\n        \"borrowed\": false,\n        \"returned\": true,\n        \"returnApproved\": true\n      }\n    ],\n    \"number\": 0,\n    \"size\": 10,\n    \"totalElements\": 1,\n    \"totalPages\": 1,\n    \"first\": true,\n    \"last\": true\n  }\n  ```\n- **Success Code**: `200 OK`\n\n---\n\n### 7. **Update Book Shareable Status**\n- **Method**: `PATCH`  \n- **URL**: `http://localhost:8088/books/shareble/{book-id}`  \n- **Response Body**:  \n  ```json\n  {\n    \"id\": 58,\n    \"shareable\": false\n  }\n  ```\n- **Success Code**: `200 OK`\n\n---\n\n### 8. **Update Book Archived Status**\n- **Method**: `PATCH`  \n- **URL**: `http://localhost:8088/books/archived/{book-id}`  \n- **Response Body**:  \n  ```json\n  {\n    \"id\": 58,\n    \"archived\": true\n  }\n  ```\n- **Success Code**: `200 OK`\n\n---\n\n### 9. **Borrow Book**\n- **Method**: `POST`  \n- **URL**: `http://localhost:8088/books/borrow/{book-id}`  \n- **Response Body**:  \n  ```json\n  {\n    \"id\": 1,\n    \"bookId\": 58,\n    \"borrowedBy\": \"sandesh\",\n    \"borrowedAt\": \"2024-10-22T10:15:30Z\"\n  }\n  ```\n- **Success Code**: `200 OK`\n\n---\n\n### 10. **Return Borrowed Book**\n- **Method**: `PATCH`  \n- **URL**: `http://localhost:8088/books/borrow/return/{book-id}`  \n- **Response Body**:  \n  ```json\n  {\n    \"id\": 1,\n    \"bookId\": 58,\n    \"returnedAt\": \"2024-10-22T10:16:36Z\"\n  }\n  ```\n- **Success Code**: `200 OK`\n\n---\n\n### 11. **Approve Book Return**\n- **Method**: `PATCH`  \n- **URL**: `http://localhost:8088/books/borrow/return/approve/{book-id}`  \n- **Response Body**:  \n  ```json\n  {\n    \"id\": 1,\n    \"bookId\": 58,\n    \"returnApproved\": true,\n    \"approvedAt\": \"2024-10-22T10:23:35Z\"\n  }\n  ```\n- **Success Code**: `200 OK`\n\n---\n\n### 12. **Upload Book Cover**\n- **Method**: `POST`  \n- **URL**: `http://localhost:8088/books/cover/{book-id}`  \n- **Request**: Multipart file upload  \n- **Response Body**:  \n  ```json\n  {\n    \"bookId\": 58,\n    \"coverUrl\": \"http://example.com/book-covers/58.jpg\",\n    \"uploadedAt\": \"2024-10-22T10:25:30Z\"\n  }\n  ```\n- **Success Code**: `202 Accepted`\n-----\n## Setup Instructions\n\nTo set up the backend of the Book Social Network project, follow these steps:\n\n1. Clone the repository:\n\n```bash\n   git clone https://github.com/matnrocha/Book-Social-Network.git\n```\n\n2. Run the docker-compose file\n\n```bash\n  docker-compose up -d\n```\n\n3. Navigate to the book-social-network directory:\n\n```bash\n  cd book-social-network\n```\n\n4. Install dependencies (assuming Maven is installed):\n\n```bash\n  mvn clean install\n```\n\n4. Run the application\n\n```bash\n  java -jar target/book-network-0.0.1.jar\n```\n\n5. Access the API documentation using Swagger UI:\n\nOpen a web browser and go to `http://localhost:8088/api/v1/swagger-ui/index.html\n\n6. Access MailDev to receive emails (token receiving):\n\n  Open a web browser and go to `http://localhost:1080/#/\n\n--- \n### Login Page\n![Screenshot (62)](https://github.com/user-attachments/assets/6a4b99dc-934f-4ab4-a23a-119b16cccc8e)\n\n### Register Page\n![Screenshot (63)](https://github.com/user-attachments/assets/1199ffa3-6bfc-481a-aecc-e12bf87278f0)\n\n### Email Verification code \n![Screenshot (68)](https://github.com/user-attachments/assets/fce37064-77d7-4080-9293-ca7bfc2d14b4)\n\n### Book page\n![Screenshot (64)](https://github.com/user-attachments/assets/ea4ac49d-2b65-4fa4-99ea-b3a4e9dfdc0e)\n\n### Book Create Page\n![Screenshot (65)](https://github.com/user-attachments/assets/d632c7fb-4ab3-4ba3-901d-fe9e5a70a29a)\n\n\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandesh300%2Fbook-social-network-angular","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsandesh300%2Fbook-social-network-angular","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandesh300%2Fbook-social-network-angular/lists"}