go-server

module
v0.0.0-...-0f898fb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2024 License: MIT

README

Go Server

golang

Clean Architecture + Wire + Gin + GraphQL(gqlgen) + MongoDB

Abstract

This project implements a server in Go using Clean Architecture principles for maintainable and scalable code. It leverages Gin for the HTTP web framework, gqlgen for GraphQL server implementation, Wire for dependency injection, and MongoDB as the database. JSON Web Tokens (JWT) are used for secure authentication.

Clean Architecture

Clean Architecture

Clean Architecture is designed to separate concerns, making the system easy to maintain and evolve. For more information, check out Uncle Bob's Clean Architecture blog post.

Technologies

  • Gin: A high-performance web framework that is efficient and well-suited for building REST APIs.
  • gqlgen: A Go library for building GraphQL servers without any fuss.
  • MongoDB: A NoSQL database that offers high performance, high availability, and easy scalability.
  • Wire: Wire is an automatic dependency injection tool for Go, which simplifies the process of wiring application components together.
  • JWT: JSON Web Tokens are an open, industry standard RFC 7519 method for representing claims securely between two parties.

Project Structure

.
├── cmd
└── pkg
├── config
├── constant
├── di
├── domain
├── infrastructure
│   ├── database
│   │   └── mongo
│   ├── graph
│   │   └── model
│   ├── logging
│   └── server
├── repository
│   ├── repository_interface
│   └── user_repository
└── usecase
├── usecase_interfaces
└── user_usecase

Prerequisites

Before running the project, ensure you have the following installed:

  • Go (version specified in go.mod)
  • MongoDB server running locally or accessible remotely

Running the Project

To run the project, follow these steps:

  1. Clone the repository:

    git clone https://github.com/jepbura/go-server.git
    
  2. Change directory to the project:

    cd go-server
    
  3. Install dependencies:

    go mod download
    
  4. Change directory to the main:

    cd cmd
    
  5. Run the main application:

    go run main.go
    

Todo

  • Add Gin
  • Add GraphQL
  • Add MongoDB
  • Add Wire
  • Write Test Cases
  • Add JWT
  • Add Gorilla WebSocket
  • Add Redis
  • Add Docker
  • Add Kubernetes

Acknowledgements

This project draws inspiration and code from the following repositories:

Feel free to star and fork these repositories to show your support for the authors' work.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL