Deployment
Using Bun
Section titled “Using Bun”bun run src/index.tsNode.js & Deno
Section titled “Node.js & Deno”Shokupan is built for Bun, but can run on Node.js and Deno using the server adapter.
Node.js
Section titled “Node.js”Use the createHttpServer factory:
import { Shokupan, createHttpServer } from 'shokupan';
const app = new Shokupan({ serverFactory: createHttpServer()});
app.listen(3000);Then run with node:
node dist/index.jsDeno 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:
deno run -A dist/index.jsFROM 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:
docker build -t my-app .docker run -p 3000:3000 my-appEnvironment Variables
Section titled “Environment Variables”Create a .env file:
PORT=3000NODE_ENV=productionDATABASE_URL=postgresql://...JWT_SECRET=your-secretLoad in your app:
const app = new Shokupan({ port: parseInt(process.env.PORT || '3000'), development: process.env.NODE_ENV !== 'production'});Production Checklist
Section titled “Production Checklist”- Use environment variables for secrets
- Enable HTTPS
- Set security headers
- Configure CORS properly
- Add rate limiting
- Use production database
- Set up logging
- Configure monitoring