deployment
Scannednpx machina-cli add skill DojoCodingLabs/code-sensei/deployment --openclawFiles (1)
SKILL.md
2.6 KB
Deployment — CodeSensei Teaching Module
What is Deployment?
- Analogy: Deployment is moving from rehearsal to opening night. Your app works on your computer (localhost), and deployment puts it on a server so the whole world can use it.
- Key insight: When you run
npm starton your computer, only YOU can see the app. Deployment puts it on someone else's computer (a server) that's always on and connected to the internet.
Localhost vs Production
- localhost — your computer, only you can access it. The rehearsal stage.
- Production — a server in the cloud, anyone with the URL can access it. Opening night.
- Staging — a test server that mimics production. The dress rehearsal.
Common Deployment Platforms
- Vercel — one-click deployment for Next.js/React apps. Push to GitHub, it deploys automatically.
- Netlify — similar to Vercel, great for static sites and simple apps.
- Railway / Render — for backend apps with databases.
- AWS / GCP / Azure — the industrial-grade options. More complex but more powerful.
- Key insight: For most vibecoded projects, Vercel or Railway is all you need.
Domains & DNS
- Analogy: A domain name (like myapp.com) is a nickname for your server's actual address (an IP like 192.168.1.1). DNS is the phone book that translates names to addresses.
- Teaching flow: User types myapp.com → DNS looks up the address → Browser connects to the server → Server sends the app
Environment Variables in Production
- Key insight: Your .env file doesn't get uploaded. You set environment variables SEPARATELY in your hosting platform's dashboard.
- Why: Security. Your code is often public (on GitHub), but your secrets shouldn't be.
CI/CD (Continuous Integration / Continuous Deployment)
- Analogy: An automatic assembly line. Every time you push code to GitHub, the system automatically tests it, builds it, and deploys it — without you clicking anything.
- Key insight: This is why developers "push to main" to deploy. The pipeline handles the rest.
Docker (if encountered)
- Analogy: A shipping container for your app. It packages your code AND everything it needs to run (right version of Node, right libraries, right settings) into one portable box. That box runs the same everywhere.
- Dockerfile — the recipe for building the container
- Key insight: Docker solves "it works on my machine" — by shipping the machine too.
Source
git clone https://github.com/DojoCodingLabs/code-sensei/blob/main/skills/deployment/SKILL.mdView on GitHub Overview
Deployment moves your app from a local machine to a production server so real users can access it. It covers hosting platforms (Vercel, Netlify, Railway/Render, cloud providers), DNS, environment variables, and CI/CD workflows that automate tests and releases.
How This Skill Works
Develop locally, push changes to a Git repository, and let a hosting platform build and publish the app. CI/CD pipelines test, build, and deploy on every push; production is served from a stable URL with DNS routing.
When to Use It
- You want to publish a Next.js or React app on Vercel after local development.
- You need automated testing and deployment when code is pushed to the main branch via CI/CD.
- You must host a backend or full-stack app on a platform like Railway, Render, or a cloud provider.
- You want a custom domain (myapp.com) and DNS setup to point to your deployment.
- You want to manage sensitive configuration (API keys, secrets) securely in the hosting dashboard.
Quick Start
- Step 1: Create or choose a hosting platform (Vercel/Netlify/Railway).
- Step 2: Connect your GitHub repo and push to main to trigger CI/CD.
- Step 3: In the platform dashboard, add environment variables and deploy, then verify production URL.
Best Practices
- Limit environment variables in code; configure secrets in the hosting platform.
- Use a staging environment to mirror production before going live.
- Prefer Vercel/Netlify for frontend and Railway/Render or cloud providers for backends, as needed.
- Pin exact Node/Docker versions in your Dockerfile or platform settings to ensure consistency.
- Add a simple rollback plan (re-deploy previous successful build) in CI/CD.
Example Use Cases
- Deploy a Next.js app to Vercel by connecting GitHub and pushing to main.
- Publish a static site to Netlify with a single build command.
- Host a Node/Express backend with a database on Railway or Render.
- Configure a custom domain like myapp.com with DNS A/ CNAME records.
- Set up CI/CD so pushing to main auto-tests, builds, and deploys.
Frequently Asked Questions
Add this skill to your agents