Basic DevOps for Developers: What You Need to Know
You don’t need to be a DevOps expert to ship and run your app. This post covers the essentials: version control, environment and config, build and run, deployment, and a bit of monitoring—so you can get from “it works on my machine” to “it works in production.”
Version control (Git)
Use a branch per feature, commit often, and push to a remote. That gives you a clear history, easy rollbacks, and a base for code review and CI/CD later.
# Feature branch
git checkout -b feature/add-login
# Work, then commit
git add .
git commit -m "Add login form and API route"
# Push and (on GitHub/GitLab) open a Pull Request
git push -u origin feature/add-loginEnvironment and config
Never commit secrets. Use environment variables (or a secret manager in production) and load them via a .env file in development. Keep dev, staging, and production config separate.
// config.js – use env vars, never hardcode
require('dotenv').config();
module.exports = {
port: process.env.PORT || 5000,
mongoUri: process.env.MONGODB_URI,
jwtSecret: process.env.JWT_SECRET, // must be set in production
};# .env
PORT=5000
MONGODB_URI=mongodb://localhost:27017/mernroute
JWT_SECRET=your-super-secret-keyKeep secrets out of Git
Add .env and other sensitive or generated files to.gitignore so they never get committed.
# .gitignore
node_modules/
.env
.env.local
*.log
.DS_Store
build/
dist/Build and run
Your app should read the port (and other config) from the environment. In production you might use a process manager (e.g. PM2) or a platform (Render, Railway) that sets PORT and runs your start command.
// server.js – listen on PORT from env
const app = require('./app');
const { port } = require('./config');
app.listen(port, () => {
console.log(`Server running on port ${port}`);
});PORT=5000 node server.jsHealth check
A simple /health route lets platforms and load balancers check if your app is up. Return 200 and a small JSON payload.
app.get('/health', (req, res) => {
res.status(200).json({
status: 'ok',
timestamp: new Date().toISOString(),
});
});Deployment
Connect your repo to a host (e.g. Vercel for frontend, Render or Railway for Node), set environment variables in the dashboard, and deploy on push. You don’t need Docker or Kubernetes to get started—those come later when you need more control.
Monitoring and debugging
Use your platform’s logs to see stdout and errors. For 500s, check stack traces and fix the cause. Optionally add a simple uptime check so you know when the app goes down.
Takeaway
Git for history and branches, env vars for config and secrets, .gitignore to keep secrets out of the repo, a single entry point that reads PORT, and a /health route for “is it up?” That’s enough to ship and run your app—and to debug it when something goes wrong.