Micro AI Tool
Facebook & X Post Rewriter
This project rewrites rough social posts into cleaner, stronger versions for different platforms without using a database.
What It Does
- Takes a raw post draft as input.
- Targets platform-specific rewriting for X, Facebook, LinkedIn, Instagram, or Threads.
- Returns a primary version, a shorter version, and an alternative angle.
- Also suggests a hook, hashtags, and publishing notes.
- Shows the final result inside a focused modal popup for fast copying.
Setup
- Open
functions/config.local.php. - Add your OpenAI API key to
openai_api_key. - Keep or change the default model in
openai_model. - Optional: add
adsense_clientandadsense_sidebar_slotto activate the right sidebar ad area. - Make sure PHP
curlis available on the server. - Load
/FacebookXPostRewriter/in your browser through MAMP.
How To Use
- Paste the original post draft.
- Select the target platform.
- Choose the rewrite mode and tone.
- Add goal or context if needed.
- Click
Rewrite Post. - Review and copy the result from the popup modal.
Folder Structure
index.php– main UI entry pointcss/style.css– interface stylingjs/app.js– browser-side interactions and modal flowfunctions/lib.php– rewrite logic, OpenAI requests, validation, rate limitingfunctions/api.php– backend API endpointfunctions/config.local.php– local API key, model, and ad settingsstorage/logs– error and debug logs
Security Notes
- The
functionsandstoragefolders are protected with.htaccess. - Requests use a CSRF token.
- A simple file-based rate limit reduces abuse without a database.
Troubleshooting
- If rewriting fails, check
functions/config.local.phpfor the API key. - If the API returns an error, inspect the generated log file under
storage/logs. - If the popup does not open, make sure JavaScript is enabled.
- If folder protection does not work, make sure Apache allows
.htaccessoverrides.