Skip to content

Commit

Permalink
Merge pull request #12 from TypingMind/trungdq88-patch-1
Browse files Browse the repository at this point in the history
Update README.md
  • Loading branch information
travis-thuanle authored Mar 18, 2024
2 parents 26eba48 + 2556bd8 commit cc7341f
Showing 1 changed file with 14 additions and 59 deletions.
73 changes: 14 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,84 +10,39 @@ Plugins Server

## ๐ŸŒŸ Introduction

TypingMind Plugins Server is a flexible and customizable server designed to empower developers to extend its functionality with tailored plugins. Build integrations, automate tasks, and enhance your experience with the power of code.
Plugins Server provides a proxy server for [Typing Mind's Plugins](https://docs.typingmind.com/plugins). A proxy server is needed for complex use cases where a server is required for processing data that cannot be done from the client side in Typing Mind.

## ๐Ÿ”Œ Enhancing Plugins with Server-Side API Calls
Plugins Server is used by some built-in plugins on Typing Mind (e.g., Web Page Reader). Other plugins can also make use of the existing endpoints of the Plugins Server if needed. New endpoints can be added via Pull Requests.

While TypingMind plugins are primarily designed for client-side logic, they often need to interact with external APIs that require server-side actions (e.g., authentication, complex data processing). Here's how to achieve this:
Plugins Server is open-sourced and is intended to be self-hosted by individual users for private use only.

**1. Extend TypingMind Plugins Server Functionality**
## ๐Ÿ”Œ How to use (for Typing Mind users)

- **Fork and Modify:** Fork the TypingMind Plugins Server repository and directly implement your new API endpoint within the server code. This provides the most control and flexibility.
- **Submit a Pull Request:** If your API would be generally useful to the community, consider creating a pull request to integrate it directly into the main TypingMind Plugins Server project.
Two simple steps:

**2. Call Your Extended from the Plugin**
1. Deploy this repo on any hosting provider that supports NodeJS (e.g., Render.com, AWS, etc.). (We also provide a Dockerfile for easy deployment on Docker-supported hosting providers)
2. Use the server endpoint URL in your Settings page of Typing Mind's plugins.

- **Endpoint Access:** Once your API is implemented in TypingMind Plugins Server, your plugin can make standard HTTP requests to this new endpoint using client-side JavaScript libraries like `fetch` or `axios`.
Follow this guide for detailed instructions: [How to Deploy Plugins Server on Render.com](https://docs.typingmind.com/plugins/plugins-server/how-to-deploy-plugins-server-on-render)

**Example Scenario**
## List of available endpoints

Let's say you want a plugin that fetches additional user profile data from an external CRM system:
After deploying, visit your Plugins Server URL to see the list of available endpoints (served in Swagger UI).

1. You would either fork TypingMind Proxy and add an API endpoint like `/fetch-crm-data`, or submit a pull request with this feature.
2. Your plugin's client-side code would make a request to this endpoint, providing any necessary authorization tokens.
3. TypingMind Proxy's server-side code would handle the API call to the CRM, process the results, and return the data to your plugin.
Here are the latest endpoints from our public servers: https://plugins.typingmind.com/ (**Note**: this public server only hosts the API documentation. You cannot use this Public Server as your proxy. You must deploy your own Plugins Server to use all the available endpoints).

**Important Considerations:**

- **Security:** Carefully manage API keys and authentication within your proxy implementation.
- **Shared Plugins:** If you create a plugin with server-side dependencies, provide clear instructions if others want to use it in their TypingMind Plugins Server instances.

## ๐Ÿ“‹ Features

- **Powerful Plugin Architecture:** Design plugins to intercept requests, modify responses, and integrate with external services.
- **Streamlined Development:** Clear guidelines and documentation for rapid plugin creation.
- **Flexible Configuration:** Manage plugin settings and behavior through intuitive configuration.
- **Robust Core:** Stable proxy foundation with essential features built-in.
- **TypeScript Support (Optional):** Improved type safety and developer experience. [If TypeScript is integral to your project]
- **Community-Driven:** Open to contributions and plugin sharing.

## ๐Ÿ› ๏ธ Getting Started

### Step 1: Clone the Repository

```bash
git clone https://github.com/TypingMind/plugins-server.git
cd plugins-server
npm ci
```

### Step 2: Environment Configuration

1. **Create `.env`:** Begin by copying the provided `.env.example` file and renaming it to `.env`.

2. **Update `.env`:** Open your new `.env` file and fill in the required environment variables according to the project's specific needs.

### Step 3: Running the Project
## ๐Ÿ› ๏ธ Development (for Typing Mind plugins developers)

- **Development Mode:** To start the project in development mode, execute the following command in your terminal:

```bash
npm install
npm run dev
```

## ๐Ÿš€ Deploying Your Server

The TypingMind Plugins Server can be deployed to any server that supports Node.js. Here's how to deploy it to Render, a cloud platform that makes it easy to host and scale web apps and services.

1. Create a Render Account: If you don't have one, sign up at <https://render.com>.
2. New Web Service: In your Render dashboard, create a new Web Service.
3. Connect to Repository: Connect your forked TypingMind Plugins Server repository.
4. Environment Variables: Set up any required environment variables in Render's settings for your service.
5. Deploy: Deploy your service!

## ๐Ÿ”— Integration with TypingMind

Plugin Configuration: In your TypingMind plugin's code, direct API requests to the correct URL of your deployed TypingMind Plugins Server instance on Render.

## ๐Ÿค Contributing

We welcome your contributions! Help expand TypingMind Proxy's capabilities.
We welcome your contributions! Help expand TypingMind Plugins Server's capabilities.

- **Plugin Development:** Check out our 'CONTRIBUTING.md' guide for details on creating plugins.
- **Bug Reports & Ideas:** Open issues to report bugs or suggest new features.
Expand Down

0 comments on commit cc7341f

Please sign in to comment.