Day 48 of #100DayOfCode — Deployment I: Deploy Backend
Earlier, on Day 40, I built the backend for my auth system. Then on Day 44, I improved it by adding TypeScript and Zod for type safety and validation. Today (Day 48), the goal was simple: 👉 Deploy...

Source: DEV Community
Earlier, on Day 40, I built the backend for my auth system. Then on Day 44, I improved it by adding TypeScript and Zod for type safety and validation. Today (Day 48), the goal was simple: 👉 Deploy the backend to production using Vercel Why Vercel? I chose Vercel for backend deployment because: Zero-config deployment (especially smooth with GitHub) Global edge network → fast response times Automatic CI/CD on every push Easy environment variable management Works well for serverless Node.js APIs Step-by-Step Backend Deployment Step 1: Add vercel.json Create a vercel.json file in the root directory: { "version": 2, "builds": [ { "src": "dist/server.js", "use": "@vercel/node" } ], "routes": [ { "src": "/(.*)", "dest": "dist/server.js" } ] } This tells Vercel: Where your built backend lives (dist/server.js) How to route all incoming requests Step 2: Export Your App Properly Make sure the main server is exported correctly. In server.ts, after app.listen(): app.listen(PORT, () => { console