Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ypankaj007/golang-mongodb-restful-starter-kit
Golang rest api starter kit with mongoDB and JWT
https://github.com/ypankaj007/golang-mongodb-restful-starter-kit
go golang jwt mongodb mux rest-api swagger
Last synced: 1 day ago
JSON representation
Golang rest api starter kit with mongoDB and JWT
- Host: GitHub
- URL: https://github.com/ypankaj007/golang-mongodb-restful-starter-kit
- Owner: ypankaj007
- Created: 2019-07-26T12:06:39.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-04-12T11:11:23.000Z (over 3 years ago)
- Last Synced: 2024-06-20T11:58:58.480Z (7 months ago)
- Topics: go, golang, jwt, mongodb, mux, rest-api, swagger
- Language: Go
- Homepage:
- Size: 59.6 KB
- Stars: 53
- Watchers: 1
- Forks: 19
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# golang-mongodb-restful-starter-kit
golang-mongodb-restful-starter-kit is a golang restful api starter kit using mongoDB and JWT. It is very useful for beginners.
### Features!
- Used mux for routing
- Used salt to hash the password
- Used JWT for authentication
- Follows repository, service and model structure
- Used interface to hide implementation of repositories and services
- Error handling
### Project structure
```bash
.
├── README.md
├── app
│ ├── handlers // API controllers / handlers
│ │ ├── auth.handler.go
│ │ ├── model.handler.go
│ │ └── user.handler.go
│ ├── middleware // API middleware
│ │ └── cors.go
│ ├── models // DB models
│ │ └── user.model.go
│ ├── repositories // DB repository
│ │ └── user
│ │ └── user.repository.go // UseRepository
│ └── services // Services
│ ├── auth
│ │ └── auth.service.go
│ ├── jwt
│ │ └── jwt.go
│ └── user
│ └── user.service.go
├── config
│ └── config.go // Environment configurations, read from .env file
├── db
│ └── mongo.go // Mongodb Connection and Session
├── docs // Swagger docs
│ ├── docs.go
│ ├── swagger.json
│ └── swagger.yaml
├── go.mod // Go modules
├── go.sum
├── main.go
├── routes // API routes
│ └── api.go
└── utility // Contains helpers, basic operations, commons operations, errors, validations
├── common.go
├── errors.go
├── handler.go
├── role.go
└── string.go
```
### Installationgolang-mongodb-restful-starter-kit requires [Go](https://golang.org/) 1.10+ to run.
Install the dependencies and devDependencies and start the server.
```sh
$ git clone https://github.com/ypankaj007/golang-mongodb-restful-starter-kit.git
$ cd golang-mongodb-restful-starter-kit
$ go run main.go
```
#### Building for source
For production release:
```sh
$ go build
```
### Todos- Email verification
- Containerized - Docker + Kubernetes
- Write Tests
- Write scripts
### TechProject uses a number of open source projects to work properly:
* [Go] - Awesome programing language by Google
* [mux] - Implements a request router and dispatcher in Go
* [MongoDB] - document-based, big community, database
* [Redis] - in-memory database using key-value pairs
* [Docker] - Build, Share, and Run Any App, Anywhere
* [Kubernetes] - Automating deployment, scaling, and management of containerized applicationsAPI endpoint - http://localhost:8080
Swagger endpoint - http://localhost:8080/swagger/index.html[mux]:
[Go]:
[MongoDB]:
[Docker]:
[Kubernetes]:
[Redis]: