{"id":24328426,"url":"https://github.com/zjunaidz/gin-rest-api","last_synced_at":"2026-05-16T08:42:05.336Z","repository":{"id":272426451,"uuid":"915958590","full_name":"zJUNAIDz/gin-rest-api","owner":"zJUNAIDz","description":"This is a practice project I built to learn Go Programming Language and Gin Framework","archived":false,"fork":false,"pushed_at":"2025-01-14T10:30:28.000Z","size":49,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-16T07:50:47.451Z","etag":null,"topics":["gin","golang","jwt","rest-api","sqlite3"],"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/zJUNAIDz.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-01-13T07:23:02.000Z","updated_at":"2025-01-14T10:47:42.000Z","dependencies_parsed_at":"2025-01-14T11:36:20.818Z","dependency_job_id":"a4ae7a98-dad9-45f1-83b7-c354129e4098","html_url":"https://github.com/zJUNAIDz/gin-rest-api","commit_stats":null,"previous_names":["zjunaidz/gin-rest-api"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/zJUNAIDz/gin-rest-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zJUNAIDz%2Fgin-rest-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zJUNAIDz%2Fgin-rest-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zJUNAIDz%2Fgin-rest-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zJUNAIDz%2Fgin-rest-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zJUNAIDz","download_url":"https://codeload.github.com/zJUNAIDz/gin-rest-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zJUNAIDz%2Fgin-rest-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266606299,"owners_count":23955248,"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":["gin","golang","jwt","rest-api","sqlite3"],"created_at":"2025-01-17T23:20:03.749Z","updated_at":"2026-05-16T08:42:05.300Z","avatar_url":"https://github.com/zJUNAIDz.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gin REST API\n\n## Overview\n\nThis is a RESTful API built with the [Gin Web Framework](https://gin-gonic.com/) in Go. It is designed to manage users, events, and event registrations, offering endpoints for creating, retrieving, updating, and deleting resources. Authentication is implemented using JWT.\n\n---\n\n## Features\n\n- **User Authentication**:\n\n  - User signup and login using JWT-based authentication.\n  - Secure password hashing with bcrypt.\n\n- **Event Management**:\n\n  - Create, update, delete, and view events.\n  - Users can register for and cancel event participation.\n\n- **Database Integration**:\n\n  - Uses SQLite for persistent data storage.\n\n- **Cross-Platform Executables**:\n  - Precompiled executables available for Windows and Linux systems.\n\n---\n\n## Installation and Setup\n\n### Prerequisites\n\n- Go 1.20 or higher installed on your system (if building from source).\n\n### Download Executables\n\nPrecompiled executables for Windows and Linux are available in the [Releases](https://github.com/zjunaidz/gin-rest-api/releases) section of the repository.\n\n#### For Windows\n\n1. Download the `.exe` file from the Releases.\n2. Double-click the file to run the server.\n\n#### For Linux\n\n1. Download the Linux executable.\n2. Grant execute permissions:\n\n   ```bash\n   chmod +x gin-rest-api\n   ```\n\n3. Run the executable:\n\n   ```bash\n   ./gin-rest-api\n   ```\n\n### Build from Source\n\n#### Clone the Repository\n\n```bash\ngit clone https://github.com/zjunaidz/gin-rest-api.git\ncd gin-rest-api\n```\n\n#### Environment Configuration\n\n1.Create a `.env` file in the project root directory by copying `.example.env`:\n\n```bash\ncp .example.env .env\n```\n\n2.Replace the placeholder values in `.env` with your configuration.\n\n```env\n  JWT_SECRET=\"your-jwt-secret\"\n```\n\n#### Install Dependencies\n\n```bash\ngo mod tidy\n```\n\n#### Run the Application\n\n```bash\ngo run main.go\n```\n\nThe application will run on `http://localhost:8080` by default.\n\n---\n\n## API Endpoints\n\n### Public Endpoints\n\n#### User Authentication\n\n- **1. Signup**\n\n- **URL**: `/signup`\n- **Method**: `POST`\n- **Body**:\n\n  ```json\n  {\n    \"email\": \"user@example.com\",\n    \"password\": \"your_password\"\n  }\n  ```\n\n- **Response**:\n\n  ```json\n  {\n    \"message\": \"User created successfully.\",\n    \"user\": {\n      \"id\": 1,\n      \"email\": \"user@example.com\"\n    }\n  }\n  ```\n\n- **2. Login**\n\n- **URL**: `/login`\n- **Method**: `POST`\n- **Body**:\n\n  ```json\n  {\n    \"email\": \"user@example.com\",\n    \"password\": \"your_password\"\n  }\n  ```\n\n- **Response**:\n\n  ```json\n  {\n    \"message\": \"Login successful.\",\n    \"token\": \"your_jwt_token\"\n  }\n  ```\n\n#### Fetch Events\n\n- **3. Get All Events**\n\n- **URL**: `/events`\n- **Method**: `GET`\n- **Response**:\n\n  ```json\n  [\n    {\n      \"id\": 1,\n      \"name\": \"Event 1\",\n      \"description\": \"Description for Event 1\",\n      \"location\": \"Location 1\",\n      \"datetime\": \"2023-01-01T12:00:00Z\",\n      \"user_id\": 1\n    }\n  ]\n  ```\n\n- **4. Get Event by ID**\n\n- **URL**: `/events/:id`\n- **Method**: `GET`\n\n---\n\n### Protected Endpoints (Authentication Required)\n\nAdd the JWT token in the `Authorization` header:\n\n```http\nAuthorization: Bearer your_jwt_token\n```\n\n#### Event Management\n\n- **1. Create Event**\n\n- **URL**: `/events/create`\n- **Method**: `POST`\n- **Body**:\n\n  ```json\n  {\n    \"name\": \"Event Name\",\n    \"description\": \"Event Description\",\n    \"location\": \"Event Location\"\n  }\n  ```\n\n- **2. Update Event**\n\n- **URL**: `/events/update/:id`\n- **Method**: `PUT`\n\n- **3. Delete Event**\n\n- **URL**: `/events/delete/:id`\n- **Method**: `DELETE`\n\n#### Event Registrations\n\n- **4. Register for Event**\n\n- **URL**: `/events/register/:id`\n- **Method**: `POST`\n\n- **5. Cancel Registration**\n\n- **URL**: `/events/cancel/:id`\n- **Method**: `DELETE`\n\n---\n\n## Project Structure\n\n```plaintext\n.\n├── db             # Database initialization and migrations\n├── middlewares    # Authentication middleware\n├── models         # Business logic for users and events\n├── routes         # API route handlers\n├── utils          # Utility functions (JWT, password hashing)\n├── main.go        # Application entry point\n```\n\n---\n\n## Contributing\n\nContributions are welcome! Please follow these steps:\n\n1. Fork the repository.\n2. Create a new branch: `git checkout -b feature-name`.\n3. Make your changes and commit them.\n4. Push to your fork and create a pull request.\n\n---\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzjunaidz%2Fgin-rest-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzjunaidz%2Fgin-rest-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzjunaidz%2Fgin-rest-api/lists"}