This is a CLI app that I built using Node.js, TypeScript, and Redis. It uses the Gmail API to send and receive emails, and it's built with OCLIF.
Disclosure: This project talks about death ⚰️
My family is my top priority—my wife, our home, everything we are building together. They are what drive me to do better every day, to think about the future, and to ensure I’m present, even when I can’t be there physically.
We’re not taught to think or talk about death, but it’s necessary. It’s a difficult conversation, yet unavoidable, because it’s the only way to ensure that those who matter most to us will be cared for and informed when they need it the most. Ignoring it doesn’t change reality; planning is an act of love.
With this in mind, I created Legacy for Family Notifier. A simple app with a clear purpose: to help those who care about their families leave everything organized, ensuring nothing is left unanswered or unsupported during critical times.
If you also care deeply about your family, I invite you to explore, use, and collaborate. The project is open-source, and I believe that together we can create something even greater.
Dhyego Calota
This app is useful for individuals who wish to leave a legacy message for their family members. It tracks the notification schedule and sends messages based on predefined conditions, ensuring that your message is delivered when needed.
It's simple! Here's how it works:
- The app will send a Check Email notification to the Manager on the specified days of the month.
- The Manager is able to Cancel the Legacy Email notification by simply replying to the Check Email.
- If the Manager does not cancel the Legacy Email, the app will send the Legacy Email to the Family Member on the last specified day of the month.
- Install Node
>=18.0.0
- Install Redis
- Set Up Google OAuth2 Credentials
This app requires sensitive OAuth scopes to read and send emails using the Gmail API. I will guide you to set up a Test App in your Google Cloud Console so that you don't need to go through the verification process.
- Go to the Google Cloud Console
- Create a new project
- Search for the
Gmail API
and enable it - Go to the menu
APIs & Services
>OAuth consent screen
- Complete the OAuth consent screen setup with the following scopes:
https://www.googleapis.com/auth/gmail.readonly
https://www.googleapis.com/auth/gmail.send
- Add your email address as a test user
- Go to the menu
APIs & Services
>Credentials
- Click on
Create Credentials
>OAuth client ID
- Select
Desktop App
as the application type - Type a name for the OAuth client ID
- Save the
clientId
andclientSecret
so that you can use them in the configuration file
- Complete Prerequisites
- Clone the
legacy-for-family-notifier.config.sample.json
file and rename it toconfig.json
- Configure the
config.json
file with your settings - Install dependencies by running
yarn install
- Authenticate the Google account by running
./bin/run.js authenticate --config-file=./config.json
- Run the app by running
./bin/run.js run --config-file=./config.json
Name | Type | Default | Notes |
---|---|---|---|
NODE_ENV |
production | development |
production |
Enables headless browsing in production |
CONFIG |
JSON |
{} |
Configuration settings for the app in JSON format; See Configuration |
The configuration is defined in a JSON file. Here is a sample configuration:
Name | Type | Required | Default | Notes |
---|---|---|---|---|
storage |
Object |
Yes | Storage configuration for notifications | |
storage.adapter |
String |
Yes | Storage adapter to use | |
emailClient |
Object |
Yes | Email client configuration | |
emailClient.adapter |
String |
Yes | Email client adapter to use | |
senderEmailAddress |
String |
Yes | Email address used to send notifications | |
managerEmailAddress |
String |
Yes | Email address for managing notifications | |
familyEmailAddress |
String |
Yes | Email address of the family member to notify | |
checkEmail |
Object |
Yes | Email configuration for checking notifications | |
checkEmail.subject |
String |
Yes | Subject of the email to check | |
checkEmail.body |
String |
Yes | Body of the email to check | |
legacyEmail |
Object |
Yes | Email configuration for sending legacy message | |
legacyEmail.subject |
String |
Yes | Subject of the email to send | |
legacyEmail.body |
String |
Yes | Body of the email to send | |
cancellationEmail |
Object |
Yes | Email configuration for sending cancellation message | |
cancellationEmail.subject |
String |
Yes | Subject of the email to send | |
cancellationEmail.body |
String |
Yes | Body of the email to send | |
sequenceOfMonthDaysToNotify |
Array |
Yes | Sequence of month days to notify |
Name | Description | Notes |
---|---|---|
./bin/run.js authenticate --config-file=./config.json |
Authenticates the Google account with the provided configuration file | Requires setting up the configuration file first |
./bin/run.js dry-run --config-file=./config.json |
Runs the app in dry-run mode with the provided configuration file | Requires setting up the configuration file first |
./bin/run.js run --config-file=./config.json |
Runs the app with the provided configuration file | Requires setting up the configuration file first |
Name | Description | Notes |
---|---|---|
yarn build |
Builds the TypeScript and outputs in the dist/ folder |
|
yarn lint |
Lints the TypeScript codebase | |
yarn start |
Starts an HTTP server using the dist/ folder |
Requires executing yarn build first |
yarn check-circular-dependencies |
Checks for circular dependencies in the codebase |
This app should be easy to deploy to any production environment that supports Node 18+ with environment variables.
I created a button to deploy this app to Render. You can deploy it with a single click.
- Deploy to Render using the button above
- Open the build logs and wait for the Authentication URL and the Tunnel URL
- Visit the Authentication URL and authenticate the Google account
- Copy the
code
query parameter from the URL and append to the Tunnel URL - Execute the following commands:
TUNNEL_URL=<paste-tunnel-url-here>
CODE=<paste-code-here>
curl $TUNNEL_URL/?code=$CODE
This was a hobby project born out of real needs and there was no funding budget at all.
All kinds of contributions or constructive usage feedback are encouraged. Please feel free to create an Issue, open a Pull Request, or contribute by answering someone else's Issues.
I'll do my best to review new Issues and Pull Requests ASAP.
You can run this app in Debug Mode on your local machine.
DEBUG=* ./bin/run.js run --config-file=./config.json
Dhyego Calota [email protected]
MIT