{"id":29081905,"url":"https://github.com/joao-tinelli/springboot-library-api","last_synced_at":"2026-04-07T09:31:48.846Z","repository":{"id":301610277,"uuid":"1009812125","full_name":"joao-tinelli/springboot-library-api","owner":"joao-tinelli","description":"A comprehensive RESTful API for a bookstore management system built with Java, Spring Boot, Spring Security (JWT/OAuth2), Docker, and PostgreSQL","archived":false,"fork":false,"pushed_at":"2026-03-30T18:01:00.000Z","size":145,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-30T19:31:07.615Z","etag":null,"topics":["aws","docker-compose","java","jpa","jwt","maven","oauth2","postgresql-database","rest-api","spring-boot","spring-security"],"latest_commit_sha":null,"homepage":"","language":"Java","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/joao-tinelli.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-27T18:52:45.000Z","updated_at":"2026-03-30T18:01:07.000Z","dependencies_parsed_at":"2025-06-27T19:45:26.209Z","dependency_job_id":"75d7b050-1a60-405c-8132-3dcad740475b","html_url":"https://github.com/joao-tinelli/springboot-library-api","commit_stats":null,"previous_names":["joao-tinelli/library-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/joao-tinelli/springboot-library-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joao-tinelli%2Fspringboot-library-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joao-tinelli%2Fspringboot-library-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joao-tinelli%2Fspringboot-library-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joao-tinelli%2Fspringboot-library-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joao-tinelli","download_url":"https://codeload.github.com/joao-tinelli/springboot-library-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joao-tinelli%2Fspringboot-library-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31507988,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"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":["aws","docker-compose","java","jpa","jwt","maven","oauth2","postgresql-database","rest-api","spring-boot","spring-security"],"created_at":"2025-06-27T20:01:20.412Z","updated_at":"2026-04-07T09:31:48.841Z","avatar_url":"https://github.com/joao-tinelli.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spring Boot Library REST API\n\nA comprehensive RESTful API for a bookstore management system, built with Java and Spring Boot. This project serves as a practical demonstration of modern back-end development principles, including robust security, database management, and cloud deployment.\n\n## ✨ Key Features\n\n-   **Full CRUD Operations**: Endpoints for managing books and authors (Create, Read, Update, Delete).\n-   **Robust Security**: Implemented a secure authentication and authorization system using **Spring Security**, with support for both **JWT (JSON Web Tokens)** for stateless authentication and **OAuth2** with Google as an identity provider.\n-   **Role-Based Access Control**: Differentiated access levels for `USER` and `ADMIN` roles, protecting sensitive endpoints.\n-   **Database Management**: Modeled and managed a PostgreSQL database using **Spring Data JPA** and Hibernate for efficient data persistence.\n-   **API Documentation**: Integrated **SpringDoc (Swagger UI)** for clear, interactive, and auto-generated API documentation.\n-   **Containerized Deployment**: Application is fully containerized using **Docker**, ensuring a consistent and isolated environment for deployment on platforms like **AWS**.\n\n---\n\n## 🛠️ Technology Stack\n\nThis project is built with a modern and robust set of technologies:\n\n-   **Framework**: Spring Boot 3\n-   **Language**: Java 17\n-   **Database**: PostgreSQL\n-   **Security**: Spring Security, JWT, OAuth2\n-   **ORM**: Spring Data JPA, Hibernate\n-   **API Documentation**: SpringDoc (OpenAPI 3)\n-   **Containerization**: Docker\n-   **Testing**: JUnit 5, Mockito, RestAssured, Testcontainers\n-   **Build Tool**: Maven\n-   **Utilities**: Lombok, MapStruct\n\n---\n\n## 🚀 Getting Started\n\nFollow these instructions to get a local copy of the project up and running for development and testing purposes.\n\n### Prerequisites\n\n-   [JDK 17](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) or later\n-   [Apache Maven](https://maven.apache.org/download.cgi)\n-   [Docker](https://www.docker.com/products/docker-desktop/) and Docker Compose\n-   A PostgreSQL instance (or you can use the provided `docker-compose.yml`)\n\n### Installation \u0026 Setup\n\n1.  **Clone the repository:**\n    ```bash\n    git clone [https://github.com/joao-tinelli/springboot-library-api.git](https://github.com/joao-tinelli/springboot-library-api.git)\n    cd springboot-library-api\n    ```\n\n2.  **Set up the database with Docker (Recommended for Dev):**\n    This is the easiest way to get a PostgreSQL database running for local development.\n    ```bash\n    docker-compose up -d\n    ```\n    This command will start a PostgreSQL container with the default settings specified in the `application.yml`.\n\n3.  **Configure Environment Variables for Local Run:**\n    If you plan to run the app locally with `mvn spring-boot:run`, you must configure the environment variables for database credentials and Google OAuth2. You can set them in your IDE's run configuration or export them in your terminal.\n\n    **For Database Connection (if not using Docker Compose defaults):**\n    ```bash\n    export DATASOURCE_URL=jdbc:postgresql://localhost:5432/library\n    export DATASOURCE_USERNAME=postgres\n    export DATASOURCE_PASSWORD=postgres\n    ```\n\n    **For Google OAuth2 Login:**\n    ```bash\n    export GOOGLE_CLIENT_ID=\u003cyour-google-client-id\u003e\n    export GOOGLE_CLIENT_SECRET=\u003cyour-google-client-secret\u003e\n    ```\n\n4.  **Run the application locally:**\n    ```bash\n    mvn spring-boot:run\n    ```\n    The API will be available at `http://localhost:8080`.\n\n---\n\n## 🐳 Running with Docker (Production-like)\n\nThe provided `Dockerfile` allows you to build a self-contained image of the application. This is ideal for deploying the application in a production or staging environment.\n\n1.  **Build the Docker image:**\n    From the root of the project, run the following command to build the image.\n    ```bash\n    docker build -t library-api .\n    ```\n\n2.  **Run the Docker container:**\n    When running the container, you must provide the necessary environment variables for the database connection and Google OAuth2 credentials. Make sure the application container can connect to your PostgreSQL instance (it could be another Docker container or a cloud database).\n\n    ```bash\n    docker run -p 8080:8080 \\\n      -e SPRING_PROFILES_ACTIVE=production \\\n      -e DATASOURCE_URL=\u003cyour-db-url\u003e \\\n      -e DATASource_USERNAME=\u003cyour-db-username\u003e \\\n      -e DATASOURCE_PASSWORD=\u003cyour-db-password\u003e \\\n      -e GOOGLE_CLIENT_ID=\u003cyour-google-client-id\u003e \\\n      -e GOOGLE_CLIENT_SECRET=\u003cyour-google-client-secret\u003e \\\n      library-api\n    ```\n    The application will now be running inside a Docker container and accessible at `http://localhost:8080`.\n\n---\n\n## 🧪 Running Tests\n\nThis project includes a comprehensive suite of Unit and Integration Tests.\n\nTo run all tests, including integration tests that utilize **Testcontainers** to spin up a real PostgreSQL database instance automatically:\n\n```bash\nmvn test\n```\n\n*Note: Ensure your Docker daemon is running before executing the tests, as Testcontainers requires it to start the database container.*\n\n---\n\n## 📖 API Documentation\n\nThe API is documented using SpringDoc and OpenAPI 3. Once the application is running, you can access the interactive Swagger UI to explore and test the endpoints.\n\n-   **Swagger UI URL**: [http://localhost:8080/swagger-ui.html](http://localhost:8080/swagger-ui.html)\n\nYou will find a complete list of available endpoints, request/response models, and the ability to execute API calls directly from your browser.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoao-tinelli%2Fspringboot-library-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoao-tinelli%2Fspringboot-library-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoao-tinelli%2Fspringboot-library-api/lists"}