Skip to content

Commit b751ddf

Browse files
authored
Merge pull request #31 from jp-ryuji/rename-repo-v2
Rename repo v2
2 parents 6f5fb35 + 713297d commit b751ddf

File tree

97 files changed

+300
-289
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+300
-289
lines changed

README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
1-
# go-ddd
1+
# go-arch-patterns
22

3-
This repository showcases the Ports and Adapters architectural pattern (also known as Hexagonal Architecture) and Domain-Driven Design (DDD) methodology, with a focus on fundamental concepts such as value objects. For more details about the software architecture, see [Software Architecture](docs/software_architecture.md).
3+
This repository demonstrates various architectural patterns and design principles for building scalable backend systems in Go. The codebase showcases architectural patterns, database design techniques, and SaaS-specific implementations through a practical car rental platform example.
44

5-
The system represents a SaaS platform for car rental companies. For more details about the system, see [Entity Relationship Diagram](docs/er-diagram.md).
5+
For more details about the architecture, see [Software Architecture](docs/software_architecture.md).
6+
For the data model and relationships, see [Entity Relationship Diagram](docs/er-diagram.md).
67

78
## Key Implementation Examples
89

910
This repository demonstrates the following software engineering concepts:
1011

12+
### Domain-Driven Design & Architecture
13+
1114
- **Value Object**:
1215
- *Definition*: See [Email value object](internal/domain/model/value/email.go) with [tests](internal/domain/model/value/email_test.go)
1316
- *Usage*: See [Individual entity](internal/domain/model/individual.go) using the Email value object
17+
18+
### Database Design Patterns
19+
1420
- **Class Table Inheritance**: See [Renter model](internal/domain/model/renter.go) as the base class with [Company](internal/domain/model/company.go) and [Individual](internal/domain/model/individual.go) as specialized subclasses
1521

22+
### SaaS & Microservices Patterns *(Coming Soon)*
23+
24+
- **PostgreSQL Row-Level Security**: Multi-tenant data isolation
25+
- **Outbox Pattern**: Reliable event publishing for distributed systems
26+
1627
## Documentation
1728

1829
Find specific documentation in the [docs/](docs/) folder:

docs/installation_guide.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
## Clone the repository
44

55
```bash
6-
git clone https://github.com/jp-ryuji/go-ddd.git
7-
cd go-ddd
6+
git clone https://github.com/jp-ryuji/go-arch-patterns.git
7+
cd go-arch-patterns
88
```
99

1010
## Set up environment variables with direnv
@@ -97,7 +97,7 @@ docker compose down
9797
You can access the PostgreSQL database using the following command:
9898

9999
```bash
100-
PGPASSWORD=$POSTGRES_PASSWORD docker exec -it go-ddd-postgres-1 psql -U $POSTGRES_USERNAME -d $POSTGRES_DBNAME
100+
PGPASSWORD=$POSTGRES_PASSWORD docker exec -it go-arch-patterns-postgres-1 psql -U $POSTGRES_USERNAME -d $POSTGRES_DBNAME
101101
```
102102

103103
This command uses the environment variables loaded by direnv to connect to the database.

docs/software_architecture.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Structure:
5050

5151
## Go `internal` Directory
5252

53-
The `internal` directory is a special directory in Go that restricts access to its contents. Only code within the same module (in this case, `go-ddd`) can import packages from `internal` directories. This prevents other projects from importing and depending on our internal implementation details, which helps maintain a clean public API and allows us to change internal implementations without breaking external dependencies.
53+
The `internal` directory is a special directory in Go that restricts access to its contents. Only code within the same module (in this case, `go-arch-patterns`) can import packages from `internal` directories. This prevents other projects from importing and depending on our internal implementation details, which helps maintain a clean public API and allows us to change internal implementations without breaking external dependencies.
5454

5555
In this project, all core business logic, domain models, use cases, and infrastructure implementations are placed under the `internal` directory to enforce this encapsulation and prevent accidental exposure of internal details as part of the public API.
5656

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/jp-ryuji/go-ddd
1+
module github.com/jp-ryuji/go-arch-patterns
22

33
go 1.25.0
44

internal/domain/model/factory/company.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package factory
33
import (
44
"time"
55

6-
"github.com/jp-ryuji/go-ddd/internal/domain/model"
7-
"github.com/jp-ryuji/go-ddd/internal/pkg/id"
6+
"github.com/jp-ryuji/go-arch-patterns/internal/domain/model"
7+
"github.com/jp-ryuji/go-arch-patterns/internal/pkg/id"
88
)
99

1010
// NewCompany creates a new Company for testing purposes

internal/domain/model/factory/individual.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import (
44
"time"
55

66
"github.com/aarondl/null/v9"
7-
"github.com/jp-ryuji/go-ddd/internal/domain/model"
8-
"github.com/jp-ryuji/go-ddd/internal/domain/model/value"
9-
"github.com/jp-ryuji/go-ddd/internal/pkg/id"
7+
"github.com/jp-ryuji/go-arch-patterns/internal/domain/model"
8+
"github.com/jp-ryuji/go-arch-patterns/internal/domain/model/value"
9+
"github.com/jp-ryuji/go-arch-patterns/internal/pkg/id"
1010
)
1111

1212
// NewIndividual creates a new Individual for testing purposes

internal/domain/model/factory/renter.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package factory
33
import (
44
"time"
55

6-
"github.com/jp-ryuji/go-ddd/internal/domain/model"
7-
"github.com/jp-ryuji/go-ddd/internal/pkg/id"
6+
"github.com/jp-ryuji/go-arch-patterns/internal/domain/model"
7+
"github.com/jp-ryuji/go-arch-patterns/internal/pkg/id"
88
)
99

1010
// NewRenter creates a new Renter for testing purposes

internal/domain/model/factory/tenant.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package factory
33
import (
44
"time"
55

6-
"github.com/jp-ryuji/go-ddd/internal/domain/model"
7-
"github.com/jp-ryuji/go-ddd/internal/pkg/id"
6+
"github.com/jp-ryuji/go-arch-patterns/internal/domain/model"
7+
"github.com/jp-ryuji/go-arch-patterns/internal/pkg/id"
88
)
99

1010
// NewTenant creates a new Tenant for testing purposes

internal/domain/model/individual.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/aarondl/null/v9"
77
"github.com/oklog/ulid/v2"
88

9-
"github.com/jp-ryuji/go-ddd/internal/domain/model/value"
9+
"github.com/jp-ryuji/go-arch-patterns/internal/domain/model/value"
1010
)
1111

1212
// Individuals is a slice of Individual

internal/domain/model/individual_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"time"
66

77
"github.com/aarondl/null/v9"
8-
"github.com/jp-ryuji/go-ddd/internal/domain/model/value"
8+
"github.com/jp-ryuji/go-arch-patterns/internal/domain/model/value"
99
"github.com/stretchr/testify/require"
1010
)
1111

0 commit comments

Comments
 (0)