The Social API Demo is a web application that allows users to compose, schedule, and post content to multiple social media platforms simultaneously. If you have a Business Plan, you can also allow your user to link their social accounts.
Built with React and Node.js, it leverages the Ayrshare API to manage social media posts across various networks. It is built upon Ayrshare's Social Media API
- Compose posts with text and media (images/videos).
- Schedule posts for future publication.
- Post to multiple social networks (Facebook, Instagram, LinkedIn, TikTok, X/Twitter).
- View post history and status.
- Filter by success or error posts.
- Responsive design for desktop and mobile use.
- See Ayrshare's API Docs for more info.
Before you begin, ensure you have met the following requirements:
- Node.js (v18.0.0 or later)
- npm (v8.0.0 or later)
- An Ayrshare account and an Ayrshare API key
-
Clone the repository:
git clone https://github.com/ayrshare/social-api-demo.git cd social-api-demo
-
Install dependencies for both frontend and backend:
cd social-api-demo npm install cd functions npm install
-
Create a
.env
file in the functions directory with your Ayrshare API key:AYRSHARE_API_KEY=your_api_key_here
-
If you have an Ayrshare Business Plan, you can set up the ability for your users to link their social accounts. Use the data provides in your Business integration package. In the
.env
file add:AYRSHARE_DOMAIN=your_domain AYRSHARE_PROFILE_KEY=your_users_profile_key AYRSHARE_PRIVATE_KEY=./privatekeys/private.pem
-
Frontend: Update the
baseURL
insrc/utils/constants.js
if your functions are not running onhttp://localhost:3001
. -
Backend: Update the
corsOptions
inserver.js
. Currernly all domains are allows and is not recommended for production.
-
Start the backend server:
cd functions npm run start
-
In a new terminal, start the frontend development server:
cd social-api-demo npm run dev
-
Open your browser and navigate to
http://localhost:5173
(or the port specified by Vite).
- Compose your post by entering text in the text area.
- Optionally, upload an image or video by clicking the image icon.
- Select the social networks you want to post to by checking the corresponding boxes.
- If you want to schedule the post, click the calendar icon and select a date and time.
- Click "Post Now" or "Schedule Post" to submit your post.
- View your post history in the timeline below the posting form.
Contributions to SocialPost are welcome. Please follow these steps:
- Fork the repository.
- Create a new branch:
git checkout -b <branch_name>
. - Make your changes and commit them:
git commit -m '<commit_message>'
- Push to the original branch:
git push origin <project_name>/<location>
- Create the pull request.
Alternatively, see the GitHub documentation on creating a pull request.
This project uses the following license: MIT License.
If you want to contact us, you can reach us via chat at https://www.ayrshare.com.