{"id":28731855,"url":"https://github.com/rkgcloud/crud","last_synced_at":"2026-04-19T04:35:09.660Z","repository":{"id":260202156,"uuid":"880592609","full_name":"rkgcloud/crud","owner":"rkgcloud","description":"An introductory web application written in go with pgsql that runs on kubernetes ","archived":false,"fork":false,"pushed_at":"2026-04-09T00:39:46.000Z","size":16114,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-09T02:22:11.233Z","etag":null,"topics":["database","go","golang","gorm","kubernetes","kubernetes-deployment","pgsql","web"],"latest_commit_sha":null,"homepage":"","language":"Go","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/rkgcloud.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2024-10-30T01:52:36.000Z","updated_at":"2026-04-09T00:39:51.000Z","dependencies_parsed_at":"2025-07-25T03:16:37.498Z","dependency_job_id":"22e7b9e0-33a6-4a6b-83db-47536fbd347b","html_url":"https://github.com/rkgcloud/crud","commit_stats":null,"previous_names":["rkgcloud/crud"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/rkgcloud/crud","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkgcloud%2Fcrud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkgcloud%2Fcrud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkgcloud%2Fcrud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkgcloud%2Fcrud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rkgcloud","download_url":"https://codeload.github.com/rkgcloud/crud/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkgcloud%2Fcrud/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31995166,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"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":["database","go","golang","gorm","kubernetes","kubernetes-deployment","pgsql","web"],"created_at":"2025-06-15T19:11:25.299Z","updated_at":"2026-04-19T04:35:09.653Z","avatar_url":"https://github.com/rkgcloud.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CRUD Application\n\nA secure, production-ready CRUD application built with Go, featuring comprehensive security middleware, health checks, and enterprise-grade reliability.\n\n## Features\n\n- 🔒 **Security**: Rate limiting, CORS protection, security headers, input validation\n- 📊 **Monitoring**: Health checks, metrics, structured logging\n- 🧪 **Testing**: Comprehensive unit and integration tests\n- 🚀 **Production Ready**: Graceful shutdown, configuration management\n- 🔧 **CI/CD**: Automated testing, security scanning, and deployment\n\n## Quick Start\n\n### Local Development\n\n1. **Start PostgreSQL database:**\n   ```shell\n   make run-db\n   ```\n\n2. **Set environment variables:**\n   ```shell\n   export KO_DATA_PATH=$(pwd)/kodata\n   export DATABASE_URL=\"host=localhost user=postgres password=mysecretpassword dbname=postgres sslmode=disable\"\n   export SECRET=\"your-32-character-secret-key-here\"\n   ```\n\n3. **Run the application:**\n   ```shell\n   make run\n   ```\n\n### Testing\n\n```shell\n# Run unit tests\nmake test\n\n# Run integration tests (requires running app)\nmake test-integration\n\n# Run all tests\nmake test-all\n```\n\n### Building\n\n```shell\n# Build the application\nmake build\n\n# The binary will be available at .bin/crud\n```\n\n## Health Endpoints\n\nThe application provides several health check endpoints:\n\n- `GET /health/live` - Liveness probe\n- `GET /health/ready` - Readiness probe with database connectivity check\n- `GET /health/` - Comprehensive health status\n- `GET /health/metrics` - Application metrics and runtime information\n\n## Configuration\n\nAll configuration is environment-based with sensible defaults:\n\n| Environment Variable | Default | Description |\n|---------------------|---------|-------------|\n| `PORT` | `8080` | Server port |\n| `DEBUG` | `false` | Debug mode |\n| `SECRET` | *(required)* | Session secret (min 32 chars) |\n| `DATABASE_URL` | `host=localhost...` | PostgreSQL connection string |\n| `RATE_LIMIT_PER_MINUTE` | `60` | Rate limit per IP per minute |\n| `ALLOWED_ORIGINS` | `http://localhost:8080` | CORS allowed origins |\n\n## CI/CD Pipeline\n\nThe project uses GitHub Actions for continuous integration and deployment:\n\n### Workflow Jobs\n\n1. **Lint** - Code quality checks with golangci-lint\n2. **Test** - Unit tests with PostgreSQL service\n3. **Build** - Application build verification\n4. **Security** - Security scanning with Gosec\n5. **Integration** - End-to-end integration tests\n\n### Security Features\n\n- **Gosec** security scanning\n- **Dependency scanning** with GitHub's security features\n- **SARIF** upload for security findings\n- **Codecov** integration for test coverage\n\n### Running CI Locally\n\nYou can run the same checks locally:\n\n```shell\n# Lint\ngolangci-lint run\n\n# Test with coverage\nmake test\n\n# Build\nmake build\n\n# Integration tests\n./hack/integration-test.sh\n```\n\n## Kubernetes Deployment\n\n### Install CRUD database\n```shell\nmake db-deploy\n```\n\n### Install CRUD application\n```shell\nmake deploy\n```\n\n### Connect from cluster\n```shell\nkubectl port-forward service/go-postgres-crud-service 8080:8080\n```\n\n## Security\n\nThis application implements multiple layers of security:\n\n- **Rate Limiting**: IP-based rate limiting with configurable limits\n- **CORS Protection**: Configurable CORS with secure defaults  \n- **Security Headers**: CSP, XSS protection, frame options, HSTS\n- **Input Validation**: Comprehensive validation for all user inputs\n- **Session Security**: Secure session configuration with HttpOnly, Secure, SameSite\n- **SQL Injection Protection**: Parameterized queries and GORM protections\n- **OAuth Security**: CSRF-protected OAuth flow with secure state tokens\n\n## Architecture\n\n```\n├── cmd/                    # Application entrypoints\n├── pkg/\n│   ├── config/            # Configuration management\n│   ├── controllers/       # HTTP request handlers\n│   ├── middleware/        # Security middleware\n│   ├── models/           # Data models\n│   ├── health/           # Health checks and metrics\n│   ├── auth/             # Authentication types\n│   ├── session/          # Session management\n│   └── database/         # Database connectivity\n├── hack/                 # Development scripts and utilities\n├── .github/workflows/    # CI/CD pipelines\n└── kodata/              # Static assets and templates\n```\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes with tests\n4. Run `make test-all` to verify\n5. Submit a pull request\n\nThe CI pipeline will automatically run all checks on your pull request.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frkgcloud%2Fcrud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frkgcloud%2Fcrud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frkgcloud%2Fcrud/lists"}