Skip to content

ahmed-fawzy99/mock-post-scheduler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Post Scheduler – Social Media Post Management

📋Contents

Video Demo

Watch video on Google Drive

Features

  • Schedule posts for future publication
  • Automatic posting
  • Robust Validation
  • Role-based actions
  • SPA experience
  • Responsive & friendly design

Tools & Frameworks

  • Laravel 12
  • Nuxt.js 3.16
  • TailwindCSS 4.0

Prerequisites

  • PHP 8.2 or higher
  • Composer
  • NPM
  • PostgreSQL (or any SQL DB)

Installation

This project consists of 2 sub-projects; API Backend using Laravel, and Frontend client using Nuxt.js. We will install both projects

Note: The following installation is directed for testing environment. This setup is not production-ready as this is not the purpose of this project. Further optimizations will be needed to convert it to a production service as using Docker, Octane and Supervisord.

Backend Installation

 git clone https://github.com/ahmed-fawzy99/mock-post-scheduler.git
 cd mock-post-scheduler/backend
 composer install
 cp .env.example .env 
 php artisan key:generate

Then open .env file do the following:

  • Fill in your database credentials.
  • Make sure QUEUE_CONNECTION=database is set for queues.
  • If you need to receive emails for testing, please add your SMTP settings or use mailpit.
  • Nuxt will run on port 3000 by default. If you are already using this port, please update the FRONTEND_URL field.

Make a symbolic link to the storage directory:

 php artisan storage:link

To generate basic data needed to start and test the system, we need to run the migrations and starter seeder:

 php artisan migrate --seed

You will need to run the queue for task scheduling and queues, and leave it running:

 php artisan queue:work --tries=3 

In production, this command must be used within a supervisord for resiliance.

Create a cron job to process scheduled posts. The following process is for UNIX-like operating systems. If you are on Windows, follow these instructions.

# Assuming cron is installed. Follow you distro instructions to install it otherwise.
crontab -e

# then, inside the cron file add thisL
* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

Alternatively, because this is testing environment, we can start another terminal instance and run this command:

php artisan schedule:work

On another terminal tab, Run the development server

php artisan serve

Frontend Installation

For Client-side Dependencies, head to the frontend folder:

 cd ../frontend
 npm install

Laravel runs on port 8000 by default. If you have changed this, update backendBase and backendApi in nuxt.config.ts

Finally, Run the frontend server:

npm run dev -- -o

Usage

We have seeded the database with platforms, users, and posts.

To try the system as admin, login as:

email: [email protected]

password: password

To try the system as a normal user, login with any email of the seeded users with password "password"

The scheduler works every minute to post pending scheduled posts as an independent job. To extend this behaviour, you can implement your branching logic for each platform in app/Jobs/Api/V1/ProcessScheduledJobs.php. I recommnded to create an independent job for each platform and dispatch it for each pending job.

Contact

You can reach me using any of the following media:

About

Mock Social Media Posts Scheduler - Laravel + Nuxt.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published