{"id":31079654,"url":"https://github.com/fabriceyopa/spring-api-postgres","last_synced_at":"2026-05-11T03:11:38.918Z","repository":{"id":163380162,"uuid":"113578755","full_name":"fabriceyopa/spring-api-postgres","owner":"fabriceyopa","description":"A Simple Spring Boot API Demo with Postgres","archived":false,"fork":false,"pushed_at":"2025-09-05T16:28:29.000Z","size":66,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-05T18:36:47.595Z","etag":null,"topics":["api","docker","postgresql","spring-boot"],"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/fabriceyopa.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-12-08T13:44:19.000Z","updated_at":"2025-09-05T16:28:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"21a0bcd8-8aca-4ef3-bca1-403cbeb9ddfc","html_url":"https://github.com/fabriceyopa/spring-api-postgres","commit_stats":null,"previous_names":["fabriceyopa/spring-api-postgres"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fabriceyopa/spring-api-postgres","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabriceyopa%2Fspring-api-postgres","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabriceyopa%2Fspring-api-postgres/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabriceyopa%2Fspring-api-postgres/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabriceyopa%2Fspring-api-postgres/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabriceyopa","download_url":"https://codeload.github.com/fabriceyopa/spring-api-postgres/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabriceyopa%2Fspring-api-postgres/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275406963,"owners_count":25459377,"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-09-16T02:00:10.229Z","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":["api","docker","postgresql","spring-boot"],"created_at":"2025-09-16T10:52:42.748Z","updated_at":"2025-09-16T10:52:46.417Z","avatar_url":"https://github.com/fabriceyopa.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spring Boot API with PostgreSQL\n\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=fayo-labs_spring-api\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=fayo-labs_spring-api)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=fayo-labs_spring-api\u0026metric=coverage)](https://sonarcloud.io/summary/new_code?id=fayo-labs_spring-api)\n\nA modern Spring Boot 3.3.3 REST API application with PostgreSQL database support, Docker Compose integration, and comprehensive testing using Testcontainers.\n\n## Features\n\n- **Spring Boot 3.3.3** with Java 21\n- **PostgreSQL** database with Docker Compose support\n- **Testcontainers** for integration testing\n- **JaCoCo** test coverage reporting\n- **SonarCloud** code quality analysis\n- **GitHub Actions** CI/CD pipeline\n- **RESTful API** for Topics and Courses management\n\n## Technologies Used\n\n- Java 21\n- Spring Boot 3.3.3\n- Spring Data JPA\n- PostgreSQL 16\n- Docker \u0026 Docker Compose\n- Testcontainers\n- JUnit 5\n- Mockito\n- JaCoCo (Test Coverage)\n- Maven\n- GitHub Actions\n\n## Getting Started\n\n### Prerequisites\n\n- Java 21\n- Docker and Docker Compose\n- Maven 3.6+\n\n### Running the Application\n\n1. **Clone the repository**\n\n   ```bash\n   git clone https://github.com/fayo-labs/spring-api-mysql.git\n   cd spring-api-mysql\n   ```\n\n2. **Start PostgreSQL with Docker Compose**\n\n   ```bash\n   docker-compose up -d\n   ```\n\n3. **Run the application**\n   ```bash\n   mvn spring-boot:run\n   ```\n\nThe application will start on `http://localhost:8080`\n\n### Running Tests\n\n**Run all tests:**\n\n```bash\nmvn test\n```\n\n**Run tests with coverage:**\n\n```bash\nmvn clean test jacoco:report\n```\n\n**View coverage report:**\nOpen `target/site/jacoco/index.html` in your browser\n\n### API Endpoints\n\n#### Topics\n\n- `GET /topics` - Get all topics\n- `GET /topics/{id}` - Get topic by ID\n- `POST /topics` - Create new topic\n- `PUT /topics/{id}` - Update topic\n- `DELETE /topics/{id}` - Delete topic\n\n#### Courses\n\n- `GET /topics/{topicId}/courses` - Get courses for a topic\n- `GET /topics/{topicId}/courses/{id}` - Get specific course\n- `POST /topics/{topicId}/courses` - Create new course\n- `PUT /topics/{topicId}/courses/{id}` - Update course\n- `DELETE /topics/{topicId}/courses/{id}` - Delete course\n\n### Example API Usage\n\n**Create a topic:**\n\n```bash\ncurl -X POST http://localhost:8080/topics \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"name\": \"Spring Boot\", \"description\": \"Learn Spring Boot framework\"}'\n```\n\n**Get all topics:**\n\n```bash\ncurl http://localhost:8080/topics\n```\n\n## Database Configuration\n\nThe application uses PostgreSQL as the primary database. Configuration is handled through:\n\n- **Development**: Docker Compose (`compose.yaml`)\n- **Testing**: Testcontainers with PostgreSQL\n- **Production**: Environment variables\n\n### Environment Variables\n\n- `SPRING_DATASOURCE_URL` - Database URL\n- `SPRING_DATASOURCE_USERNAME` - Database username\n- `SPRING_DATASOURCE_PASSWORD` - Database password\n\n## Testing Strategy\n\n### Unit Tests\n\n- Service layer testing with Mockito\n- Repository layer testing with `@DataJpaTest`\n\n### Integration Tests\n\n- Full application context testing with Testcontainers\n- Controller testing with MockMvc\n- Database integration testing\n\n### Test Coverage\n\n- Minimum coverage threshold: 50%\n- JaCoCo reports generated automatically\n- Coverage uploaded to Codecov and SonarCloud\n\n## CI/CD Pipeline\n\nThe project uses GitHub Actions for:\n\n- **Build and Test**: Compile code and run all tests\n- **Test Coverage**: Generate and upload coverage reports\n- **Code Quality**: SonarCloud analysis\n- **Docker Support**: PostgreSQL service for testing\n\n## Docker Support\n\n### Development Environment\n\n```bash\n# Start PostgreSQL\ndocker-compose up -d postgres\n\n# Stop services\ndocker-compose down\n```\n\n### Production Deployment\n\n```bash\n# Build application\nmvn clean package\n\n# Run with Docker Compose\ndocker-compose up --build\n```\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## Code Quality\n\n- **SonarCloud**: Automated code quality analysis\n- **Spotless**: Code formatting with Google Java Format\n- **JaCoCo**: Test coverage reporting\n- **GitHub Actions**: Automated CI/CD pipeline\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n- Spring Boot team for the excellent framework\n- Testcontainers for making integration testing easier\n- PostgreSQL for the robust database system\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabriceyopa%2Fspring-api-postgres","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabriceyopa%2Fspring-api-postgres","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabriceyopa%2Fspring-api-postgres/lists"}