{"id":13794264,"url":"https://github.com/chenhg5/morningo","last_synced_at":"2025-04-06T16:13:59.151Z","repository":{"id":57498770,"uuid":"127730942","full_name":"chenhg5/morningo","owner":"chenhg5","description":"gin webapp project skeleton","archived":false,"fork":false,"pushed_at":"2019-10-23T07:21:07.000Z","size":6340,"stargazers_count":394,"open_issues_count":1,"forks_count":93,"subscribers_count":22,"default_branch":"master","last_synced_at":"2024-03-02T12:35:08.532Z","etag":null,"topics":["go","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chenhg5.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-02T08:56:08.000Z","updated_at":"2024-02-06T09:42:26.000Z","dependencies_parsed_at":"2022-09-26T18:51:25.718Z","dependency_job_id":null,"html_url":"https://github.com/chenhg5/morningo","commit_stats":null,"previous_names":["chenhg5/moringo"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenhg5%2Fmorningo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenhg5%2Fmorningo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenhg5%2Fmorningo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenhg5%2Fmorningo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chenhg5","download_url":"https://codeload.github.com/chenhg5/morningo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247509237,"owners_count":20950232,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang"],"created_at":"2024-08-03T23:00:37.890Z","updated_at":"2025-04-06T16:13:59.114Z","avatar_url":"https://github.com/chenhg5.png","language":"Go","funding_links":[],"categories":["Framework based on gin"],"sub_categories":[],"readme":"# MorningGo : Gin WebApp Project Skeleton\r\n\r\n[![Go Report Card](https://goreportcard.com/badge/github.com/chenhg5/morningo)](https://goreportcard.com/report/github.com/chenhg5/morningo) [![Build Status](https://api.travis-ci.org/chenhg5/morningo.svg?branch=master)](https://api.travis-ci.org/chenhg5/morningo) [![sonarcloud](https://sonarcloud.io/api/project_badges/measure?project=morningo\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=morningo)\r\n\r\n![doggy](https://ws2.sinaimg.cn/large/006tKfTcgy1fr2um9hwduj303u03w0sv.jpg)\r\n\r\n[中文文档](./README_CN.md)\r\n\r\nA Web develop project skeleton base on [Gin](https://github.com/gin-gonic/gin) which just for reference.\r\n\r\nMore efficiency,\u003cbr\u003e\r\nFaster and clear,\u003cbr\u003e\r\nEasier to deploy\r\n\r\nSuitable for simple project. [ko](https://github.com/chenhg5/ko)、[kit](https://github.com/go-kit/kit)、[go-micro](https://github.com/micro/go-micro)、[kite](https://github.com/koding/kite) are better choice for the middle and large project.\r\n\r\n## Environment Requirements \r\n\r\n- [GO \u003e= 1.8](https://github.com/Unknwon/the-way-to-go_ZH_CN/blob/master/eBook/directory.md)\r\n\r\n## Installation And Run\r\n\r\nVia moroingo installer or use docker\r\n\r\n### Install\r\n\r\n```\r\ngo get github.com/chenhg5/morningo-installer\r\ncd $GOPATH/src\r\n$GOPATH/bin/morningo-installer --project-name web\r\n```\r\n\r\n### Load Dependency\r\n\r\n```\r\ncd web\r\nmake deps\r\n```\r\n\r\n### Test\r\n\r\n```\r\nmake test\r\n```\r\n\r\n### Graceful Restart\r\n\r\n```\r\nmake restart\r\n```\r\n\r\n### Run It\r\n\r\n```\r\nmake\r\n```\r\nvisit by browser: http://localhost:4000/api/index\r\n\r\n## Deploy\r\n\r\nFirst build the executable file\r\n```\r\nmake build # for Linux\r\nmake cross # for mac/windows\r\n```\r\nThen put files of the ```build``` in your server and set the path of log and static file(html/css/js),and run the executable file.If 80 port is not allowed to use,consider the nginx proxy,or use the gin middleware [gin-reverseproxy](https://github.com/chenhg5/gin-reverseproxy) instead, which has some example in ```routers.go```. When the project start running, it will generate the ```pid```file in the root path of the project. Excute the following command to update your project. \r\n```\r\nkill -INT $(cat pid) \u0026\u0026 ./morningo # graceful stop the process and restart\r\n```\r\n\r\n## Project Structure\r\n\r\n```\r\n\r\n.\r\n├── Makefile\r\n├── README.md\r\n├── cli                     \r\n│   └── cli.go\r\n├── config                      global config\r\n│   ├── connections.go\r\n│   ├── cookie.go\r\n│   ├── jwt.go\r\n│   └── env.go\r\n├── connections                 store connection\r\n│   ├── database\r\n│   │   ├── mongodb\r\n│   │   └── mysql\r\n│   └── redis\r\n│       └── redis.go\r\n├── controllers                 controller\r\n│   └── MainController.go\r\n├── filters                     middleware\r\n│   ├── auth                    auth middleware\r\n│   │   ├── drivers             auth engine\r\n│   │   └── auth.go   \r\n│   └── filter.go               middleware initer                  \r\n├── frontend                    frontend resource\r\n│   ├── assets\r\n│   │   ├── css\r\n│   │   ├── images\r\n│   │   └── js\r\n│   ├── dist\r\n│   └── templates\r\n│       └── index.tpl\r\n├── handle.go                   global error handler\r\n├── main.go                     \r\n├── models                      model\r\n│   └── User.go\r\n├── module                      module of project\r\n│   │── schedule\r\n│   │   └── schedule.go   \r\n│   │── logger\r\n│   │   └── logger.go \r\n│   └── server\r\n│       └── server.go \r\n├── routers                     routers\r\n│   └── api_routers.go       \r\n├── routers.go                  router initer\r\n├── routers_test.go             unit test for api\r\n├── storage                     \r\n│   ├── cache                   cache file\r\n│   └── logs                    log file\r\n│       ├── access.log \r\n│       ├── info.log          \r\n│       └── error.log\r\n└── vendor                      govendor vendor\r\n\r\n\r\n```\r\n\r\n## What`s in the box\r\n\r\n### HTTP (based on [Gin](https://github.com/gin-gonic/gin))\r\n- Router\r\n- Middleware\r\n- Controller\r\n- Request\r\n- Response\r\n- View\r\n- Session\r\n\r\n### Frontend\r\n- Go template\r\n\r\n### Security\r\n- Authentication\r\n- Authorization\r\n- Encryption\r\n- Hash\r\n\r\n### Digging Deeper\r\n- Dancer Command\r\n- Cache System\r\n- Error and Log\r\n- Schedule\r\n\r\n### Database\r\n- Mysql\r\n- Mongodb\r\n- Redis\r\n\r\n### ORM(based on [gorm](https://github.com/jinzhu/gorm))\r\n\r\n### test\r\n- Api test\r\n\r\n### Example\r\n\r\n[https://github.com/chenhg5/morningo/blob/master/controllers/MainController.go](https://github.com/chenhg5/morningo/blob/master/controllers/MainController.go)\r\n\r\n## Project Dependency\r\n\r\n- web framework：github.com/gin-gonic/gin\r\n- orm：github.com/jinzhu/gorm\r\n- redis：github.com/go-redis/redis\r\n- mysql：github.com/go-sql-driver/mysql\r\n- wechat：github.com/silenceper/wechat\r\n- schedule：github.com/robfig/cron\r\n\r\n## Benchmark\r\n\r\n```\r\nwrk -c100 -d30s -t4 http://localhost:4000/api/index\r\n\r\nRunning 30s test @ http://localhost:4000/api/index\r\n  4 threads and 100 connections\r\n  Thread Stats   Avg      Stdev     Max   +/- Stdev\r\n    Latency     4.03ms    4.17ms  72.72ms   89.95%\r\n    Req/Sec     7.40k     1.67k   11.20k    67.75%\r\n  884816 requests in 30.03s, 107.17MB read\r\n  Non-2xx or 3xx responses: 884816\r\nRequests/sec:  29462.96\r\nTransfer/sec:  3.57MB\r\n```\r\n\r\n## TODO\r\n\r\n- [X] Logger\r\n- [X] Test\r\n- [X] Cache/Session\r\n- [ ] Queue of task\r\n- [ ] Read \u0026 Write Connections\r\n- [ ] Redis cluster\r\n- [ ] Profiling(Laravel/Swoole;beego）\r\n- [ ] Command tool\r\n- [ ] Interaction command env\r\n- [ ] Fast CRUD Generator\r\n\r\n## ChangeLog\r\n\r\n- Add Reverse Proxy\r\n- Fixed the path\r\n- Add session/cache and Auth middleware\r\n- Add test\r\n- Add graceful restart\r\n- Add schedule module\r\n- Add installer of project\r\n- Add access.log and error.log\r\n- Add database transcation\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchenhg5%2Fmorningo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchenhg5%2Fmorningo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchenhg5%2Fmorningo/lists"}