Deploy Express & Node.js on WebStadia
WebStadia supports deploying Express, Fastify, NestJS, and other Node.js backends as serverless functions.
How it works
Your Express app runs on AWS Lambda behind WebStadia's global CDN. WebStadia automatically:
- Detects your framework from
package.json - Installs dependencies
- Bundles your app using
@vercel/nft(only includes files your app actually uses) - Wraps it with
@vendia/serverless-expressfor Lambda compatibility - Deploys to a Lambda function with a public URL
Your app is accessible via your-site.subsite.cc or a custom domain.
Quick start
1. Create an Express app
// index.js
const express = require('express');
const app = express();
app.get('/', (req, res) => {
res.json({ hello: 'world' });
});
app.get('/api/users', (req, res) => {
res.json([{ id: 1, name: 'Alice' }]);
});
// Important: export the app for serverless
module.exports = app;
// Also listen for local development
if (require.main === module) {
app.listen(3000, () => console.log('Listening on 3000'));
}
2. Deploy
Zip your project (including package.json and node_modules) and upload, or connect your GitHub repo.
WebStadia auto-detects Express from your package.json dependencies and handles the rest.
3. Build settings
| Setting | Value |
|---|---|
| Build Command | (none needed for Express) |
| Install Command | npm install |
If your project uses TypeScript or has a build step:
| Setting | Value |
|---|---|
| Build Command | npm run build |
| Entry point | dist/index.js |
Supported frameworks
WebStadia auto-detects and supports:
| Framework | Detection |
|---|---|
| Express | express in dependencies |
| Fastify | fastify in dependencies |
| NestJS | @nestjs/core in dependencies |
| Koa | koa in dependencies |
| Hapi | @hapi/hapi in dependencies |
Entry point resolution
WebStadia looks for your app's entry point in this order:
dist/index.js(TypeScript builds)build/index.jsindex.jsapp.jsserver.jssrc/index.js
Your entry point must export the Express app (or an HTTP handler):
// ✅ Works
module.exports = app;
// ✅ Also works
module.exports.default = app;
module.exports.app = app;
Environment variables
Set environment variables in Settings → Build Environment Variables. They're available at runtime via process.env:
const dbUrl = process.env.DATABASE_URL;
const apiKey = process.env.API_KEY;
WebStadia automatically sets:
NODE_ENV=productionWEBSTADIA_WEBSITE_ID=your-website-id
Lambda configuration
Default settings (configurable per website):
| Setting | Default |
|---|---|
| Runtime | Node.js 20.x |
| Memory | 256 MB |
| Timeout | 30 seconds |
| Region | us-east-1 |
Limitations
- No WebSocket support - Lambda functions are stateless. Use a separate WebSocket service if needed.
- Cold starts - First request after inactivity takes ~500ms-2s. Subsequent requests are fast.
- 30-second timeout - Long-running requests will be terminated. For background jobs, use a queue.
- No persistent filesystem - Lambda has a temporary
/tmpdirectory (512 MB) that's cleared between invocations. - Request body limit - 6 MB for synchronous invocations.
NestJS example
// main.ts
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
await app.listen(3000);
}
// Export for serverless
export default bootstrap;
Build settings for NestJS:
| Setting | Value |
|---|---|
| Build Command | npm run build |
| Install Command | npm install |