Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/raihan2bd/jwt-authentication-golang
A Go-based web application using PostgreSQL for data storage, GORM for database interaction, and Gin for routing. It offers user registration, login, and authentication with JWT tokens for secure access to protected routes.
https://github.com/raihan2bd/jwt-authentication-golang
gin go golang gorm jwt posgresql
Last synced: 28 days ago
JSON representation
A Go-based web application using PostgreSQL for data storage, GORM for database interaction, and Gin for routing. It offers user registration, login, and authentication with JWT tokens for secure access to protected routes.
- Host: GitHub
- URL: https://github.com/raihan2bd/jwt-authentication-golang
- Owner: raihan2bd
- License: mit
- Created: 2023-09-14T07:28:23.000Z (about 1 year ago)
- Default Branch: dev
- Last Pushed: 2023-09-15T12:55:32.000Z (about 1 year ago)
- Last Synced: 2024-10-08T15:09:50.991Z (about 1 month ago)
- Topics: gin, go, golang, gorm, jwt, posgresql
- Language: Go
- Homepage:
- Size: 30.8 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Jwt Authentication with Golang
# 📗 Table of Contents
- [📗 Table of Contents](#-table-of-contents)
- [ jwt-authentication-golang ](#-about-project-)
- [🛠 Built With ](#-built-with-)
- [Tech Stack ](#tech-stack-)
- [Key Features ](#key-features-)
- [💻 Getting Started ](#-getting-started-)
- [Prerequisites](#prerequisites)
- [Setup](#setup)
- [Install](#install)
- [Usage](#usage)
- [Build](#build)
- [👥 Author ](#-author-)
- [🔭 Future Features ](#-future-features-)
- [🤝 Contributing ](#-contributing-)
- [⭐️ Show your support ](#️-show-your-support-)
- [🙏 Acknowledgments ](#-acknowledgments-)
- [📝 License ](#-license-)# Jwt Authentication with Golang and Gorm
A Go-based web application using PostgreSQL for data storage, GORM for database interaction, and Gin for routing. It offers user registration, login, and authentication with JWT tokens for secure access to protected routes.## 🛠 Built With
### Tech StackBack End
- Golang
- PostgreSQL
- Gin
- Gorm
- Users can login
- User can signup
- User can check if they are authenticated or not
To get a local copy up and running, follow these steps.
### Prerequisites
In order to run this project you need:
- Then Make sure you have installed [Go (golang)](https://go.dev/dl/) version 1.20.4 or the latest stable version.
- Then make sure you have installed [PostgreSQL](https://www.postgresql.org/) on your local machine if you want to use this project locally.
- Then Create a database called `jwt-go-pos`
### Setup
- Clone this repository to your desired folder:
```sh
cd your-folder
https://github.com/raihan2bd/jwt-authentication-golang.git
```
- Before running the project please make sure you create a `.env` file to your project root directory and add `DATABASE_URI`, and `JWT_SECRET_KEY` environment variables to the file. For example:
```
DATABASE_URI="host=localhost port=5432 dbname=jwt-go-pos user=postgres password=your password sslmode=disable"
JWT_SECRET="your jwt secret key"
```
### Install
Install this project with:
- Install the required gems with:
```sh
go mod tidy
```
### Usage
- To run the development server, execute the following command:
```sh
go run .
```
### Build
- To build the project for production-ready run the following command:
```sh
go build -o myapp
```
- To run the build file
```sh
./myapp
```
👤 **Abu Raihan**
- GitHub: [@raihan2bd](https://github.com/raihan2bd)
- Twitter: [@raihan2bd](https://twitter.com/raihan2bd)
- LinkedIn: [raihan2bd](https://linkedin.com/in/raihan2bd)
- [ ] **I will add more end-points to this project**
Contributions, issues, and feature requests are welcome!
Feel free to check the [issues page](https://github.com/raihan2bd/jwt-authentication-golang/issues).
If you like this project, please leave a ⭐️
I would like to thank [Trevor Sawler](https://www.gocode.ca/) Who helped me a lot to learn Golang.
This project is [MIT](./LICENSE) licensed.