Update README.md for Puter.js: Enhance formatting, add installation instructions, and include community links

This commit is contained in:
jelveh
2025-09-21 22:33:13 -07:00
parent 4dfdd2839f
commit 502ef3c32b

View File

@@ -1,29 +1,43 @@
# Puter.js
<h3 align="center">Puter.js</h3>
The official JavaScript SDK for [Puter.com](https://puter.com) — Free, Serverless, Cloud and AI from the frontend code.
<p align="center">The official JavaScript SDK for <a href="https://puter.com">Puter.com</a></p>
<p align="center">Free, Serverless, Cloud and AI from the frontend code.</p>
---
<p align="center">
<a href="https://developer.puter.com" target="_blank">Learn More</a>
·
<a href="https://docs.puter.com" target="_blank">Docs</a>
·
<a href="https://developer.puter.com/tutorials">Tutorials</a>
·
<a href="https://github.com/Puter-Apps/">Examples</a>
·
<a href="https://twitter.com/HeyPuter">X</a>
</p>
## Installation (npm)
<br>
## Installation
### NPM:
```sh
npm install @heyputer/puter.js
```
### Importing
### CDN:
### Node.js (with Auth Token)
Include Puter.js directly in your HTML via CDN in the `<head>` section:
```js
const {init} = require("@heyputer/puter.js/src/init.cjs"); // NODE JS ONLY
// or
import {init} from "@heyputer/puter.js/src/init.cjs";
const puter = init(process.env.puterAuthToken); // uses your auth token
const puter2 = init(process.env.puterAuthToken2); // use some other auth token
```html
<script src="https://js.puter.com/v2/"></script>
```
<br>
### Browser (without Auth Token)
## Usage
### Browser
#### ES Modules
@@ -45,14 +59,19 @@ const puter = require('@heyputer/puter.js');
require('@heyputer/puter.js'); // puter will be available globally
```
#### CDN
### Node.js (with Auth Token)
Include Puter.js directly in your HTML via CDN in the `<head>` section:
```js
const {init} = require("@heyputer/puter.js/src/init.cjs"); // NODE JS ONLY
// or
import {init} from "@heyputer/puter.js/src/init.cjs";
```html
<script src="https://js.puter.com/v2/"></script>
const puter = init(process.env.puterAuthToken); // uses your auth token
const puter2 = init(process.env.puterAuthToken2); // use some other auth token
```
<br>
## Usage Example
After importing, you can use the global `puter` object:
@@ -67,7 +86,7 @@ puter.ai.chat('What color was Napoleon\'s white horse?').then(response => {
});
```
---
<br>
## Documentation & Community
@@ -77,4 +96,8 @@ puter.ai.chat('What color was Napoleon\'s white horse?').then(response => {
- [Puter.com](https://puter.com)
- [Discord](https://discord.com/invite/PQcx7Teh8u)
- [Reddit](https://reddit.com/r/puter)
- [X (Twitter)](https://twitter.com/HeyPuter)
- [X (Twitter)](https://twitter.com/HeyPuter)
## License
Apache-2.0