Skip to content

Directiry Structure

Kosala Tennakoon edited this page Oct 20, 2020 · 8 revisions

The complete directory structure of Catalyst is as follows.

Catalyst follows the following set of rules when naming directories and files.

  • All directory names are in LOWER CASE
  • Use separate files for separate structs and interfaces (Only a single struct or interface can be withing a file)
  • Use PASCAL CASE to name a file that has a struct or an interface
  • Use LOWER SNAKE CASE for files that only has functions
  • USE LOWER SNAKE CASE for configuration file names
catalyst/
┣ app/
┃ ┣ config/
┃ ┃ ┣ AppConfig.go
┃ ┃ ┣ Config.go
┃ ┃ ┣ DBConfig.go
┃ ┃ ┣ LogConfig.go
┃ ┃ ┣ MetricConfig.go
┃ ┃ ┣ ServiceConfig.go
┃ ┃ ┣ parser.go
┃ ┃ ┣ parser_test.go
┃ ┃ ┣ reader.go
┃ ┃ ┗ reader_test.go
┃ ┣ container/
┃ ┃ ┣ Container.go
┃ ┃ ┣ destructor.go
┃ ┃ ┣ resolver.go
┃ ┃ ┣ resolver_adapters.go
┃ ┃ ┣ resolver_repositories.go
┃ ┃ ┗ resolver_services.go
┃ ┣ errors/
┃ ┃ ┗ ServerError.go
┃ ┣ metrics/
┃ ┃ ┗ registerer.go
┃ ┗ splash/
┃   ┣ shower.go
┃   ┗ styles.go
┣ channels/
┃ ┣ http/
┃ ┃ ┣ controllers/
┃ ┃ ┃ ┗ SampleController.go
┃ ┃ ┣ error/
┃ ┃ ┃ ┣ formatter.go
┃ ┃ ┃ ┗ handler.go
┃ ┃ ┣ errors/
┃ ┃ ┃ ┣ MiddlewareError.go
┃ ┃ ┃ ┗ ValidationError.go
┃ ┃ ┣ metrics/
┃ ┃ ┃ ┗ metrics.go
┃ ┃ ┣ middleware/
┃ ┃ ┃ ┣ MetricsMiddleware.go
┃ ┃ ┃ ┣ RequestAlterMiddleware.go
┃ ┃ ┃ ┗ RequestCheckerMiddleware.go
┃ ┃ ┣ request/
┃ ┃ ┃ ┣ unpackers/
┃ ┃ ┃ ┃ ┣ SampleUnpacker.go
┃ ┃ ┃ ┃ ┗ UnpackerInterface.go
┃ ┃ ┃ ┗ unpacker.go
┃ ┃ ┣ response/
┃ ┃ ┃ ┣ mappers/
┃ ┃ ┃ ┃ ┣ Data.go
┃ ┃ ┃ ┃ ┗ Error.go
┃ ┃ ┃ ┣ transformers/
┃ ┃ ┃ ┃ ┣ ErrorTransformer.go
┃ ┃ ┃ ┃ ┣ SampleTransformer.go
┃ ┃ ┃ ┃ ┣ TransformerInterface.go
┃ ┃ ┃ ┃ ┗ ValidationErrorTransformer.go
┃ ┃ ┃ ┣ responder.go
┃ ┃ ┃ ┗ transformer.go
┃ ┃ ┣ router/
┃ ┃ ┃ ┗ router.go
┃ ┃ ┗ server/
┃ ┃   ┗ runner.go
┃ ┗ metrics/
┃   ┗ server/
┃ ┃   ┗ runner.go
┣ configs/
┃ ┣ app.yaml
┃ ┣ database.yaml
┃ ┣ logger.yaml
┃ ┗ services.yaml
┣ doc/
┃ ┗ api/
┃   ┣ README.md
┃   ┗ openapi.yaml
┣ domain/
┃ ┣ boundary/
┃ ┃ ┣ adapters/
┃ ┃ ┃ ┣ DBAdapterInterface.go
┃ ┃ ┃ ┣ DBTxAdapterInterface.go
┃ ┃ ┃ ┣ LogAdapterInterface.go
┃ ┃ ┃ ┗ ValidatorAdapterInterface.go
┃ ┃ ┣ repositories/
┃ ┃ ┃ ┗ SampleRepositoryInterface.go
┃ ┃ ┗ services/
┃ ┃   ┗ SampleServiceInterface.go
┃ ┣ entities/
┃ ┃ ┗ Sample.go
┃ ┣ errors/
┃ ┃ ┗ DomainError.go
┃ ┣ globals/
┃ ┃ ┗ context.go
┃ ┗ usecases/
┃   ┗ sample/
┃ ┃   ┣ Sample.go
┃ ┃   ┣ creator.go
┃ ┃   ┣ deleter.go
┃ ┃   ┣ error.go
┃ ┃   ┣ fetcher.go
┃ ┃   ┗ updater.go
┣ externals/
┃ ┣ adapters/
┃ ┃ ┣ LogAdapter.go
┃ ┃ ┣ MySQLAdapter.go
┃ ┃ ┣ MySQLTxAdapter.go
┃ ┃ ┣ PostgresAdapter.go
┃ ┃ ┣ PostgresTxAdapter.go
┃ ┃ ┗ ValidatorAdapter.go
┃ ┣ errors/
┃ ┃ ┣ AdapterError.go
┃ ┃ ┣ RepositoryError.go
┃ ┃ ┗ ServiceError.go
┃ ┣ repositories/
┃ ┃ ┣ SampleMySQLRepository.go
┃ ┃ ┗ SamplePostgresRepository.go
┃ ┗ services/
┃   ┗ SampleService.go
┣ logs/
┃ ┗ .gitignore
┣ .dockerignore
┣ .gitignore
┣ .travis.yml
┣ Dockerfile
┣ LICENSE
┣ README.md
┣ cover.out
┣ doc.go
┣ go.mod
┣ go.sum
┗ main.go

Clone this wiki locally