Operate in Production
Deployment
Docker deployment, environment variables, and production hardening.
Docker
QUESTPIE apps can be containerized with Docker:
Dockerfile
FROM oven/bun:1 AS base
WORKDIR /app
FROM base AS build
COPY package.json bun.lockb ./
RUN bun install --frozen-lockfile
COPY . .
RUN bunx questpie generate
RUN bun run build
FROM base AS production
COPY --from=build /app/.output /app/.output
EXPOSE 3000
CMD ["bun", "run", ".output/server/index.mjs"]Environment Variables
| Variable | Required | Description |
|---|---|---|
DATABASE_URL | Yes | PostgreSQL connection string |
APP_URL | Yes | Public URL |
APP_SECRET / BETTER_AUTH_SECRET | Yes | Session secret |
SMTP_HOST | No | Email SMTP host |
SMTP_PORT | No | Email SMTP port |
REDIS_URL | No | Redis URL (for KV, realtime) |
S3_BUCKET | No | S3 bucket name |
S3_REGION | No | S3 region |
S3_ACCESS_KEY | No | S3 access key |
S3_SECRET_KEY | No | S3 secret key |
Production Checklist
- Set strong
APP_SECRET(min 32 characters) - Use production
DATABASE_URLwith SSL - Run
questpie migrate:upbefore deploying - Configure SMTP for transactional email
- Set
APP_URLto your public domain - Enable HTTPS
- Configure S3 or persistent storage for uploads
- Use
redisStreamsAdapterif running multiple instances - Set up health checks
Health Check
Add a health check endpoint:
routes/health.ts
import { route } from "questpie";
export default route({
method: "GET",
handler: async ({ db }) => {
await db.execute(sql`SELECT 1`);
return new Response(JSON.stringify({ status: "ok" }), {
headers: { "Content-Type": "application/json" },
});
},
});Related Pages
- Database — PostgreSQL setup
- Migrations — Schema management