{"id":21158467,"url":"https://github.com/mark-c-hall/gouserrestapi","last_synced_at":"2026-05-20T09:40:41.315Z","repository":{"id":207982984,"uuid":"710005027","full_name":"Mark-C-Hall/GoUserRestAPI","owner":"Mark-C-Hall","description":"A minimalistic REST API microservice built with Go for user authentication.","archived":false,"fork":false,"pushed_at":"2023-10-25T20:17:32.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-21T09:09:44.812Z","etag":null,"topics":["authentication","golang","jwt","microservice","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mark-C-Hall.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}},"created_at":"2023-10-25T20:14:31.000Z","updated_at":"2024-04-18T22:34:33.000Z","dependencies_parsed_at":"2023-11-18T22:23:13.544Z","dependency_job_id":"1441c778-4838-4417-a3d3-fed600dfbc63","html_url":"https://github.com/Mark-C-Hall/GoUserRestAPI","commit_stats":null,"previous_names":["mark-c-hall/gouserrestapi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mark-C-Hall%2FGoUserRestAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mark-C-Hall%2FGoUserRestAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mark-C-Hall%2FGoUserRestAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mark-C-Hall%2FGoUserRestAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mark-C-Hall","download_url":"https://codeload.github.com/Mark-C-Hall/GoUserRestAPI/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243599920,"owners_count":20317196,"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":["authentication","golang","jwt","microservice","rest-api"],"created_at":"2024-11-20T12:24:33.369Z","updated_at":"2025-12-29T10:05:07.809Z","avatar_url":"https://github.com/Mark-C-Hall.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go User RestAPI\n\nA minimalistic REST API microservice built with Go for user authentication.\n\n## Overview\n\nThis project is a lightweight microservice focused on user authentication. Built with Go and leveraging its standard library, it serves as a demonstration of creating RESTful APIs in Go with a focus on user registration, login, and token-based authentication.\n\n## Features\n\n- **User Registration**: Allows new users to create an account.\n- **User Login**: Existing users can log in and receive a token for authenticated routes.\n- **Token-based Authentication**: Utilizes JWT (JSON Web Tokens) for secure and stateless authentication.\n- **In-memory Store**: A temporary storage solution to hold user data.\n- **Profile Management**: Allows users to view, update, and delete their profiles.\n\n## Getting Started\n\n### Prerequisites\n\n- Go (version 1.xx or newer)\n\n### Environment Variables\nBefore running the project, you need to set the following environment variables:\n- `HOST`: Host address for the server (e.g., `localhost` or `0.0.0.0`). Default: `localhost`.\n- `PORT`: Port on which the server will listen (e.g., `8080`). Default: `8080`.\n- `JWT_KEY`: Secret key for generating and validating JWT tokens. Ensure it's a strong, unique key. No default.\n- `ALLOWED_ORIGINS`: Comma-separated list of allowed origins for CORS. Default: `*` (allow all origins).\n\n### Running the Project\n\n1. Clone the repository:\n   ```\n   git clone https://github.com/mark-c-hall/GoUserRestAPI.git\n   ```\n\n2. Navigate to the project directory:\n   ```\n   cd GoUserRestAPI\n   ```\n\n3. Run the server:\n   ```\n   go run main.go\n   ```\n\nThe API will start and listen on the configured port, e.g., `:8080`.\n\n## Endpoints\n\n- `POST /register`: Register a new user.\n- `POST /login`: Login and receive a token.\n- `POST /logout`: Logout the current user and invalidate the token.\n- `GET /profile`: Retrieve the profile information of the authenticated user.\n- `POST /profile/update`: Update user profile details.\n- `POST /profile/delete`: Delete the user's profile.\n- `GET /health`: Health check endpoint returning a 200 OK status, useful for monitoring and service checks.\n\nNote: Ensure that the appropriate HTTP methods (GET, POST, etc.) are used when making requests to these endpoints.\n\n## Future Improvements\n\n- Replace the in-memory store with a persistent database.\n- Add user profile and settings management features.\n- Implement rate-limiting and additional security measures.\n\n## Contributing\n\nWhile this is a small project for educational purposes, contributions or feedback are welcome. Feel free to open an issue or submit a pull request.\n\n## License\n\nThis project is open-source and available under the [MIT License](LICENSE).\n\n## Acknowledgements\n\n- [Go](https://golang.org/)\n- [JWT-Go Library](https://github.com/dgrijalva/jwt-go) for token generation and validation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmark-c-hall%2Fgouserrestapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmark-c-hall%2Fgouserrestapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmark-c-hall%2Fgouserrestapi/lists"}