{"id":26151065,"url":"https://github.com/valpere/testwigr","last_synced_at":"2026-05-03T23:35:32.708Z","repository":{"id":280410741,"uuid":"940081745","full_name":"valpere/testwigr","owner":"valpere","description":"Twitter-like API Server built with Groovy, Spring Boot, and MongoDB.","archived":false,"fork":false,"pushed_at":"2025-03-10T13:54:17.000Z","size":390,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-10T14:35:33.486Z","etag":null,"topics":["api-rest","api-server","groovy","junit5","jwt","mongodb","spock-framework","spring-boot","spring-data-mongodb","spring-security","spring-test"],"latest_commit_sha":null,"homepage":"","language":"Groovy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/valpere.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}},"created_at":"2025-02-27T15:30:13.000Z","updated_at":"2025-03-10T13:54:21.000Z","dependencies_parsed_at":"2025-03-03T09:33:46.018Z","dependency_job_id":"c2325229-60ed-43f4-a18b-284d390f4549","html_url":"https://github.com/valpere/testwigr","commit_stats":null,"previous_names":["valpere/testwigr"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/valpere/testwigr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valpere%2Ftestwigr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valpere%2Ftestwigr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valpere%2Ftestwigr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valpere%2Ftestwigr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/valpere","download_url":"https://codeload.github.com/valpere/testwigr/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valpere%2Ftestwigr/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266770140,"owners_count":23981512,"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-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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-rest","api-server","groovy","junit5","jwt","mongodb","spock-framework","spring-boot","spring-data-mongodb","spring-security","spring-test"],"created_at":"2025-03-11T06:25:07.587Z","updated_at":"2026-05-03T23:35:27.686Z","avatar_url":"https://github.com/valpere.png","language":"Groovy","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Testwigr - Twitter-like API\n\nA robust Twitter-like API built with Groovy, Spring Boot, and MongoDB. This project implements core Twitter functionality including user registration, authentication with JWT, posting, liking, commenting, and following other users.\n\n## Project Setup Requirements\n\n1. **Development Environment**\n   - JDK (Java Development Kit) - version 8 or higher\n   - Groovy installation\n   - IDE (IntelliJ IDEA is recommended for Groovy/Spring development)\n   - Git for version control\n\n2. **Project Configuration**\n   - Spring Boot starter project with Groovy support\n   - Gradle build configuration file (build.gradle)\n   - MongoDB connection configuration\n   - Docker and Docker Compose files for local development\n\n3. **Initial Project Structure**\n   - Models/entities (User, Post, Comment, Like)\n   - Repositories for database interaction\n   - Services for business logic\n   - Controllers for API endpoints\n   - Test packages for Spock framework tests\n\n4. **Documentation**\n   - API documentation (Swagger/OpenAPI)\n   - README with setup instructions\n\n## Features\n\n- **User Management**\n  - Registration and authentication with JWT\n  - Profile management (view, edit, delete)\n  - Follow/unfollow users\n  - Secure password handling\n\n- **Post Management**\n  - Create, edit, and delete posts\n  - View posts from specific users\n  - Personal feed (posts from followed users)\n  - User feed (posts from a specific user)\n\n- **Social Interactions**\n  - Like/unlike posts\n  - Comment on posts\n  - View post statistics (likes, comments)\n  - Follow/unfollow relationships\n\n- **Feed Generation**\n  - Personalized feed of posts from followed users\n  - User-specific feeds\n  - Chronological post ordering\n  - Pagination support\n\n## Tech Stack\n\n- **Backend**\n  - Groovy 4.0.25\n  - Spring Boot 3.4.3\n  - Spring Security\n  - Spring Data MongoDB\n  - JWT for authentication\n\n- **Database**\n  - MongoDB\n\n- **Build \u0026 Deployment**\n  - Gradle\n  - Docker\n  - Docker Compose\n  - NGINX (for production)\n\n- **Testing**\n  - Spock Framework\n  - JUnit 5\n  - Spring Test\n\n## Getting Started\n\n### Prerequisites\n\n- JDK 21 or higher\n- Docker and Docker Compose\n- Git\n\n### Local Development Setup\n\n1. **Clone the repository**\n\n   ```bash\n   git clone https://github.com/yourusername/testwigr.git\n   cd testwigr\n   ```\n\n2. **Environment Configuration**\n\n   ```bash\n   cp .env.template .env\n   # Edit .env with appropriate values\n   ```\n\n3. **Start MongoDB using Docker**\n\n   ```bash\n   docker-compose -f docker/docker-compose.yml up -d mongodb\n   ```\n\n4. **Build the application**\n\n   ```bash\n   ./gradlew build -x test\n   ```\n\n5. **Run the application**\n\n   ```bash\n   ./gradlew bootRun\n   ```\n\n   Or use Docker to run the entire stack:\n\n   ```bash\n   docker-compose -f docker/docker-compose.yml up -d\n   ```\n\n6. **Access the API**\n   - The API will be available at `http://localhost:8080`\n   - Swagger UI documentation is available at `http://localhost:8080/swagger-ui.html`\n\n### Running Tests\n\nFor detailed information about testing, please refer to [TESTING.md](TESTING.md).\n\nBasic test commands:\n\n```bash\n# Start test MongoDB\n./scripts/start-test-db.sh\n\n# Run all tests\n./gradlew test\n\n# Run specific test categories\n./gradlew test --tests \"com.example.testwigr.repository.*\"\n./gradlew test --tests \"com.example.testwigr.service.*\"\n./gradlew test --tests \"com.example.testwigr.controller.*\"\n./gradlew test --tests \"com.example.testwigr.integration.*\"\n\n# Stop test MongoDB\n./scripts/stop-test-db.sh\n```\n\n### Deployment\n\nFor comprehensive deployment instructions, including production setup, please refer to [DEPLOY.md](DEPLOY.md).\n\n## API Endpoints Overview\n\nTestwigr provides a comprehensive API surface with these main endpoint categories:\n\n### Authentication Endpoints\n\n- `POST /api/auth/register` - User registration\n- `POST /api/auth/login` - Authentication and token issuance\n- `POST /api/auth/logout` - Session termination\n\n### User Management Endpoints\n\n- `GET /api/users/{username}` - Retrieve user profiles\n- `GET /api/users/me` - Get authenticated user's profile\n- `PUT /api/users/{id}` - Update user information\n- `DELETE /api/users/{id}` - Remove user accounts\n\n### Post Management Endpoints\n\n- `POST /api/posts` - Create new posts\n- `GET /api/posts/{id}` - Retrieve specific posts\n- `GET /api/posts/user/{userId}` - Get all posts by a user\n- `PUT /api/posts/{id}` - Update existing posts\n- `DELETE /api/posts/{id}` - Remove posts\n\n### Social Interaction Endpoints\n\n- `POST /api/follow/{followingId}` - Follow users\n- `DELETE /api/follow/{followingId}` - Unfollow users\n- `GET /api/follow/followers` - List followers\n- `GET /api/follow/following` - List followed users\n- `POST /api/likes/posts/{postId}` - Like posts\n- `DELETE /api/likes/posts/{postId}` - Unlike posts\n- `POST /api/comments/posts/{postId}` - Add comments\n- `GET /api/comments/posts/{postId}` - Get post comments\n\n### Feed Endpoints\n\n- `GET /api/feed` - Retrieve personalized content feeds\n- `GET /api/feed/users/{username}` - Get user-specific feeds\n\n### System Endpoints\n\n- `GET /api/health` - System health check\n- `GET /api/health/info` - System information\n\n## Project Structure\n\n```plaintext\ntestwigr/\n├── docker/                    # Docker configurations\n├── scripts/                   # Utility scripts\n├── src/\n│   ├── main/\n│   │   ├── groovy/            # Application source code\n│   │   │   └── com/example/testwigr/\n│   │   │       ├── config/    # Application configurations\n│   │   │       ├── controller/ # API endpoints\n│   │   │       ├── exception/ # Exception handling\n│   │   │       ├── model/     # Domain entities\n│   │   │       ├── repository/ # Data access layer\n│   │   │       ├── security/  # JWT authentication\n│   │   │       ├── service/   # Business logic\n│   │   │       └── TestwigrApplication.groovy\n│   │   └── resources/         # Application resources\n│   └── test/                  # Test source code\n│       ├── groovy/            # Test classes\n│       │   └── com/example/testwigr/\n│       │       ├── config/    # Test configurations\n│       │       ├── controller/ # Controller tests\n│       │       ├── integration/ # Integration tests\n│       │       ├── repository/ # Repository tests\n│       │       ├── security/  # Security tests\n│       │       ├── service/   # Service tests\n│       │       └── test/      # Test utilities\n│       └── resources/         # Test resources\n├── build.gradle               # Gradle build configuration\n├── DEPLOY.md                  # Deployment documentation\n├── LICENSE                    # Project license (Apache 2.0)\n├── README.md                  # This file\n├── settings.gradle            # Gradle settings\n├── TESTING.md                 # Testing documentation\n└── .env.template              # Environment variable template\n```\n\n## Security\n\nThe application uses JWT (JSON Web Tokens) for authentication:\n\n1. Users register and login to receive a JWT token.\n2. The token must be included in the Authorization header of subsequent requests.\n3. Protected endpoints verify the token through a filter chain.\n\nExample of using JWT with curl:\n\n```bash\n# Login to get token\nTOKEN=$(curl -s -X POST http://localhost:8080/api/auth/login \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"username\":\"testuser\",\"password\":\"password123\"}' \\\n  | jq -r '.token')\n\n# Use token in another request\ncurl -X GET http://localhost:8080/api/users/me \\\n  -H \"Authorization: Bearer $TOKEN\"\n```\n\n## Monitoring\n\nThe application exposes several monitoring endpoints through Spring Actuator:\n\n- `/actuator/health` - Application health information\n- `/actuator/metrics` - Application metrics\n- `/actuator/prometheus` - Prometheus-formatted metrics\n\nFor production deployments, a complete monitoring stack with Prometheus and Grafana is available. See [DEPLOY.md](DEPLOY.md) for details.\n\n## Detailed Documentation\n\nComprehensive documentation is available in the `doc/` folder.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit pull requests.\n\n1. Fork the repository\n2. Create a feature branch: `git checkout -b feature/new-feature`\n3. Commit your changes: `git commit -am 'Add new feature'`\n4. Push to the branch: `git push origin feature/new-feature`\n5. Submit a pull request\n\nBefore submitting, please ensure that tests pass and code follows the project's coding conventions.\n\n## Future Enhancements\n\nPlans for future development include:\n\n1. Refresh token implementation\n2. Redis caching for performance optimization\n3. Media attachments support\n4. Advanced feed algorithms with personalization\n5. Real-time notifications\n6. Full-text search functionality\n7. Content moderation features\n\n## License\n\nThis project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalpere%2Ftestwigr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalpere%2Ftestwigr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalpere%2Ftestwigr/lists"}