{"id":21834290,"url":"https://github.com/whoisaditya/golang-task","last_synced_at":"2026-05-13T05:39:15.821Z","repository":{"id":169717093,"uuid":"645039903","full_name":"whoisaditya/golang-task","owner":"whoisaditya","description":"REST API for User Authentication and Data Storage","archived":false,"fork":false,"pushed_at":"2023-07-24T18:44:22.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-26T09:42:28.576Z","etag":null,"topics":["gin-gonic","golang","gorm","jwt","mongodb"],"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/whoisaditya.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":"2023-05-24T19:40:53.000Z","updated_at":"2023-07-24T18:25:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"d96c4e35-bb7b-41de-ba88-0b1ebd3f3dbe","html_url":"https://github.com/whoisaditya/golang-task","commit_stats":null,"previous_names":["whoisaditya/golang-task"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whoisaditya%2Fgolang-task","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whoisaditya%2Fgolang-task/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whoisaditya%2Fgolang-task/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whoisaditya%2Fgolang-task/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whoisaditya","download_url":"https://codeload.github.com/whoisaditya/golang-task/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244811374,"owners_count":20514276,"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-gonic","golang","gorm","jwt","mongodb"],"created_at":"2024-11-27T20:09:51.991Z","updated_at":"2026-05-13T05:39:10.798Z","avatar_url":"https://github.com/whoisaditya.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Golang Task - REST API for User Authentication and Data Storage\n\nThis is a Golang-based REST API project that provides user authentication using email and password, and allows authenticated users to store their personal details. The API uses JWT (JSON Web Token) for secure authentication.\n\n## Features\n\n1. **User Authentication** (`/login`):\n   - Endpoint to authenticate users using their email and password.\n   - Returns a JWT token upon successful authentication.\n\n2. **User Registration** (`/signup`):\n   - Endpoint to create a new user account.\n   - Stores user details like name, email, and phone in the database.\n\n3. **User Data Storage** (`/addDetails`):\n   - Authenticated route that allows users to add their personal details.\n\n4. **Health Check** (`/`):\n   - Simple endpoint to check if the backend server is up and running.\n\n## Getting Started\n\nFollow these steps to set up the project locally:\n\n1. **Prerequisites**:\n   - Install Golang on your machine: [Golang Installation Guide](https://golang.org/doc/install)\n   - Install any required dependencies.\n\n2. **Clone the Repository**:\n   ```\n   git clone https://github.com/whoisaditya/golang-task.git\n   cd golang-task\n   ```\n\n3. **Environment Variables**:\n   - Create a `.env` file based on the `.env.example` file and set your environment variables, including database credentials, JWT secret, etc.\n\n4. **Database Setup**:\n   - Set up the required PostgreSQL database and update the database credentials in the `.env` file.\n\n5. **Run the Application**:\n   ```\n   go run main.go\n   ```\n\n6. **Testing the Endpoints**:\n   - You can now test the API endpoints using tools like `curl`, `Postman`, or `Insomnia`.\n   - The base URL for the API would be `http://localhost:\u003cPORT\u003e/`, where `\u003cPORT\u003e` is the port number specified in your `.env` file.\n\n## API Endpoints\n\n1. **Health Check**:\n   - `GET /`\n   - This endpoint is used to verify if the server is up and running.\n\n2. **User Registration**:\n   - `POST /signup`\n   - Request Body: `{ \"name\": \"John Doe\", \"email\": \"john@example.com\", \"password\": \"your_password\", \"phone\": \"1234567890\" }`\n   - Creates a new user account and stores the provided user details in the database.\n\n3. **User Authentication**:\n   - `POST /login`\n   - Request Body: `{ \"email\": \"john@example.com\", \"password\": \"your_password\" }`\n   - Authenticates the user using the provided email and password.\n   - Returns a JWT token upon successful authentication.\n\n4. **User Data Storage**:\n   - `POST /addDetails`\n   - Request Headers: `{ \"Authorization\": \"Bearer YOUR_JWT_TOKEN\" }`\n   - Request Body: Accepts various user details.\n   - Stores the provided user data for the authenticated user.\n\n## Security Considerations\n\n- The API uses JWT for authentication, ensuring that only authenticated users can access the `/addDetails` route.\n- Passwords are securely hashed before storing them in the database to protect user information.\n\n## Documentation\nRefer to the [postman documentation](https://documenter.getpostman.com/view/16151723/2s93m7V1VV)\n\n## License\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n\u003cp align=\"center\"\u003e\n\tWith :heart: by \u003ca href=\"https://github.com/whoisaditya\" target=\"_blank\"\u003eAditya Mitra\u003c/a\u003e\n\u003c/p\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhoisaditya%2Fgolang-task","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhoisaditya%2Fgolang-task","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhoisaditya%2Fgolang-task/lists"}