{"id":21423252,"url":"https://github.com/karanxidhu/websocket-go-prisma","last_synced_at":"2025-03-16T20:25:43.267Z","repository":{"id":263268655,"uuid":"889843522","full_name":"Karanxidhu/websocket-go-prisma","owner":"Karanxidhu","description":"A production-ready Go template with WebSocket support and Prisma Go client integration. Features real-time communication capabilities and clean REST API endpoints.","archived":false,"fork":false,"pushed_at":"2025-01-03T17:24:38.000Z","size":10865,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-23T07:11:26.741Z","etag":null,"topics":["go","golang","prisma","websocket"],"latest_commit_sha":null,"homepage":"","language":"Go","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/Karanxidhu.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":"2024-11-17T11:43:45.000Z","updated_at":"2025-01-03T17:24:42.000Z","dependencies_parsed_at":"2024-11-17T13:25:55.128Z","dependency_job_id":"a2b71d94-99ad-457a-b86b-2564db736590","html_url":"https://github.com/Karanxidhu/websocket-go-prisma","commit_stats":null,"previous_names":["karanxidhu/websocket-go-prisma"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Karanxidhu%2Fwebsocket-go-prisma","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Karanxidhu%2Fwebsocket-go-prisma/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Karanxidhu%2Fwebsocket-go-prisma/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Karanxidhu%2Fwebsocket-go-prisma/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Karanxidhu","download_url":"https://codeload.github.com/Karanxidhu/websocket-go-prisma/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243926709,"owners_count":20370026,"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":["go","golang","prisma","websocket"],"created_at":"2024-11-22T21:15:20.646Z","updated_at":"2025-03-16T20:25:43.240Z","avatar_url":"https://github.com/Karanxidhu.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go WebSocket Template with Prisma Go Client\n\nA modern Go template featuring WebSocket support and Prisma Go client for efficient database operations.\n\n## 🚀 Features\n\n- **WebSocket Integration**: Real-time bidirectional communication\n- **Prisma Go Client**: Type-safe database operations\n- **RESTful API**: Simple and clean HTTP endpoints\n- **Database Integration**: Efficient database operations using Prisma Go client\n- **Modern Architecture**: Follows Go best practices\n\n## 📋 Prerequisites\n\n- Go 1.16 or higher\n- Prisma Go client\n- Database (PostgreSQL recommended)\n\n## 🛠️ Installation\n\n1. Clone the repository\n```bash\ngit clone https://github.com/yourusername/project-name\ncd project-name\n```\n\n2. Install dependencies\n```bash\ngo mod download\n```\n\n3. Set up your environment variables\n```bash\ncp .env.example .env\n# Edit .env with your database credentials\n```\n\n4. Generate Prisma Go client\n```bash\ngo run github.com/steebchen/prisma-client-go generate\n```\n\n5. Start the server\n```bash\ngo run main.go\n```\n\n## 🏗️ Project Structure\n\n```\n.\n├── main.go\n├── client.go\n├── manager.go\n├── events.go\n├── config/\n│   └── database.go\n├── controller/\n│   └── user_controller.go\n├── data/\n│   └── request/\n│       ├── user_create_req.go\n│       └── user_update_req.go\n│   └── response/\n│       ├── user_response.go\n│       └── web_response.go\n├── helper/\n│   └── json.go\n├── repository/\n│   ├── post_repo.go\n│   └── user_repo_impl.go\n├── service/\n│   ├── user_service_impl.go\n│   └── user_service.go\n├── model/\n│   ├── file.go\n│   ├── user.go\n│   └── room.go\n├── prisma/\n│   ├── schema.prisma\n│   └── migrations/\n├── pkg/\n│   ├── database/\n│   └── websocket/\n├── .env.example\n├── go.mod\n└── README.md\n```\n\n## 🔌 WebSocket Usage\n\nConnect to the WebSocket endpoint:\n```javascript\nconst ws = new WebSocket('ws://localhost:8080/ws');\n```\n\n## 🗄️ Database Operations\n\nExample of using Prisma Go client:\n```go\n// Create a new user\nuser, err := client.User.CreateOne(\n    db.User.Email.Set(\"example@email.com\"),\n    db.User.Name.Set(\"John Doe\"),\n).Exec(ctx)\n\n// Find a user\nuser, err := client.User.FindFirst(\n    db.User.Email.Equals(\"example@email.com\"),\n).Exec(ctx)\n\n// Update a user\nuser, err := client.User.FindUnique(\n    db.User.ID.Equals(\"user-id\"),\n).Update(\n    db.User.Name.Set(\"Jane Doe\"),\n).Exec(ctx)\n```\n\n## 📡 API Endpoints\n\n| Method | Endpoint | Description |\n|--------|----------|-------------|\n| GET    | /api/users | Get all users |\n| POST   | /api/users | Create new user |\n| GET    | /api/users/:id | Get user by ID |\n| PUT    | /api/users/:id | Update user |\n| DELETE | /api/users/:id | Delete user |\n| WS     | /ws | WebSocket connection |\n\n## 🛡️ Environment Variables\n\nRequired environment variables:\n```env\nDATABASE_URL=\"postgresql://username:password@localhost:5432/dbname\"\nPORT=8080\n```\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## 📝 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaranxidhu%2Fwebsocket-go-prisma","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaranxidhu%2Fwebsocket-go-prisma","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaranxidhu%2Fwebsocket-go-prisma/lists"}