takemeApp is a simple backend service for dating app. The name takemeApp is a pun for telling "take me up".
- Register & Login
- Find Users
- Create Reaction (swipe left or right) with caching
- Premium features to unlock limitations
First clone this repo by run:
$ git clone [email protected]:notblessy/takeme-backend.git
Firstly, run:
$ go mod tidy
- The sample environments are provided in root folder
- If you run takeme-app in local, use
config.yml.sample
to beconfig.yml
file.
- If you run takeme-app in local, use
- Ensure you have already installed
Makefile
and created the database. To migrate tables, run:
$ make migration
- To seed necessary data:
$ make seeder
- To run HTTP server with hot reloading by listens changes, hit:
$ make run
Or just go run main.go httpsrv
if you don't need hot reload.
- Test command includes linters which you need to install
golangci-lint
.
<!-- macOS -->
brew install golangci-lint
Then run make test
.
- To test the API, import
postman collection
from folderapi-docs/
. All the API is available there. - Create environtment in postman, there are 2 necessary variables for testing.
- host. represents basehost value
- token. represents auth token
-
takeme-app uses a clean architecture referenced by go-clean-arch
https://github.com/bxcodec/go-clean-arch
. It has 4 domain layers such- Models Layer provides domain models
- Repository Layer communicates to persistence layer
- Usecase Layer stores action of process
- Delivery Layer exchanges data between client & system
-
Here's some reason why referencing go-clean-arch:
- Scalable:
- As the application grows, it'll be easier adding new features or modify existing ones without widespreading negative impacts.
- Reliable:
- Domains are easly and independently testable.
- Adapting Domain driven design & SOLID principles.
- Maintainable
- A way more organized code. Even with separated layers, still encapsulates logic business that may not affect other logic when having updates/changes.
- Code should not depend on one developer. Readable codes will saves time and effort of developers in future.
- Scalable:
-
takeme-app especially this service, could run process separately using
cobra
as commands in onemain
function. For the example,httpsrv
is the command for running http service, likewisemigration
to run migration. This also good approach if we intend to use worker or exposing another port in the future.
golang
as the programming languageecho
as the HTTP Frameworkcobra
runs commandmysql
as the RDBMSgorm
as the ORMredis
for cachingdbmate
as db migrationmockgen
for mockinggocognit
to check cognitive complexitygolangci-lint
as linters.modd
to perform hot reload on changesmakefile
utility for executing task
I Komang Frederich Blessy