https://github.com/dev-saiful/umanagement
General User Management System API Design with Golang | Gin | Postgresql
https://github.com/dev-saiful/umanagement
Last synced: about 2 months ago
JSON representation
General User Management System API Design with Golang | Gin | Postgresql
- Host: GitHub
- URL: https://github.com/dev-saiful/umanagement
- Owner: dev-saiful
- License: mit
- Created: 2025-01-17T12:50:29.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-02-03T16:04:15.000Z (over 1 year ago)
- Last Synced: 2025-09-03T00:44:06.154Z (10 months ago)
- Language: Go
- Homepage:
- Size: 28.7 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# User Management System
## Overview
The User Management System is a web application that allows administrators to manage users. It includes features such as user authentication, role-based access control, and user data management.
## Technologies
- Golang
- PostgreSQL
- Gin
- GORM
- JWT
- Bcrypt
## Features
- User Authentication
- Role-Based Access Control
- User Data Management
- Admin Dashboard
## Installation
### Prerequisites
- Go 1.18 or higher
- PostgreSQL
### Environment Variables
Create a `.env` file in the root directory and add the following environment variables:
DATABASE_HOST=your_database_host
DATABASE_USER=your_database_user
DATABASE_PASSWORD=your_database_password
DATABASE_NAME=your_database_name
DATABASE_PORT=your_database_port
### Steps
1. Clone the repository:
```sh
git clone https://github.com/dev-saiful/umanagement.git
cd umanagement
2. Install dependencies:
```sh
go mod tidy
3. Initialize the database:
```sh
go run main.go
## Usage
Running the Application
To start the application, run:
```sh
go run main.go
```
API Endpoints
Authentication
* Login
* ```POST /api/v1/auth/login```
* Request Body: ```{ "email": "user@example.com", "password": "password" }```
* Response: ```{ "token": "jwt_token" }```
User Management
* Get All Users
* ```GET /api/v1/user/users```
* Headers: ```{ "Authorization": "Bearer jwt_token" }```
* Response: ```[ { "id": 1, "email": "user@example.com", "username": "username" } ]```
* Get User by ID
* ```GET /api/v1/user/users/:id```
* Headers: ```{ "Authorization": "Bearer jwt_token" }```
* Response: ```{ "id": 1, "email": "user@example.com", "username": "username" }```
* Get Admin by Email
* ```GET /api/v1/user/admin```
* Headers: ```{ "Authorization": "Bearer jwt_token" }```
* Response: ```{ "id": 1, "email": "admin@example.com", "username": "admin", "role": "admin" }```
## Contributing
1. Fork the repository
2. Create a new branch ```(git checkout -b feature-branch)```
3. Make your changes
4. Commit your changes ```(git commit -m 'Add new feature')```
5. Push to the branch ```(git push origin feature-branch)```
6. Create a new Pull Request
## License
This project is licensed under the MIT License.
```sh
This README provides an overview of the project, installation instructions, usage details, and contribution guidelines. Adjust the content as needed to fit your specific project requirements.