{"id":23252227,"url":"https://github.com/amrmuhamedd/todo-app-go","last_synced_at":"2026-05-05T21:33:49.782Z","repository":{"id":266122768,"uuid":"897451207","full_name":"amrmuhamedd/Todo-App-GO","owner":"amrmuhamedd","description":"A RESTful API for managing todos with user authentication built using Go and modern web technologies.","archived":false,"fork":false,"pushed_at":"2024-12-19T00:14:45.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T02:44:03.665Z","etag":null,"topics":["gin","golang","gorm","jwt","postgresql","swagger"],"latest_commit_sha":null,"homepage":"https://todo-app-go-9o2t.onrender.com/swagger/index.html","language":"Go","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/amrmuhamedd.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-12-02T16:47:10.000Z","updated_at":"2024-12-19T00:18:27.000Z","dependencies_parsed_at":"2025-02-12T08:42:04.547Z","dependency_job_id":"fdcc9462-4b14-4ce8-9296-ed4a05c1724f","html_url":"https://github.com/amrmuhamedd/Todo-App-GO","commit_stats":null,"previous_names":["amrmuhamedd/todo-app-go"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amrmuhamedd%2FTodo-App-GO","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amrmuhamedd%2FTodo-App-GO/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amrmuhamedd%2FTodo-App-GO/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amrmuhamedd%2FTodo-App-GO/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amrmuhamedd","download_url":"https://codeload.github.com/amrmuhamedd/Todo-App-GO/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247426985,"owners_count":20937197,"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":["gin","golang","gorm","jwt","postgresql","swagger"],"created_at":"2024-12-19T10:13:29.529Z","updated_at":"2026-05-05T21:33:49.723Z","avatar_url":"https://github.com/amrmuhamedd.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Todo API\n\nA RESTful API for managing todos with user authentication built using Go and modern web technologies.\n\n![screencapture-localhost-8080-swagger-index-html-2024-12-19-02_12_46](https://github.com/user-attachments/assets/6398ae3a-1fa8-49bd-9d0d-e51b2ca873c6)\n\n## Technology Stack\n\n- **Go** - Main programming language\n- **Gin** - Web framework\n- **GORM** - ORM for database operations\n- **JWT** - Authentication mechanism\n- **PostgreSQL** - Database\n- **Swagger** - API documentation\n- **bcrypt** - Password hashing\n\n## Project Architecture\n\n```\n├── cmd/                  # Application entry points\n├── internal/            # Private application code\n│   ├── auth/           # Authentication logic\n│   ├── config/         # Configuration management\n│   ├── database/       # Database connections and migrations\n│   ├── handlers/       # HTTP request handlers\n│   ├── middleware/     # HTTP middleware components\n│   ├── models/         # Database models\n│   └── routes/         # Route definitions\n├── docs/               # Swagger documentation\n└── main.go            # Main application entry point\n```\n\n### Key Components\n\n1. **Authentication**\n   - JWT-based authentication\n   - Secure password hashing with bcrypt\n   - Protected routes with middleware\n\n2. **Database**\n   - GORM for database operations\n   - PostgreSQL for data persistence\n   - Models for Users and Todos\n\n3. **API Endpoints**\n   - `/api/auth/signup` - User registration\n   - `/api/auth/login` - User authentication\n   - `/api/todos` - Todo CRUD operations\n   - Protected routes with JWT middleware\n\n4. **Documentation**\n   - Swagger UI for API documentation\n   - Auto-generated API specs\n\n## Getting Started\n\n### Prerequisites\n\n1. Go 1.19 or later\n2. PostgreSQL\n\n### Installation\n\n1. Clone the repository\n```bash\ngit clone \u003crepository-url\u003e\ncd todo-api\n```\n\n2. Install dependencies\n```bash\ngo mod download\n```\n\n3. Set up environment variables (create a .env file)\n```env\nJWT_SECRET=your_jwt_secret_key\nDATABASE_URL=postgresql://username:password@localhost:5432/dbname?sslmode=disable\n```\n\n4. Run the application\n```bash\ngo run main.go\n```\n\nThe server will start at `http://localhost:8080`\n\n### API Documentation\n\nAccess the Swagger documentation at:\n```\nhttp://localhost:8080/swagger/index.html\n```\n\n## Development\n\n### Generate Swagger Documentation\n```bash\nswag init\n```\n\n### Run Tests\n```bash\ngo test ./...\n```\n\n### Build for Production\n```bash\ngo build -o todo-api\n```\n\n## Testing\n\n### Running Tests\n```bash\n# Run all tests\ngo test ./...\n\n# Run tests with coverage\ngo test -cover ./...\n\n# Run tests for a specific package\ngo test ./internal/handlers\ngo test ./internal/auth\ngo test ./internal/middleware\n```\n\n### Test Structure\n- `internal/test/test_helpers.go`: Common testing utilities and mock functions\n- `internal/auth/jwt_test.go`: JWT token generation and validation tests\n- `internal/handlers/auth_handler_test.go`: Authentication endpoint tests\n- `internal/handlers/todo_handler_test.go`: Todo CRUD operation tests\n- `internal/middleware/auth_middleware_test.go`: Authentication middleware tests\n\n### Test Coverage\nThe test suite covers:\n- JWT token generation and validation\n- User authentication (signup/login)\n- Todo CRUD operations\n- Authentication middleware\n- Error handling and edge cases\n\n## API Endpoints\n\n### Authentication\n- `POST /api/auth/signup` - Register a new user\n- `POST /api/auth/login` - Login and receive JWT token\n\n### Todos\n- `GET /api/todos` - List all todos\n- `POST /api/todos` - Create a new todo\n- `GET /api/todos/:id` - Get a specific todo\n- `PUT /api/todos/:id` - Update a todo\n- `DELETE /api/todos/:id` - Delete a todo\n\n## Security\n\n- All passwords are hashed using bcrypt\n- JWT tokens are required for protected endpoints\n- Environment variables for sensitive data\n- Input validation on all endpoints\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famrmuhamedd%2Ftodo-app-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famrmuhamedd%2Ftodo-app-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famrmuhamedd%2Ftodo-app-go/lists"}