Skip to content

Deployment

Terminal window
bun run src/index.ts

Shokupan is built for Bun, but can run on Node.js and Deno using the server adapter.

Use the createHttpServer factory:

import { Shokupan, createHttpServer } from 'shokupan';
const app = new Shokupan({
serverFactory: createHttpServer()
});
app.listen(3000);

Then run with node:

Terminal window
node dist/index.js

Deno support is experimental but uses the same adapter pattern if needed, or runs natively if Deno implements Bun.serve compatibility layer in the future. Currently, use the Node compatibility layer in Deno:

Terminal window
deno run -A dist/index.js
FROM oven/bun:1
WORKDIR /app
COPY package.json bun.lock ./
RUN bun install --production
COPY . .
EXPOSE 3000
CMD ["bun", "run", "src/index.ts"]

Build and run:

Terminal window
docker build -t my-app .
docker run -p 3000:3000 my-app

Create a .env file:

Terminal window
PORT=3000
NODE_ENV=production
DATABASE_URL=postgresql://...
JWT_SECRET=your-secret

Load in your app:

const app = new Shokupan({
port: parseInt(process.env.PORT || '3000'),
development: process.env.NODE_ENV !== 'production'
});
  • Use environment variables for secrets
  • Enable HTTPS
  • Set security headers
  • Configure CORS properly
  • Add rate limiting
  • Use production database
  • Set up logging
  • Configure monitoring