Skip to content

Directories

Gut edited this page Mar 2, 2021 · 4 revisions
.
├── .github/
├── bin/
├── bootstrap/
├── cmd/
    ├── api/
        ├── main.go
├── config/
├── database/
    ├── migrations/
├── lib/
    ├── api/
        ├── v1/
            ├── controllers/
                ├── base.go
            ├── forms/
            ├── routers/
            ├── serializers/
    ├── middlewares/
    ├── models/
        ├── base.go
    ├── services/
├── helpers/
├── tests/
    ├── factories/
    ├── fixtures/
    ├── test.go
├── go.mod
├── go.sum
  • .github/: Github templates and workflows.
  • bin/: Bash script.
  • bootstrap/: Application initializers (ex. database setup or load config).
  • cmd/: Application processes. One directory per one process.
    • api/: API process.
      • main.go: The starting point of API process.
  • config: Application configuration.
  • database: Database related files (ex. migrations).
  • lib: Application process handlers and shared codes between the handlers (ex. middlewares, models or services).
    • api/: Application API module.
      • v1/: API version.
        • controllers/: Request handler.
          • base.go: Base controller used by all controllers.
        • forms/: User input processor.
        • routers/: Process route.
        • serializers/: Data serializer. This is use to serialize the data before responding back to the requesting caller.
    • middlewares/: Application middleware (ex. authorization).
    • models/: Application models.
      • base.go: Base model used by all models.
    • services/: Application business logic.
  • helpers: Application helper functions. Most of them are reusable generic functions.
  • tests: Test helper functions and files.
    • factories/: Data that need to seed to the database before running the test cases (ex. user information).
    • fixtures/: Test fixtures (ex. VCR or uploaded files).
    • test.go: Test initializer function. This file is using bootstrap to ensure test and development environments are the same.
Clone this wiki locally