Serverless functions
Deploy server-side code without managing infrastructure. API endpoints that scale automatically, integrate with third-party services, and run globally with zero maintenance.
import express from 'express'
import { Request, Response } from 'express'
export default (req: Request, res: Response) => {
if (req.method !== 'POST') {
return res.status(405).send('Method not allowed')
}
try {
const { amount, currency, customerEmail } = req.body
// Process payment logic here
res.status(200).json({
success: true,
message: 'Payment processed successfully'
})
} catch (error) {
res.status(500).json({
success: false,
message: error.message
})
}
}
Scale automatically
Functions at scale
Deploy server-side logic without managing infrastructure. Handle custom business logic, integrate with third-party services, and build webhooks with JavaScript or TypeScript.
import nodemailer from 'nodemailer'
export default async (req, res) => {
let transporter = nodemailer.createTransport({
host: process.env.SMTP_HOST,
port: process.env.SMTP_PORT,
secure: true,
auth: {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASS,
}
})
let info = await transporter.sendMail({
from: '"Fred Foo 👻" <foo@example.com>',
to: 'bar@example.com, baz@example.com',
subject: 'Hello ✔',
text: 'Hello world?',
html: '<b>Hello world?</b>'
})
res.json('Message sent')
}
Automatic scaling
Functions scale automatically based on demand, no infrastructure management needed
TypeScript support
Write functions in TypeScript with full type safety and modern JavaScript features
Advanced features
Powerful backend logic, zero complexity
Create server-side functionality for your applications without the complexity of managing servers, libraries, or runtime environments.
Environment variables
Securely store and access configuration values and secrets. Full access to both system and custom environment variables for safe credential management.
TypeScript support
Write functions in TypeScript with full type checking and modern JavaScript features. Get increased productivity with better IDE support and fewer runtime errors.
Event triggers
React to database changes automatically by consuming event triggers. Perfect for notifications, data processing, and maintaining data consistency across systems.
Zero maintenance
No servers to manage, no scaling to configure, no OS updates to apply. Functions are automatically scaled, secured, and maintained for you, so you can focus on your code.
Comprehensive logging
Monitor function performance and troubleshoot issues with detailed execution logs. Get insights into function execution time, memory usage, and errors.
Your backend platform
Explore the Nhost ecosystem
Serverless Functions are just one part of your backend stack. Discover how all our services work together to power your applications.
Postgres database
Enterprise-grade SQL database, instantly ready.
GraphQL API
Instant, real-time API for your data.
Authentication
Secure user sign-up, sign-in, & management.
Storage
File uploads, downloads, & CDN.
Serverless Functions
Scalable JS/TS backend logic. No servers.
Bring your own containers
Deploy your services written in any language.
AI toolkit
Auto-Embeddings, Assistants, File Stores, and more.

Start building your next big thing
Get a complete backend up and running in minutes. Focus on building features your users will love, not wrestling with infrastructure. No credit card required for the free tier.
Join thousands of developers shipping faster with Nhost