Home > Backend Development > Golang > E-Commerce Platform with Golang : Project Directory Structure

E-Commerce Platform with Golang : Project Directory Structure

Barbara Streisand
Release: 2024-10-04 22:07:02
Original
590 people have browsed it

E-Commerce Platform with Golang : Project Directory Structure

Our e-commerce platform will follow this directory structure


rmshop-clean-architecture/
│
├── cmd/
│   ├── api/
│   │   └── main.go                 # Main application entry point
│   └── seedadmin/
│       └── main.go                 # Admin seeding command
│
├── internal/
│   ├── config/
│   │   └── config.go               # Application configuration
│   │
│   ├── delivery/
│   │   └── http/
│   │       ├── handlers/
│   │       │   ├── user_handler.go
│   │       │   ├── admin_handler.go
│   │       │   ├── product_handler.go
│   │       │   └── ...
│   │       ├── middleware/
│   │       │   ├── auth.go
│   │       │   └── ...
│   │       └── routes.go
│   │
│   ├── domain/
│   │   ├── user.go
│   │   ├── product.go
│   │   └── ...
│   │
│   ├── repository/
│   │   ├── interfaces.go
│   │   └── postgres/
│   │       ├── user_repository.go
│   │       ├── product_repository.go
│   │       └── ...
│   │
│   ├── usecase/
│   │   ├── user_usecase.go
│   │   ├── product_usecase.go
│   │   └── ...
│   │
│   └── server/
│       └── server.go
│
├── pkg/
│   ├── auth/
│   │   └── jwt.go
│   ├── database/
│   │   ├── migrations.go
│   │   └── postgres.go
│   └── ...
│
├── migrations/
│   ├── 001_create_users_table.up.sql
│   ├── 001_create_users_table.down.sql
│   └── ...
│
├── go.mod
├── go.sum
└── README.md


Copy after login

This structure adheres to clean architecture principles

  • cmd/: Contains the main applications of the project.
  • internal/: Houses the core application code, inaccessible to other projects.

  • config/: Application configuration.

  • delivery/: Handles how the data is presented to and received from the user.

  • domain/: Defines core business logic and entities.

  • repository/: Handles data storage and retrieval.

  • usecase/: Contains application-specific business rules.

  • server/: Manages the HTTP server setup.

  • pkg/: Shared packages that can be used by external applications.

  • migrations/: Database migration files.

The above is the detailed content of E-Commerce Platform with Golang : Project Directory Structure. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template