Disclosure: some links on this page are affiliate links. If you buy through them, AdifySkills may earn a commission at no extra cost to you. We only recommend hosting we use ourselves.
Quick answer: To host an Express API on Hostinger, add a start script to package.json, make the server listen on process.env.PORT, move secrets to environment variables, push to GitHub, create a Node.js web app in hPanel, connect the repo, add variables, deploy and attach a subdomain like api.yourdomain.com with HTTPS. Add CORS, rate limiting, logging and database backups before going live.
Your API deserves a stable home
Express is still one of the simplest ways to build a backend in Node.js: a few routes, some middleware, a database connection, and you have an API for your website, mobile app or internal tools. The tricky part has always been hosting it reliably without becoming a full-time server administrator.
With Hostinger's managed Node.js hosting, you can deploy an Express API from GitHub with environment variables, automatic redeploys and HTTPS. This guide shows how to host an Express API on Hostinger and make it production-ready.
Step 1: structure your Express project
A simple, deployable structure:
package.jsonwith dependencies and scriptsserver.jsorsrc/index.jsas the entry pointroutes/for route handlers.env.examplelisting required variables (without values)
Scripts
"start": "node server.js"- Optional
"build"if you use TypeScript (for exampletsc), with"start": "node dist/server.js".
Port
The most important line in a deployable Express app:
const port = process.env.PORT || 3000; followed by app.listen(port).
Never hard-code the production port.
Host your API on Hostinger Cloud Startup
Recommended: Hostinger Cloud Startup. Daily or weekly backups, free SSL, 30-day money-back guarantee.
Get Hostinger Cloud Startup →Opens Hostinger’s official site. See today’s price before you decide.
Step 2: environment variables
Move everything sensitive or environment-specific into variables:
| Variable | Example use |
|---|---|
NODE_ENV | production |
DATABASE_URL | Database connection string |
JWT_SECRET | Signing tokens |
ALLOWED_ORIGIN | Frontend domain for CORS |
| Third-party keys | Payment, email, AI or map APIs |
Load them with a library such as dotenv locally, and set them in hPanel for production.
Step 3: deploy
- Push to GitHub (keep
.envout of the repo with.gitignore). - In hPanel, add a new Node.js web app (labels may vary).
- Connect the repository and branch.
- Confirm install, build (if any) and start commands.
- Add environment variables.
- Deploy and check the logs.
- Visit a health route, such as
/health, to confirm the API responds.
Step 4: connect a subdomain
Use a subdomain like api.yourdomain.com. Attach it to the app and confirm SSL is active. Update your frontend to call the new HTTPS URL.
âš Open APIs get abused quickly
Bots scan the internet for open APIs. Without rate limiting, authentication and input validation, your API can be spammed, scraped or used to run up costs on paid third-party services you call. Add basic protections before you share the URL anywhere.
Step 5: make it production-ready
Security basics
- Helmet or similar middleware for secure HTTP headers.
- CORS limited to your real frontend domains.
- Rate limiting on public endpoints, especially login and forms.
- Input validation with a schema library.
- Authentication with tokens or sessions where needed.
- No stack traces in production error responses.
Reliability basics
- A
/healthroute for uptime monitors. - Structured logging so you can find errors in the logs.
- Graceful error handling middleware.
- Timeouts on calls to external services.
Data basics
- Use a database created in hPanel (MySQL or MariaDB) or a managed external database.
- Use connection pooling.
- Back up the database regularly and test restores.
Not sure which plan fits your business? Send us a WhatsApp message and we will suggest the right plan for free.
Connecting a frontend
A common setup: a React or Next.js frontend at app.yourdomain.com and the Express API at api.yourdomain.com, both on the same Hostinger plan. Set ALLOWED_ORIGIN to the frontend domain and configure the frontend's API base URL with an environment variable.
Performance tips
- Cache expensive responses in memory or a cache layer.
- Paginate large lists instead of returning everything.
- Compress responses with compression middleware.
- Index database columns used in filters and joins.
- Keep middleware lean.
Scaling: when to move up
| Signal | Next step |
|---|---|
| Steady traffic, a few apps | Cloud Startup |
| Heavy background jobs or many persistent connections | VPS |
| Need for Docker or system-level packages | VPS |
| Very high traffic across regions | Dedicated cloud infrastructure |
| Plan | India price* | US price* | Websites | Storage | Backups | Best for | |
|---|---|---|---|---|---|---|---|
| Single | ₹69/mo renews ₹289/mo | India only | 1 | 10 GB SSD | Weekly | One small site or portfolio | Get Single |
| Premium | ₹139/mo renews ₹449/mo | $2.49/mo renews $10.99/mo | 3 | 20 GB SSD | Weekly | Personal sites and side projects | Get Premium |
| Unlimited | ₹199/mo renews ₹649/mo | $3.49/mo renews $16.99/mo | Unlimited | 50 GB NVMe | Daily | Most business websites | Get Unlimited |
| Cloud Startup | ₹599/mo renews ₹1,599/mo | $7.99/mo renews $25.99/mo | Unlimited | 100 GB NVMe | Daily + on-demand | Busy stores, web apps, agencies | Get Cloud Startup |
*Promotional prices on a 48-month term, checked on Hostinger's official site in November 2026 during a sale. Prices change often and renewal prices are higher. Indian prices exclude 18% GST. Always confirm the live price before you pay.
Common errors and fixes
| Error | Likely cause | Fix |
|---|---|---|
| App crashes on start | Hard-coded port or missing variable | Use process.env.PORT, set variables |
| CORS error in browser | Origin not allowed | Add the frontend domain to CORS config |
| Database connection refused | Wrong host or credentials | Check DATABASE_URL and database access settings |
| 502 or timeout | App not listening, or slow upstream | Check logs, add timeouts |
| Works locally, fails on deploy | devDependencies used at runtime | Move packages to dependencies |
Real-world uses for small businesses
- A lead capture API that saves form submissions to a database and sends WhatsApp or email alerts.
- A booking API for a clinic or salon.
- An inventory or price lookup for a shop.
- A webhook receiver for payment gateways or CRMs.
- A backend for a simple mobile app.
All of these fit comfortably on managed Node.js hosting.
A minimal production-ready Express checklist
Before you announce your API, run through this list:
- ✅ Listens on
process.env.PORT - ✅
NODE_ENV=productionset - ✅ All secrets in environment variables
- ✅ Helmet (or equivalent) enabled
- ✅ CORS limited to known domains
- ✅ Rate limiting on public routes
- ✅ Input validation on every write endpoint
- ✅ Central error handler that hides stack traces
- ✅
/healthroute and an uptime monitor - ✅ Database backups scheduled and tested
- ✅ HTTPS subdomain connected
- ✅ Logs checked after the first real traffic
Versioning your API
As soon as other apps depend on your API, changes can break them. A simple approach is to prefix routes with a version, such as /v1/leads. When you need breaking changes, add /v2/ routes and keep /v1/ working until every client has moved. Document the endpoints, even in a short README, so future you and your clients know what each one does.
Our view
AdifySkills runs its website on Hostinger and teaches automation and web development, including APIs and webhooks. For small businesses and freelancers, an Express API on managed hosting is the simplest way to add custom backend features without the overhead of managing servers.
Deploy your Express API today
Recommended: Hostinger Cloud Startup. Daily or weekly backups, free SSL, 30-day money-back guarantee.
Get Hostinger Cloud Startup →Opens Hostinger’s official site. See today’s price before you decide.
Conclusion
Hosting an Express API on Hostinger is mostly about preparation: a start script, process.env.PORT, environment variables and a clean repo. Deploy through hPanel, attach an HTTPS subdomain, then add security, logging and backups. For most small and medium APIs, Cloud Startup gives the resources and predictable pricing you need, with a VPS available when you outgrow it.
Frequently Asked Questions
Can I host an Express.js app on Hostinger?
Yes. Hostinger's managed Node.js hosting can deploy Express apps from GitHub or a ZIP upload.
What port should my Express app use on Hostinger?
Use the port provided by the environment through process.env.PORT, with a fallback for local development.
Can I use MySQL with my Express API on Hostinger?
Yes. Create a MySQL database in hPanel and connect to it using credentials stored in environment variables.
How do I keep my API secure?
Use HTTPS, restrict CORS, add rate limiting, validate inputs, require authentication where needed and hide error details in production.
Can I run a frontend and API on the same plan?
Yes. Many developers host a React or Next.js frontend and an Express API on the same Hostinger plan.
When should I move my API to a VPS?
When you need Docker, system-level packages, heavy background workers or many long-lived connections.
Ready to get your website on fast, reliable hosting?
- Free SSL and free domain for the first year on most plans
- Automatic backups
- 24/7 support
- 30-day money-back guarantee