Documentation
/
Deployment
Deployment
v0.00
TypeScript
Wappi applications can be deployed to various platforms, both as serverless functions and traditional servers.
1# Install Vercel CLI
2npm i -g vercel
3
4# Deploy
5vercelCreate vercel.json:
1{
2 "version": 2,
3 "builds": [
4 {
5 "src": "src/index.ts",
6 "use": "@vercel/node"
7 }
8 ],
9 "routes": [
10 {
11 "src": "/(.*)",
12 "dest": "src/index.ts"
13 }
14 ]
15}1# Build for production
2npm run build
3
4# Deploy with Serverless Framework
5serverless deployCreate Dockerfile:
1FROM node:18-alpine
2
3WORKDIR /app
4
5COPY package*.json ./
6RUN npm ci --only=production
7
8COPY . .
9RUN npm run build
10
11EXPOSE 3000
12
13CMD ["npm", "start"]1# Install PM2
2npm install -g pm2
3
4# Start application
5pm2 start ecosystem.config.js
6
7# Monitor
8pm2 monitCreate ecosystem.config.js:
1module.exports = {
2 apps: [{
3 name: 'wappi-api',
4 script: 'dist/index.js',
5 instances: 'max',
6 exec_mode: 'cluster',
7 env: {
8 NODE_ENV: 'production',
9 PORT: 3000
10 }
11 }]
12}1NODE_ENV=production
2DATABASE_URL=your-production-database-url
3JWT_SECRET=your-production-secret
4PORT=3000Wappi includes built-in health check endpoints:
GET /health - Basic health checkGET /health/detailed - Detailed system status