Skip to content

ZahidZafar/fiber-go-jwt-mongodb

Repository files navigation

Go Fiber with JWT and MongoDB Integration

This repository showcases a simple Go Fiber application integrated with JWT (JSON Web Tokens) for authentication and MongoDB for data storage. The application is containerized using Docker for easy deployment.

Features

  • User authentication using JWT.
  • CRUD (Create, Read, Update) operations with a MongoDB database.
  • Docker setup for easy deployment and testing.

Technologies Used

  • Go - The programming language used.
  • Fiber - A web framework for Go.
  • MongoDB - A popular NoSQL database.
  • JWT - JSON Web Tokens for secure communication.
  • Docker - Containerization for easy deployment and testing.

Getting Started

Prerequisites

   docker pull mongo

Setup

  1. Clone the repository:
   git clone https://github.com/ZahidZafar/fiber-go-jwt-mongodb.git
   cd your_repository
  1. Configure environment variables: Create a app.env file in the project root and set the following variables:
   MONGO_DB_URL=mongodb://your_mongo_url
   TOKEN_SECRET_KEY=your_jwt_secret
   ACCESS_TOKEN_DURATION=25m
   TEMP_TOKEN_DURATION=1m
   REFRESH_TOKEN_DURATION=24h
  1. Build go-app image:
   docker build -t go-app:0.1 .
  1. Run the Docker container:
   docker-compose -f docker-compose.yaml up

The application will be accessible at http://localhost:3000.

Contribution

Contributions are welcome! Feel free to open an issue or submit a pull request.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published