Giter Site home page Giter Site logo

go-fiber-template's Introduction

Go Fiber Template

This is a template backend repository which abstracts away a bunch of the complexities Fiber brings to the table with the help of utility functions. This repository also structures code in an opinionated way of modules (controllers + services) in place of having controllers and responses

Some of the key utilities are as follows

  1. Standard Response Formats - This repo expects all API responses to be in a particular format and enforces that with the help of util response handlers.
  2. Agnostic Services - Services do not take in any Http contexts and are treated as pure functions. They can either Panic or return an interface{} which will be passed on as the http response. The goal of these services is to be reused within the code as much as possible, and hence not tie them up to http methods.
  3. Auto Request Validations - Validating request body AUTOMATICALLY with the help of the validate package, given that the DTO's are tagged appropriately. This is again achieved with the help of util request handlers. And you don't have to write any code to validate the request bodies.
  4. Error Handling - The server will never crash, regardless of any runtime errors which may occur (as long as you don't call log.Fatal("") in your code). A 500 response will be sent back to the client gracefully.
  5. An intuitive Controller-Service-Model approach, where controllers handle routing, services handle the data and models (schemas) provide the data. This ensures that your code is maintainable especially when your project grows large.

** Things to do **

  1. Abstract away the complexities of quering lists from MongoDB
  2. Make swagger doc implementation as easy as possible
  3. Bind models to services, such that services control the data-flow

As you can see, this architecture is extermely influcenced by NestJS. I intend to make Fiber as easy as possible to develop on with my handly util packages

go-fiber-template's People

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.