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.
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.
- MongoDB for data storage
- redis for caching
- docker for providing redis and MongoDB for development
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
- dep for managing packages
- gorilla mux for routing
- logrus for logging
- respond.v1 for responding to requests
- mgo for connecting to mongodb
- go-redis for redis
- testify for testing
- captain for monitoring cron jobs
- jwt-go for handling Auth using JWT
- go-slack for logging to slack
- mock for mocking interfaces
- pushy for sending push notifications to devices
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.
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.
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.
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.
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.
Visit license to see if this fits your needs.