Skip to content

BerryBytes/01cloud-notification

01cloud Notification Service

Build License

01cloud-notification is a Go-based gRPC service for publishing, storing, querying, and managing notification and activity-log events across distributed systems.

Features

  • gRPC API for notification lifecycle operations (Publish, Post, Query, Update, Delete, MarkAll)
  • Activity log APIs (StoreActivityLog, GetActivityLog)
  • Email dispatch support via SMTP
  • Pluggable message brokers:
    • Google Pub/Sub (default)
    • RabbitMQ
  • Pluggable storage backends:
    • Firestore (default)
    • MongoDB

Installation

Prerequisites

  • Go 1.22+
  • Protobuf compiler (protoc) if you regenerate gRPC stubs
  • Access to one message backend (Pub/Sub or RabbitMQ)
  • Access to one store backend (Firestore or MongoDB)

Clone and run

  1. Clone the repository.

  2. Copy the sample environment file:

    cp .env.sample .env
  3. Update .env with your environment values.

  4. Install dependencies and start:

    go mod download
    go run .

The server starts on 0.0.0.0:$GRPC_SERVER_PORT.

Recommended developer workflow

pre-commit install
pre-commit run --all-files
go test ./...

Usage

Using generated proto files

Use the proto definition from proto/notification/notification.proto in your client service.

Minimal Go client example

package main

import (
	"context"
	"time"

	pb "github.com/berrybytes/01cloud-notification/proto/notification"
	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials/insecure"
)

func main() {
	conn, _ := grpc.Dial("localhost:10080", grpc.WithTransportCredentials(insecure.NewCredentials()))
	defer conn.Close()

	client := pb.NewNotificationClient(conn)
	ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
	defer cancel()

	_, _ = client.Post(ctx, &pb.PostRequest{
		Message: &pb.Message{
			Type:   "info",
			Body:   "hello from client",
			SendBy: "example-client",
			User:   1,
		},
	})
}

Configuration

The service is configured through environment variables.

Variable Required Description
GRPC_SERVER_PORT Yes gRPC server port
STORE_TYPE No firestore (default) or mongo
MESSAGE_TYPE No pubsub (default) or rabbitmq
GCLOUD_PROJECT Required for Pub/Sub/Firestore Google Cloud project ID
GCLOUD_NAMESPACE Required for Pub/Sub/Firestore Prefix for topics/collections
MONGO_URL Required for MongoDB MongoDB connection string
MONGO_DB Required for MongoDB MongoDB database name
RABBITMQ_URL Required for RabbitMQ AMQP connection URL
WS_SERVER Optional WebSocket server base URL
WS_SECRET Optional Token used when sending websocket notifications
DB_URL Optional SQL connection format used by controller logic
SMTP_HOST Optional SMTP host
SMTP_PORT Optional SMTP port
SMTP_USERNAME Optional SMTP username
SMTP_PASSWORD Optional SMTP password
SMTP_FROM_ADDRESS Optional Sender address
HOST_URL Optional Product/app URL used in email templates
PRODUCT_LOGO Optional Logo URL used in email templates

See .env.sample for a template.

Contributing

Contributions are welcome. Please read CONTRIBUTING.md before opening issues or pull requests.

Security

Please report vulnerabilities privately as described in SECURITY.md.

License

This project is currently licensed under Apache 2.0. See LICENSE.

About

01cloud Notification Service is a Go-based gRPC backend for publishing, storing, querying, and managing notification and activity-log events in distributed systems.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors