Skip to content
This repository has been archived by the owner on Sep 11, 2020. It is now read-only.

fossapps/golang_starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Golang REST API starter

This go starter is here for you to take it and modify according to your needs. This project promotes ideomatic go code. And if there's any parts which has a bad design pattern, expects you to provide feedback by opening a issue.

What is this?

The idea is to have everything included (a.k.a. batteries included) starter project, after which all you need to do would be to work on your idea, instead of setting everything up.

Backend

  • MongoDB for data storage
  • redis for caching
  • docker for providing redis and MongoDB for development

What features are included?

This project provides the following features:

  • JWT based Authentication
  • Pre configured endpoints (see handlers for more info)
  • Permissions
  • Middlewares (includes must_have_permission, rate_limit, auth_middleware etc)
  • Pre defined way of using Database with integration tests
  • Ability to cover 100% of code with tests
  • Ability to unit test each handlers
  • Transformers (so you can transform your db representation into response)
  • mocking (using mockgen)
  • migrations
  • redis cache
  • .env config
  • commands
  • travis and circleci support
  • docker-compose for database and redis
  • logging with logrus (and slack pre configured)
  • easy email support
  • sign up
  • login with open auth provider
  • recaptcha support (spam protection)
  • open auth server
  • command line tool to generate handlers, middlewares, etc
  • limit login attempts
  • side effects handling
  • And more to come

Packages Used

Ready to use?

As of v0.0.1, this boilerplate is ready for anyone to adapt, modify and use. But beaware, that it's upto you to make this production ready and usable for your needs.

Upcoming changes

There WILL be breaking changes for a while till this gets to stable, production ready state, till then, you can watch changes closely and adapt to it.

Getting Started

As of now, it's not an application, but a package, it's because app engine requires you to do so. This doesn't depend on app engine, but because of it's popularity, it made sense to declare as a package which can be invoked really easily.

If you don't plan on going that route, you can always modify package name to your needs.

If you'd just like to see this working, follow the following steps:

  • make sure you have docker and docker-compose
  • make sure you've got go toolchain installed (older versions work, but they tend not to ignore vendor directory, so better to use newer go versions
  • Then follow the following commands
cd $GOPATH/
mkdir -p src/github.com/fossapps/starter
cd src/github.com/fossapps/starter
git clone git@github.com:fossapps/golang_starter.git . # or you can use http url if you'd like
  • then cd into starter directory
  • run cp .env.example .env
  • run dep ensure
  • run docker-compose up
  • run make serve

At this point, you'll have a API server running on port 8080 feel free to experiment.

More Documentation

If you decide to use this for your needs, there are a few things which you might have to keep in mind while using this starter project.

Visit WiKi to know how to move forward.

Contributing

If and when you encounter some pain points or bugs, please feel free to open a new issue

See contributing.md to get started with contributions.

License (MIT)

Visit license to see if this fits your needs.

Releases

No releases published

Packages

No packages published