github.com/huynhphuchuy/shadow
├── cmd/
│ ├── cli/
│ │ ├── email-template/
│ │ ├── stress-test/
│ │ └── cli.go
│ └── api/
│ ├── routes/
│ │ └── handlers/
│ ├── tests/
│ └── server.go
├── internal/
│ ├── config/
│ │ ├── config.go
│ │ ├── dev.yaml
│ │ └── prod.yaml
│ ├── helpers/
│ │ ├── generator/
│ │ └── messages/
│ ├── registrations/
│ │ └── user.go
│ └── platform/
│ ├── smtp/
│ ├── mongo/
│ └── auth/
└── vendor/
├── github.com/
└── golang.org/
- For the purpose of this structure, all the source code for 3rd party packages need to be vendored (or copied) into the vendor/ folder. This includes packages that will be used from the company Kit project. Consider packages from the Kit project as 3rd party packages.
- All the programs this project owns belongs inside the cmd/ folder. The folders under cmd/ are always named for each program that will be built. Use the letter d at the end of a program folder to denote it as a daemon. Each folder has a matching source code file that contains the main package.
- Packages that need to be imported by multiple programs within the project belong inside the internal/ folder. One benefit of using the name internal/ is that the project gets an extra level of protection from the compiler. No package outside of this project can import packages from inside of internal/. These packages are therefore internal to this project only.
- Packages that are foundational but specific to the project belong in the internal/platform/ folder. These would be packages that provide support for things like databases, authentication or even marshaling.
- Integrated simple registration and Bearer authentication with JWT token
- Email verification after registering
- Email template generator and exporter
- Log HTTP request to mongodb
- CLI tools
- Copy *.yaml.sample template from
internal/config/samples/tointernal/config/and rename to *.yaml - Run
dep ensureto install needed packages to vendor folder - Start with
go run cmd/api/server.go -e devorgo run cmd/api/server.go -e proddepends on the environment - Run stress test cli tool with following command
echo "GET http://localhost:6969" | ./vegeta attack -duration=0 -connections=1000000 - Enjoy the show!
- Run
dep ensurefirst - Use
sh MENU.shto setup or rename the project - Use
sh SERVER.shto run server with dev environment - Use
sh VEGETA.shto stress test the server with 1 million requests - Drink a cup of tea..
- docker-compose up