Filed under · Deployment · 2026-08-24 · 7 min read
Before deploying a website, check these 10 things
A project working on localhost doesn't mean it is ready for production. Before I deploy, I now check a few things that are easy to forget while building.
1. Environment variables
Make sure production variables actually exist in the hosting environment.
- API base URL
- Database connection string
- Authentication secrets
- Public application URL
Never assume the .env file on your machine will magically exist in production.
2. Production API URLs
Watch for code that points directly to localhost. It works locally and immediately fails after deployment.
typescriptfetch("http://localhost:3000/api/users");Use the environment system for the framework already used by the project. In Next.js, a variable needed in browser code must use the NEXT_PUBLIC_ prefix:
typescriptconst API_URL = process.env.NEXT_PUBLIC_API_URL;
if (!API_URL) {
throw new Error("NEXT_PUBLIC_API_URL is not configured");
}
fetch(`${API_URL}/api/users`);3. Test every important route
Open routes directly instead of only navigating to them from the homepage. This catches hosting configurations where refreshing a nested client-side route returns a 404.
text/projects
/notes
/notes/some-article
/login4. Check the mobile layout
Test more than one width. Look specifically for horizontal overflow, text clipping, buttons outside containers, navigation problems, fixed elements covering content, and code blocks that overflow.
5. Check metadata
Each important page should have a useful title and description. Also verify social preview metadata if the site uses it.
6. Test the 404 and error experience
Visitors should not see a blank screen when something fails.
7. Open the browser console
Fix unexpected JavaScript errors, failed network requests, missing assets, hydration warnings, and CORS failures.
8. Check HTTPS and mixed content
A secure HTTPS page should not depend on insecure HTTP resources.
9. Check image sizes
Look for huge hero images, screenshots, and background images that could be resized or compressed.
10. Test loading and failure states
Slow down the network or deliberately make an API request fail.
- Does the page show loading feedback?
- Can the user retry?
- Does the layout break?
- Is the error understandable?
Deployment is not just uploading the build. Test the website as if localhost no longer exists.