https://github.com/roc41d/notify-me
A Subscription Notification System
https://github.com/roc41d/notify-me
api-rest command jobscheduler laravel mysql queue send-email
Last synced: 2 months ago
JSON representation
A Subscription Notification System
- Host: GitHub
- URL: https://github.com/roc41d/notify-me
- Owner: roc41d
- Created: 2024-06-10T22:49:46.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-06-10T23:31:25.000Z (12 months ago)
- Last Synced: 2025-01-21T21:13:25.671Z (4 months ago)
- Topics: api-rest, command, jobscheduler, laravel, mysql, queue, send-email
- Language: PHP
- Homepage:
- Size: 71.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Subscription Notification System - Notify Me
A Laravel-based application that allows users to subscribe to websites and receive email notifications for new posts.
## Features
- Subscribe to websites using an email address.
- Create posts for subscribed websites.
- Send email notifications to subscribers for new posts.
- Ensure no duplicate notifications are sent.
- Use queues to handle email sending in the background.## Requirements
- PHP 7.4 or higher
- Composer
- MySQL
- Mailtrap or other email testing tool (for development)## Setup Instructions
### Step 1: Clone the Repository
```
git clone [email protected]:roc41d/notify-me.git
cd notify-me
```### Step 2: Install Dependencies
```
composer install
```### Step 3: Configure Environment Variables
```
cp .env.example .env
```Edit the .env file to set up your database, mail, and queue configurations:
```
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:YOUR_APP_KEY_HERE
APP_DEBUG=true
APP_URL=http://localhostLOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database
DB_USERNAME=your_username
DB_PASSWORD=your_passwordBROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=database
SESSION_DRIVER=file
SESSION_LIFETIME=120REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=your_mailtrap_username
MAIL_PASSWORD=your_mailtrap_password
MAIL_ENCRYPTION=null
[email protected]
MAIL_FROM_NAME="${APP_NAME}"
```### Step 4: Generate Application Key
```
php artisan key:generate
```### Step 5: Run Migrations
```
php artisan migrate
```### Step 6: Seed the Database (Optional)
```
php artisan db:seed
```### Step 7: Set Up Queue Worker
Start the queue worker to process the email jobs.
```
php artisan queue:work
```### Step 8: Set Schudeler
Start the scheduler worker to process cron jobs.
```
php artisan schedule:work
```### Step 9: Run the Application
```
php artisan serve
```### Step 10: Test the Application
```
http://localhost:8000/api/
```You can now use Postman or any other API client to interact with the endpoints.
#### Create Website
Endpoint: `POST /websites`Request Body:
```
{
"name": "Acme Inc",
"url": "https://acmeinc.xzy"
}
```#### Get Websites
Endpoint: `Get /websites?limit=20`#### Subscribe to a Website:
Endpoint: `POST /subscribe`
Request Body:
```
{
"email": "[email protected]",
"website_id": 1
}
```#### Create a Post:
Endpoint: `POST /posts`
Request Body:
```
{
"website_id": 1,
"title": "New Post Title",
"description": "Description of the new post."
}
```#### Create a Post:
Endpoint: `GET /posts?limit=20`
### Note: For testing purposes, the command checks for new posts and notifies subscribers every five minutes.
This can be change in `/routes/console.php`
```
Schedule::command(SendEmails::class)->everyFiveMinutes();
```