Skip to content

mr-alham/Learn-Malay-With-Notifications

Repository files navigation

Learn Bahasa Melayu with Notifications

This system delivers Malay vocabulary item per day through push notifications. It is a Automated, Zero Interaction language learning tool. The application written using Bash, runs as a scheduled Cron job on AWS EC2 Instance, Google's Gemini for content generation and an NTFY server(self hosted via Docker) for notification delivery.

This demonstrates capability in Linux Automation, Bash Scripting, Cloud Deployment, API Integration, Docker, Configuration management and production style operational design.

GitHub Created At GitHub commit activity

Example Picture 01

Quick links

System Capabilities

Engineering Capabilites Demonstrated

  • Bash Automation
  • API Integration
  • Use of Environment Scoped Configuration Files Under /usr/local/etc
  • Secure Credential Handling
  • Self Hosted NTFY Server Via Docker
  • Scheduled With Cron
  • Error Logging
  • State Management Using Persistant Files

Architecture

Technical-Architecture-Learn-Malay-With-Notifications

Components

  • Written using Bash Script
  • Hosted on AWS EC2 Instance
  • Scheduled with Cron
  • Generated sentences using Google Gemini API
  • Stored configuration files on /usr/local/etc directory and Executable file on /usr/local/bin
  • Self hosted NTFY server on Docker
  • Got API requests through curl

File Structure

/usr/local/etc/let-s-learn-malay/
    ├── gemini.conf      - Has configurations for Gemini API (API key, Gemini Model)
    ├── ntfy.conf        - Has NTFY server configurations (URL, Topic name, Auth token)
    ├── data.state       - Holds the current learning day index
    └── word-list.txt    - Vocabulary list
/usr/local/bin/
    └── learn-malay-ntfy.sh

Functional Flow

  1. CronJob triggers the script once per day.
  2. Script loads environment variables from config files.
  3. Day counter is read from data.state and determine the vocabulary from word-list.csv file to request.
  4. Gemini API generates meaning and example sentences.
  5. NTFY sends a formatted notification to subscribed devices
  6. State file increments to ensure new content on next iteration.

Installation

Prerequisites

  • Linux Environment
  • Bash
  • curl
  • jq
  • Docker (Optional)

Clone the Repository

git clone https://github.com/mr-alham/Learn-Malay-With-Notifications.git
cd Learn-Malay-With-Notifications

Install Into System Paths

sudo cp -r let-s-learn-malay/ /usr/local/etc/
sudo cp learn-malay-ntfy.sh /usr/local/bin/

Set Permissions

sudo chmod +x /usr/local/bin/learn-malay-ntfy.sh
sudo chmod +w -R /usr/local/etc/let-s-learn-malay

Configurations

Gemini gemini.conf

  • Get API key from Google AI Studio

  • /usr/local/etc/let-s-learn-malay/gemini.conf

Ntfy ntfy.conf

  • Generate using ntfy token add <user name> or on docker sudo docker exec -it ntfy ntfy token add <user name>
  • Add URL for the ntfy server (If self hosted) *Optional
  • And add Topic for the conversation

Deploy Ntfy Server

sudo docker run -d \
  --name ntfy \
  --restart unless-stopped \
  -p 8889:80 \
  -v ntfy:/etc/ntfy \
  -v ntfy_cache:/var/cache/ntfy binwiederhier/ntfy \
serve

Manual Execution

  • Run directly on the terminal. As the file is on /usr/local/bin it will automatically search as a PATH
learn-malay-ntfy.sh

Automate Scheduling

Add a Cron entry on your host pc. So it will run automatically as you intended.

(crontab -l ; echo "30 8 * * * /usr/local/bin/learn-malay-ntfy.sh") | crontab -

The app will execute every morning at 8.30AM.

Contact Me