{"id":49808732,"url":"https://github.com/alamgir-ahosain/go-postgres-crud-rest-api","last_synced_at":"2026-05-12T23:46:43.663Z","repository":{"id":310550573,"uuid":"1040018824","full_name":"alamgir-ahosain/go-postgres-crud-rest-api","owner":"alamgir-ahosain","description":"Build a CRUD REST API in Go (Golang) using PostgreSQL database and Gorilla Mux framework.","archived":false,"fork":false,"pushed_at":"2025-08-19T20:02:20.000Z","size":31,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-12T23:46:03.102Z","etag":null,"topics":["crud-api","go","golang","gorilla-mux","postgresql","rest-api"],"latest_commit_sha":null,"homepage":"","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/alamgir-ahosain.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}},"created_at":"2025-08-18T10:36:20.000Z","updated_at":"2025-08-19T20:02:24.000Z","dependencies_parsed_at":"2025-08-18T21:13:52.743Z","dependency_job_id":"bddc5eb2-6d7b-4d59-9c10-bfda5f39ebdf","html_url":"https://github.com/alamgir-ahosain/go-postgres-crud-rest-api","commit_stats":null,"previous_names":["alamgir-ahosain/go-postgres-crud-rest-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alamgir-ahosain/go-postgres-crud-rest-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alamgir-ahosain%2Fgo-postgres-crud-rest-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alamgir-ahosain%2Fgo-postgres-crud-rest-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alamgir-ahosain%2Fgo-postgres-crud-rest-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alamgir-ahosain%2Fgo-postgres-crud-rest-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alamgir-ahosain","download_url":"https://codeload.github.com/alamgir-ahosain/go-postgres-crud-rest-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alamgir-ahosain%2Fgo-postgres-crud-rest-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32961785,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-12T23:30:32.555Z","status":"ssl_error","status_checked_at":"2026-05-12T23:30:18.191Z","response_time":102,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["crud-api","go","golang","gorilla-mux","postgresql","rest-api"],"created_at":"2026-05-12T23:46:42.847Z","updated_at":"2026-05-12T23:46:43.655Z","avatar_url":"https://github.com/alamgir-ahosain.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## GO PostgreSQL CRUD REST API\r\nBuild a `CRUD` `REST API` in `Go (Golang)` using `PostgreSQL` database and `Gorilla/Mux` framework. \r\n\r\n\u003eFor PostgreSQL\r\n## Installation\r\n1. **Clone the Repository**\r\n ```bash\r\nhttps://github.com/alamgir-ahosain/go-postgres-crud-rest-api.git\r\n```\r\n2. **Install Dependencies**\u003cbr\u003e\r\n ```bash\r\ngo get github.com/lib/pq\r\ngo get -u github.com/gorilla/mux\r\ngo get github.com/joho/godotenv\r\n```\r\n\r\n##  Database Setup\r\nLogin to PostgreSQL and create the database and table:\r\n```sql\r\nCREATE DATABASE goDB;\r\nUSE goDB;\r\n\r\nCREATE TABLE users (\r\n    id SERIAL PRIMARY KEY,         \r\n    sid VARCHAR(128) NOT NULL,\r\n    name VARCHAR(128) NOT NULL,\r\n    cgpa NUMERIC(5,2)             \r\n);\r\n```\r\n## Run the Application:\r\n1. Start PostgreSQL server.  \r\n2. Update database connection in `db/postgreSql.go`\r\n3. Configure `.env` in `config/.env`\r\n4. Run the Project:\r\n```go\r\ngo run main.go\r\n```\r\n   \r\n##  Project Structure\r\n```plaintext\r\nGO-POSTGRES-CRUD-REST-API\r\n\r\n│── cmd/\r\n│   │─── MyApp\r\n│   │    ├── server.go                # main serve file\r\n│   │\r\n│── internal/\r\n│   ├── api/\r\n│   │   ├── handlers/\r\n│   │   │   ├── get_users/            \r\n│   │   │   │   ├── get_user_by_id.go # get user by ID function\r\n│   │   │   │   ├── get_users.go      # get all users function\r\n│   │   │   │── create_user.go        # create user function\r\n│   │   │   │── delete_user.go        # delete user function\r\n│   │   │   │── update_user.go        # update user function \r\n│   │   ├── routes/\r\n│   │       └── routes.go             # all routes declared here\r\n│   │\r\n│   │── config/\r\n│   │   │── .env                      # configuration environment \r\n│   │\r\n│   │── db/\r\n│   │   │── postgreSql.go             # postgreSQL database connection setup\r\n│   │\r\n│   │── models/\r\n│   │   │── model.go                  # User model definition\r\n│   │\r\n│   │── services/\r\n│   │   │── service.go                # Helper function \r\n│\r\n│── main.go                           # Main entry file \r\n│── go.mod                            # Go module definition\r\n│── go.sum                            # Go dependencies checksums\r\n│── README.md                         # Project documentation \r\n\r\n```\r\n--- \r\n##  API endpoints table\r\n\r\n| number | method | endpoint       |     description               |\r\n| ------ | ------ | -------------- | ------------------------------|\r\n|    1   | GET    | /users         | get all users                 |\r\n|    2   | GET    | /users/{id}    | get user by id                |\r\n|    3   | POST   | /users         | create new user               |\r\n|    4   | PUT    | /users/{id}    | full update user by id        |\r\n|    5   | DELETE | /users/{id}    | delete user by id             |\r\n\r\n## Testing the CRUD API with Postman or Thunder Client( VS code extension)\r\n#### 1. Get All Users\r\n  Method: GET\u003cbr\u003e URL: http://localhost:8000/users\u003cbr\u003e\r\n  \r\n#### 2. Get a single User\r\n  Method: GET\u003cbr\u003e URL: http://localhost:8000/users/1\u003cbr\u003e\r\n  \r\n#### 3. Create a new  Users\r\n  Method: POST\u003cbr\u003e URL: http://localhost:8000/users\u003cbr\u003e\r\n  \r\n#### 4. Update a User\r\n  Method: PUT\u003cbr\u003e URL: http://localhost:8000/users/1\u003cbr\u003e\r\n\r\n#### 5. Delete a User\r\n  Method: DELETE\u003cbr\u003e URL: http://localhost:8000/users/1\u003cbr\u003e\r\n\r\n---\r\n# Thank You for Checking Out This Repository!\r\nYour feedback is valuable! Please share your thoughts and suggestions for improvement via [GitHub Issues](https://github.com/alamgir-ahosain/go-postgres-crud-rest-api/issues).\r\n\r\n# Contributing  \r\nContributions are welcome! Feel free to fork the repo and create a pull request.\r\n\r\n\r\n\r\n\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falamgir-ahosain%2Fgo-postgres-crud-rest-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falamgir-ahosain%2Fgo-postgres-crud-rest-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falamgir-ahosain%2Fgo-postgres-crud-rest-api/lists"}