Skip to content

An awesome starter template to jumpstart your Go lang (gin-gonic) projects, helping you to speed up the process of building RESTful APIs.

License

Notifications You must be signed in to change notification settings

BoBsRepository/create-go-mongodb-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo

Go lang (gin-gonic) and MongoDB API Template

An efficient CLI starter template to kickstart your Go lang project using the Gin framework and MongoDB, enabling you to rapidly develop RESTful APIs.
Explore the docs »

View Demo · Report Bug · Request Feature

About The Project

Within this repository, you will find a fully configured and ready-to-use Go lang web application designed for building APIs. The project is built using the Gin framework and integrates with MongoDB, providing a solid foundation for developing scalable and performant APIs.

Here's why:

  • Routing & Middleware:

    • ✔️ Gin for efficient routing and middleware support
  • Database Integration:

    • 📦 MongoDB as the database for modern applications
    • 💾 MongoDB driver for Go for seamless integration
  • Development Workflow:

    • 🔄 Live reload for efficient development
    • 🛠 Optimized code for production
  • Security Measures Added:

    • 🔒 Input validation to prevent common security vulnerabilities
    • 🚧 Rate limiting to protect against brute-force attacks
    • 🌐 CORS (Cross-Origin Resource Sharing) configured for secure API usage

Of course, this template may not cover all project needs, as your requirements may vary. More updates will be added in the future. Feel free to suggest changes by forking this repo, creating a pull request, or opening an issue. Thanks to all contributors who have helped enhance this template!

(back to top)

Built With

This section highlights the key frameworks and libraries that form the foundation of your project. Below are some notable examples:

  • Go: An open-source programming language that makes it easy to build simple, reliable, and efficient software.
  • Gin: A web framework written in Go (Golang). It features a Martini-like API with much better performance.
  • MongoDB: The database for modern applications.
  • MongoDB Go Driver: The official MongoDB driver for Go.

(back to top)

Getting Started 🚀

Prerequisites

Before you begin contributing to this project, make sure you have the following set up:

  • Go: Go Lang.
  • Gin: gin-gonic.

Run This ⌨️

  1. Clone the Repository:

    git clone https://github.com/BoBsRepository/create-go-mongodb-template.git
  2. Add Environment Variables:

     cd create-go-mongodb-template
     touch .env
  3. Add the necessary configuration:

    MONGOURI = <your-mongodb-uri>
    JWT = KSNVLJDSBJVSDJLVNLKSDVNLKSDVVKMLSDMKDSNKLVDSNKLVNDSKLVDJK #your jwt secret
  4. Fetch the Dependencies

    go get
  5. Build the Project:(optional)

    The go build command is used in Go to compile and build a Go program. It creates an executable binary from the source code.

    go build
  6. Run the Project:

    Now you can run that executable file or main.go file

    ./your-gin-executable

    or

    go run main.go

    (back to top)

Contributing 🌟

Making Contributions

We welcome and appreciate contributions from the community ❤️! Here's how you can contribute:

  • Open Issues: Check for open issues or create a new one to start discussions.
  • Fork the Repository: Fork the project to your own GitHub account.
  • Create Pull Request: Make changes in your fork and submit a pull request.

Welcome Contributors!

🚀 Thank you for considering contributing to this project! Your involvement makes this template even better. Feel free to explore the code, share your ideas, and make improvements ✌️.

🌟 Don't hesitate to reach out if you have any questions or need assistance. Together, let's make this project amazing!🟩

(back to top)