Build powerful web apps without writing a single line of backend code. Puter.js provides full, free access to various cloud and AI services directly from your frontend code. It brings Cloud Storage, Key-Value Store, GPT-3.5 Turbo, DALLĀ·E, Hosting, and more to your frontend code.
Puter.js works in a way that every user of your app will cover their own costs, so whether you have 1 user or 1 million users, your app won't cost you anything to run. In other words, Puter.js gives your app infinitely scalable Cloud and AI for free.
Puter.js is powered by Puter.com, the scalable personal cloud platform with a heavy focus on privacy. Puter does not use tracking technologies and does not monetize or even collect personal information.
<html>
<body>
<script src="https://js.puter.com/v2/"></script>
<script>
// Create a new file called "hello.txt" containing "Hello, world!"
puter.fs.write('hello.txt', 'Hello, world!').then((file) => {
puter.print(`File written successfully at: ${file.path}`);
}).catch((error) => {
puter.print('Error writing file:', error);
});
</script>
</body>
</html>
<html>
<body>
<script src="https://js.puter.com/v2/"></script>
<script>
// (1) Save user preference
puter.kv.set('userPreference', 'darkMode').then(() => {
// (2) Get user preference
puter.kv.get('userPreference').then(value => {
puter.print(`User preference: ${value}`);
});
})
</script>
</body>
</html>
<html>
<body>
<script src="https://js.puter.com/v2/"></script>
<script>
// Chat with GPT-3.5 Turbo
puter.ai.chat(`What color was Napoleon's white horse?`).then((response) => {
puter.print(response);
});
</script>
</body>
</html>
GPT-4 Vision
<html>
<body>
<script src="https://js.puter.com/v2/"></script>
<img src="https://assets.puter.site/doge.jpeg" style="display:block;">
<script>
puter.ai.chat(
`What do you see?`,
`https://assets.puter.site/doge.jpeg`)
.then((response) => {
puter.print(response);
});
</script>
</body>
</html>
<html>
<body>
<script src="https://js.puter.com/v2/"></script>
<script>
(async () => {
// (1) Create a random directory
let dirName = puter.randName();
await puter.fs.mkdir(dirName)
// (2) Create 'index.html' in the directory with the contents "Hello, world!"
await puter.fs.write(`${dirName}/index.html`, '<h1>Hello, world!</h1>');
// (3) Host the directory under a random subdomain
let subdomain = puter.randName();
const site = await puter.hosting.create(subdomain, dirName)
puter.print(`Website hosted at: <a href="https://${site.subdomain}.puter.site" target="_blank">https://${site.subdomain}.puter.site</a>`);
})();
</script>
</body>
</html>
No, you don't need a Puter.com account, API key, or any other registration or configuration to use Puter.js. All you need is to include the Puter.js SDK in your HTML page and you can start using Puter.js right away.
<script src="https://js.puter.com/v2/"></script>
No. Puter.js works in any HTML page and you can use it in your own website whether you host it on Puter.com or anywhere else.
Using Puter.js, users of your apps will pay for the cloud and AI services, so as the developer of the app your cost remains practically zero no matter how many users you have. Every user gets a free tier and if they need more resources, they will be able to pay for more resources; we plan to make money by charging a small fee on top of the cloud and AI services when users choose to pay for more resources.