What is Backend Development?
Understand what backend developers do - servers, databases, APIs, and how the web really works.
The Big Picture#
When you use an app, you see buttons, forms, and pretty interfaces. That's the frontend - what users interact with.
But where does the data come from? Where are your login credentials stored? Who checks if your password is correct? That's the backend - the brain behind the scenes.
Frontend vs Backend#
┌─────────────────────────────────────────────────────────────────┐
│ User's Browser │
│ ┌───────────────────────────────────────────────────────────┐ │
│ │ FRONTEND │ │
│ │ • What you see (HTML, CSS) │ │
│ │ • Interactions (JavaScript) │ │
│ │ • Runs in the browser │ │
│ └───────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
│
│ HTTP Requests
│ (Get data, send forms)
▼
┌─────────────────────────────────────────────────────────────────┐
│ Server │
│ ┌───────────────────────────────────────────────────────────┐ │
│ │ BACKEND │ │
│ │ • Business logic (rules, calculations) │ │
│ │ • Data storage (databases) │ │
│ │ • Security (authentication, authorization) │ │
│ │ • Runs on a server │ │
│ └───────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
What Backend Developers Do#
1. Build APIs (Application Programming Interface)#
APIs are how frontend and backend talk. When you click "Login", the frontend sends your credentials to a backend API:
// Frontend sends request
fetch('/api/login', {
method: 'POST',
body: JSON.stringify({ email: 'user@example.com', password: '123456' })
})
// Backend receives and responds
app.post('/api/login', (req, res) => {
const { email, password } = req.body;
// Check credentials
// Return success or error
res.json({ success: true, token: 'abc123' });
});
2. Store and Retrieve Data#
Users create accounts, post photos, write messages. All this data lives in databases:
// Save a new user
const user = await User.create({
email: 'user@example.com',
name: 'John Doe'
});
// Find all posts by a user
const posts = await Post.find({ userId: user.id });
3. Handle Business Logic#
Rules that make the app work:
- Can this user view this content? (permissions)
- Is this coupon code valid? (validation)
- Calculate shipping cost based on weight and destination
- Send an email when order ships
// Business logic example
function calculateOrderTotal(items, couponCode) {
let total = items.reduce((sum, item) => sum + item.price, 0);
if (couponCode === 'SAVE20') {
total = total * 0.8; // 20% off
}
if (total > 100) {
total = total - 10; // Free shipping over $100
}
return total;
}
4. Secure the Application#
- Hash passwords (never store plain text)
- Verify users are who they claim to be
- Protect against attacks (SQL injection, XSS)
- Rate limiting (prevent spam/abuse)
// Hash password before saving
const hashedPassword = await bcrypt.hash(password, 10);
// Verify password on login
const isValid = await bcrypt.compare(inputPassword, hashedPassword);
5. Integrate with External Services#
- Payment processors (Stripe, PayPal)
- Email services (SendGrid, AWS SES)
- Cloud storage (S3, Cloudinary)
- Third-party APIs (Google Maps, Twilio)
// Send email through external service
await sendgrid.send({
to: user.email,
subject: 'Order Confirmation',
text: `Your order #${order.id} has been confirmed!`
});
How Web Requests Work#
When you type a URL or click a button:
1. Browser makes HTTP request
GET https://api.example.com/users
2. Server receives request
• Parses URL, method, headers, body
• Authenticates user (if needed)
3. Server processes request
• Runs business logic
• Queries database
• Calls external services
4. Server sends response
{
"data": [
{ "id": 1, "name": "Alice" },
{ "id": 2, "name": "Bob" }
]
}
5. Browser receives response
• Frontend displays data to user
Backend vs Full-Stack#
| Role | Focus |
|---|---|
| Frontend Developer | User interface, browser, React/Vue/Angular |
| Backend Developer | Servers, databases, APIs, security |
| Full-Stack Developer | Both frontend and backend |
Starting Out?
Many developers start with frontend (it's visual, you see results immediately), then move to backend or full-stack. Others start with backend if they prefer logic over design.
Common Backend Tasks#
Here's what a typical backend developer might do in a day:
- Add a new API endpoint - Create
/api/products/searchto search products - Fix a bug - Users can't update their profile picture
- Improve performance - Add caching to slow database queries
- Security update - Patch a vulnerability in a dependency
- Write tests - Ensure the checkout flow works correctly
- Deploy - Push new features to production
What You'll Learn in This Guide#
This guide takes you from zero to building production-ready backends:
- Fundamentals - How Node.js and JavaScript work on servers
- APIs - Build RESTful endpoints with Express.js
- Databases - Store data with MongoDB and Redis
- Authentication - Secure user login and sessions
- Testing - Write tests to catch bugs
- Deployment - Get your app running in production
Key Takeaways#
- Backend = server-side - Code that runs on servers, not browsers
- APIs connect everything - Frontend talks to backend through APIs
- Databases store data - Users, posts, orders, everything
- Security is critical - Protect user data and prevent attacks
- Logic lives here - Business rules, calculations, integrations
Ready to start? Let's look at choosing the right language and framework for your backend.
Ready to level up your skills?
Explore more guides and tutorials to deepen your understanding and become a better developer.