ReCiter PubNotifier is an application utilizing AWS Lambda to enhance the publication notification process within academic environments. It automates notifications to faculty regarding new academic publications, whether accepted or in-review, and integrates with ReCiter Publication Manager and ReCiterDB.
- Installation of ReCiterDB - ReCiterDB serves as the backend data store for the Publication Manager, housing the schema and stored procedures. This repository includes scripts that fetch data from ReCiter and import it into a MySQL database.
- Installation of ReCiter Publication Manager - This application allows users to update how often they wish to receive notifications, and allows administrators to control what appears in the outbound emails.
- Creation of an
.env
file in the root directory with the following configurations:
RECITER_DB_NAME=<Your MySQL DB Name>
RECITER_DB_USERNAME=<Your MySQL DB Username>
RECITER_DB_PASSWORD=<Your MySQL DB Password>
RECITER_DB_HOST=<Your MySQL DB Host> # e.g., localhost
SMTP_HOST_NAME=<Your SMTP Host Name>
NODE_ENV=development
SMTP_USER=<Your SMTP Username>
SMTP_PASSWORD=<Your SMTP Password>
SMTP_ADMIN_EMAIL=<Your SMTP Admin Email>
- Node.js: An open-source, cross-platform server environment.
- TypeScript: A superset of JavaScript designed for scalable applications.
- Sequelize: A TypeScript and Node.js ORM for MySQL and MariaDB.
- Nodemailer: Simplifies sending emails from Node.js applications.
- dotenv: Manages environment configuration separate from the code.
- MySQL2: A high-performance MySQL driver.
- Handlebars: A template engine to build semantic templates with ease.
To set up a local development environment:
- Clone the repository:
git clone https://github.com/wcmc-its/ReCiter-PubNotifier.git
- Install the application dependencies:
# Install Node.js (use the latest LTS version) brew install node@20.10.0 # Install NPM dependencies npm install
- Build the application:
npm run build
To start the development server:
npm run dev # or yarn dev
The server will process notifications from the DB and send emails about approved or suggested publications to the designated recipients.
To deploy ReCiter PubNotifier to AWS Lambda:
- Build the project:
npm run build
- This generates a
dist
directory with transpiled.js
files and the required node modules (runnpm install --only=production
). - Create a .zip file using a CLI utility like 7zip or a GUI application.
- Upload the .zip to an AWS S3 bucket and copy the file's S3 URL.
- In AWS Lambda, create a new function for ReCiter PubNotifier and upload the .zip using the S3 URL.
- If the .zip is larger than 10MB, AWS Lambda's inline code editor won't be able to extract it, but the function can still be tested.
- Use the Test tab next to the Code tab to create a test event.
- To schedule the function, click on the Add Trigger button and set up a cron expression.
- Check AWS CloudWatch logs for detailed execution logs.