🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

github.com/DagmarC/go-app-layout

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/DagmarC/go-app-layout

v0.0.0-20240208120511-76e7cba5995c
Version published
Created

Project structure example

Example is by the https://github.com/geisonbiazus/blog/tree/main

NOTE.1: the project holds only some of the folders and files just to demonstrate how applying the concepts of clean architecture could divide the app into the separate parts.

NOTE.2: README.md does not contain all the files that the actual project example does.

  • cmd — Contains the main file for the delivery mechanism (web). deployment — Deployment scripts.

    • web main.go (calls app.NewContext(), heart of the app)
  • internal — The most important folder, contains the implementation of all the layers and components.

    • adapters
      • cache
      • postrepo
        • filesystem
          • fixtures (for tests)
            • posts
              • test-post-1.md
            • empty_folder
            • invalid folder
          • parser.go
          • parser_test.go
          • post_repo.go
          • post_repo_test.go
        • post_repo.go (CONSTRUCTOR)
      • renderer
        • goldmark
          • renderer.go
          • renderer_test.go
        • renderer.go (CONSTRUCTOR)
      • userrepo
        • memory
          • user_repo.go
        • postgres
          • user_repo.go
          • user_repo_test.go
        • user_repo.go (CONSTRUCTOR)
      • oauth2provider
        • fake
        • github
        • oauth_2_provider.go (CONSTRUCTOR)
      • tokencoder
        • jwt
        • token_encoder.go (CONSTRUCTOR)
      • publisher
      • pubsub
        • memory
          • pubsub.go
          • pubsub_test.go
        • pubsub.go (CONSTRUCTOR)
      • idgenerator
        • fake
        • id_generator
        • id_generator.go (CONSTRUCTOR)
      • transactionmanager
        • postgres
        • fake
      • commentrepo
        • memory
        • postgres
        • comment_repo.go (CONSTRUCTOR)
    • app
      • context.go
    • core
      • auth
        • (usecases, entities, ports)
      • blog
        • entities.go
        • ports.go
        • view_post_use_case.go
        • view_post_use_case_test.go
        • list_posts_use_case.go
        • list_posts_use_case_test.go
      • discussion
        • (usecases, entities, ports)
      • shared
        • entities.go (e.g. Event struct)
        • ports.go (e.g. TransactionManager interface)
    • ui
      • web
        • handlers
          • list_post_handler.go
          • list_post_handler_test.go
          • log_handler.go
          • log_handler_test.go
          • template_handler.go
          • template_handler_test.go
          • ...
        • lib
          • template_renderer.go
        • ports
        • test
        • router.go
        • server.go
      • subscriptions
  • pkg — Project independent packages with the intention of” extending” the language. Each one of these packages could be released as a standalone library.

    • dbrepo
    • migration
    • testhelper
  • posts/filestore — Specific for this project. This is where the written posts using markdown are stored.

    • // storage place
  • test — Contains integration tests and other test assets.

    • integration (api)
    • posts
  • web — Web-related stuff like templates and static files.

FAQs

Package last updated on 08 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts