Categorygithub.com/quantonganh/mailbus
modulepackage
0.0.0-20240321235013-81646735b773
Repository: https://github.com/quantonganh/mailbus.git
Documentation: pkg.go.dev

# README

Mailbus

Mailbus is a self-hosted email newsletter that allows:

  • A blog visitor to subscribe to the newsletter
  • Blog author to send an email to all subscribers
  • A subscriber to unsubscribe from the newsletter

API Design

  • POST /subscriptions: sign up a new subscriber
  • GET /subscriptions/confirm: subscriber consent
  • GET /unsubscribe: unsubscribe from the newsletter

Data Schema

CREATE TABLE subscriptions (
    id            INTEGER PRIMARY KEY AUTOINCREMENT,
    email         TEXT NOT NULL UNIQUE,
    subscribed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE subscription_tokens (
    subscription_token TEXT NOT NULL,
    subscriber_id      INTEGER NOT NULL REFERENCES subscriptions (id),

    PRIMARY KEY (subscription_token)
);

Sequence Diagram

sequenceDiagram
    Visitor ->> Blog: Enter an email address
    Blog ->> Blog: Validate email address
    Blog ->> Mailbus: POST /subscriptions
    Mailbus ->> Visitor: Send confirmation email
    Visitor ->> Mailbus: GET /subscriptions/confirm 

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

No description provided by the author
No description provided by the author
NewSubscription returns new subscriber.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Subscribe status.
Subscribe status.
Subscribe status.

# Structs

Config represents the main config.
No description provided by the author
No description provided by the author
Subscriber represents a subscriber.
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author
NewsletterService is the interface that wraps methods related to SMTP.
No description provided by the author
SubscriptionService is the interface that wraps methods related to subscribe function.