Cillop Architecture Base Example
This is a base example of the Cillop architecture. It is a simple product service that allows you to create and get products.
Directory Structure π
app
Contains core business logic components.
command
: Houses command handlers, which handle command requests.
product_create.go
: Defines the creation of a product.
query
: Consists of query handlers, responsible for fetching data.
product_get.go
: Defines how to get product information.
cmd
main.go
: The entry point of the application.
config
config.go
: Manages the application configuration files.
locales
en.toml
: Contains localization files for supporting multiple languages.
domains
: Encapsulates business logic into separate domain models
product
: Contains all the product related business logic.
server
Holds different types of server implementations.
event-stream
: Event streaming related components.
http
: HTTP server and related functionalities.
rpc
: Remote Procedure Call (RPC) server and related functionalities.
protos
: Contains Protocol Buffer files.
routes
: Contains generated Protocol Buffer Go files.
service
application.go
: Contains service application logic which binds everything together.
Building and Running π
# Building the application
go build -o cillop ./cmd
# Running the application
./cillop
Docker Support π³
A Dockerfile is included to build a Docker image of the application.
# Build Docker Image for production
docker build -t cillop-app .
# Run Docker Container for development (hot reloading)
docker build -t cillop-app -f Dockerfile.dev .
# Copy env file from .env.example
cp .env.example .env
# Run Docker Container for production
docker run -p 8080:8080 --env-file .env --name cillop-app cillop-app
Nats and DB Setup π¦
Nats
- Install Nats with jetstream locally using Docker
docker run -d -p 4222:4222 -p 8222:8222 -p 6222:6222 --name nats-cillop -ti nats:latest --js
MongoDB
- Install MongoDB locally using Docker
docker run -d -p 27017:27017 --name mongo-cillop mongo:latest
Dependencies π¦
Go Modules are used for dependency management, which are listed in go.mod and go.sum.
Contributing π€
We welcome contributions! Please see CONTRIBUTING.md for details on how to contribute.
License π
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.