Host a Node.js or Python App in Kenya

How To Host A Nodejs App In Kenya

Host a Node.js or Python App in Kenya

How to Host a Node.js or Python App in Kenya

The Deployment Guide for Local Developers and Businesses

A developer in Westlands finishes an Express API on a Friday afternoon. It works perfectly on localhost. By Monday it is still not live, because nobody on the team knows where it should run, who will pay for it in shillings, or how to make M-Pesa reach it. Sound familiar?

This guide closes that gap. It walks through hosting a Node.js or Python app in Kenya from an empty cPanel account to a live HTTPS endpoint, and it explains the decisions that matter along the way: where the server sits, what resources your app really consumes, how to keep payment callbacks reliable, and how to avoid the mistakes that cost Kenyan teams weeks.

Payment callbacks. If you integrate Safaricom’s Daraja API for M-Pesa, the STK Push result is delivered to a callback URL you control. That URL must be public, served over HTTPS and available at the moment the customer enters their PIN. A flaky or distant host turns into missed confirmations and support tickets from customers who say they paid.

Data protection. Kenya’s Data Protection Act, 2019 places obligations on anyone who processes personal data, and the Office of the Data Protection Commissioner expects registration from many data controllers and processors. Keeping data with a provider you can reach, contract with and hold accountable locally simplifies your compliance story. Speak to a legal adviser for your specific case; hosting choice is one input, not the whole answer.

Billing and support in your own context. Paying a hosting invoice in your own currency, and reaching a support team in your own time zone, matters more than it sounds when production breaks at 8 a.m. on payday.

What a Node.js or Python app actually needs from a host

Before comparing plans, list what your application consumes. Most small and mid-sized web apps need the following:

  • A runtime: a current, supported version of Node.js or Python, with the ability to choose between versions per application.
  • Memory headroom: dependency installation (npm install, pip install) is often the most memory-hungry moment of an app’s life, far more than serving requests.
  • CPU that is not starved: at least two vCPUs lets installs, background jobs and live requests coexist without freezing each other.
  • A process manager: something must start your app, restart it after a crash and route web traffic to it.
  • HTTPS: free, auto-renewing certificates for every domain.
  • A database: MySQL or MariaDB are the usual companions on cPanel; PostgreSQL support varies by provider, so ask.
  • Scheduled tasks: cron for reports, cleanups and queue workers.
  • File access: SSH or a terminal, so you can run build commands instead of uploading files one at a time.

Why cPanel on LiteSpeed is a sensible home for web apps

There is a stereotype that cPanel is only for WordPress. It is out of date. Modern cPanel includes application managers for both Node.js and Python, and when the web server underneath is LiteSpeed Enterprise, requests are handled by an event-driven engine built for high concurrency and low memory use per connection.

What that gives you in practice:

  • Point-and-click application setup, so a junior developer or a business owner can deploy without writing server configuration.
  • Per-app runtime selection, so your legacy project on one Node version and your new service on another can live side by side.
  • Built-in static file handling and caching at the web server layer, so your Node or Python process spends its time on dynamic work.
  • Familiar tooling for email, DNS, backups, file management and databases in a single dashboard.

Galactik Hosting runs cPanel hosting on enterprise LiteSpeed servers, with a minimum of 2 GB of RAM and 2 vCPU behind the plans. That floor matters, many budget hosts squeeze accounts into a few hundred megabytes, and a single dependency install can get killed halfway through. Starting from 2 GB and 2 vCPU gives a typical API, a small SaaS backend or a company portal room to breathe.

Before you deploy: prepare the app

Spend ten minutes on these steps now and you will save an hour later.

  1. Pin your versions. In package.json, set the engines field. In Python, freeze dependencies with pip freeze and save them to requirements.txt.
  2. Read configuration from environment variables. Database passwords, API keys and the Daraja consumer secret should never be in your repository.
  3. Do not hard-code a port. Under a managed setup the web server decides how traffic reaches your app. Read the port from the environment when one is provided.
  4. Add a health route. A simple /health endpoint that returns a short success message makes it easy to confirm the app is alive.
  5. Keep builds off the server when you can. Compile TypeScript or bundle a frontend on your machine or in CI, and deploy the output, unless your workflow needs to build on the server.

How to host a Node.js app on cPanel hosting

This works for Express, Fastify, Koa, NestJS and most frameworks that expose an HTTP server.

Step 1: Upload your code. Use Git over SSH, the File Manager or SFTP to place your project in a folder outside public_html, for example /home/youruser/apps/orders-api. Keeping it outside the public web root prevents source files being served by accident.

Step 2: Open the Node.js application manager. In cPanel, find Setup Node.js App and choose Create Application.

Step 3: Fill in the form.

  • Node.js version: pick the latest long-term support release your dependencies support.
  • Application mode: Production for live traffic, Development while you debug.
  • Application root: the folder from Step 1, for example apps/orders-api.
  • Application URL: the domain or subdomain, such as api.yourbusiness.co.ke.
  • Application startup file: usually app.js, server.js or index.js.

Step 4: Install dependencies. Inside the same screen, use Run NPM Install, or connect over SSH, enter the virtual environment command shown at the top of the page and run npm install yourself. The second route gives you better error output.

Step 5: Add environment variables. Use the Environment variables section of the same screen for NODE_ENV, database credentials and third-party keys.

Step 6: Start and test. Click Run, then Restart. Visit your health route in a browser. If you see your response, you are live.

A minimal Express file for reference:

const express = require('express');
const app = express();
app.get('/health', (req, res) => res.json({ status: 'ok' }));
app.listen(process.env.PORT || 3000);

After changing code or dependencies, restart the application from the same screen so the new version loads.

How to host a Python app (Flask or Django) on cPanel hosting

Python applications on cPanel run through the WSGI standard, which both Flask and Django support natively.

Step 1: Upload your project to a folder outside public_html, such as /home/youruser/apps/invoice-service.

Step 2: Open Setup Python App and click Create Application.

Step 3: Configure it.

  • Python version: choose the version your project targets.
  • Application root: the folder from Step 1.
  • Application URL: your domain or subdomain.
  • Application startup file: passenger_wsgi.py
  • Application entry point: application

Step 4: Create passenger_wsgi.py. For Flask, it can be as short as this:

from app import app as application

For Django, import the WSGI callable from your project’s wsgi module and name it application.

Step 5: Install requirements. Add requirements.txt under Configuration files and click Run Pip Install, or activate the virtual environment over SSH and run pip install -r requirements.txt.

Step 6: Django extras. Set ALLOWED_HOSTS to your domain, run collectstatic, run migrations, and make sure DEBUG is False in production.

A note on FastAPI. FastAPI is built for ASGI, while the standard cPanel Python route is WSGI. Teams commonly bridge the gap with an adapter such as a2wsgi, which works for many straightforward APIs. If you depend heavily on WebSockets or long-lived streaming connections, confirm with your host first, or choose a plan that gives you more control over processes.

Domain, DNS and HTTPS

If you are launching a Kenyan business site, a .co.ke or .ke domain signals local presence and is a good fit for local search. These are registered through accredited registrars under KENIC. Point the nameservers to your host, or add an A record pointing to your server’s IP address.

Once DNS resolves, issue a free certificate from the cPanel SSL/TLS Status screen and run AutoSSL so it renews on its own. Then force HTTPS. Daraja callbacks and most payment providers will refuse plain HTTP anyway.

Connecting M-Pesa and other Kenyan payment APIs

A few habits make payment integrations dependable:

  • Use a dedicated callback route and keep its logic tiny: validate, store the raw payload, respond fast, process later.
  • Log every incoming callback with a timestamp. When a customer claims they paid, this log settles the matter.
  • Make processing idempotent. Callbacks can arrive twice. Use the transaction ID as a unique key.
  • Never expose consumer secrets in front-end code. Keep them in environment variables on the server.
  • Test in the sandbox, then repeat the whole flow once in production with a small real amount.

Squeezing the most from 2 GB of RAM and 2 vCPU

Good plans still reward good habits.

  • Cache aggressively. Cache database results that rarely change, and let the LiteSpeed layer serve static assets and compressed files.
  • Avoid loading entire tables into memory. Paginate, stream and index.
  • Keep dependencies lean. Every package you remove shortens installs and shrinks your memory footprint.
  • Move heavy work to cron. Report generation and email batches should not run inside a web request.
  • Watch your logs weekly. Memory leaks show up as slow creep before they show up as crashes.

Security basics that most guides skip

  • Keep the application root outside public_html.
  • Block access to .env files, .git folders and backup archives.
  • Run npm audit or pip-audit before every release.
  • Use strong, unique database passwords per application.
  • Enable two-factor authentication on your hosting account.
  • Schedule off-site backups of your database and uploads, and test a restore at least once.

Troubleshooting: the errors Kenyan developers hit most

The app shows a generic error page. Check the application’s error log in cPanel. The first line usually names the missing module or bad path.

Install fails or the process is killed. This is typically a memory limit. Install over SSH, remove unused packages or build locally and upload the result.

Changes do not appear. Restart the application. Node and Python processes are loaded once and keep running the old code until restarted.

Wrong startup file. The startup file name in the form must match the real file exactly, including case.

Static files return 404 in Django. Run collectstatic and confirm your static URL and root settings.

Callback never arrives. Confirm the URL is HTTPS, publicly reachable and not behind a login or firewall rule.

When cPanel hosting is not the right fit

Honesty builds trust, so here it is. A managed cPanel plan is excellent for web apps, APIs, business portals, e-commerce back ends and internal tools. It is not designed for GPU workloads, custom system-level services, or architectures that need root access and several cooperating containers. If your project is heading there, start on cPanel for the early stage, keep your code portable, and move when the need is real. Many products never need to.

Questions to ask any hosting provider before you commit

  1. How much RAM and how many CPU cores will my account actually receive?
  2. Which Node.js and Python versions are available, and can I run several?
  3. Is the web server LiteSpeed Enterprise, and is SSH included?
  4. How are backups handled, and how quickly can they be restored?
  5. Who answers support requests, and when?
  6. Can I see a clear migration path if I outgrow the plan?

Why developers and businesses choose Galactik Hosting

Galactik Hosting is built around one belief: Kenyan builders should not have to choose between convenience and capability.

  • Enterprise LiteSpeed servers for fast, efficient request handling.
  • A minimum of 2 GB RAM and 2 vCPU so installs, builds and live traffic do not fight each other.
  • cPanel, so the dashboard your team already knows manages your Node.js apps, Python apps, databases, email, DNS and SSL in one place.
  • A provider focused on the Kenyan market, which means conversations about M-Pesa, local domains and local compliance are not foreign to the people helping you.

If you have an app that works on your laptop and a launch date that will not move, that is exactly the situation we built for.

Ready to go live? Visit galactikhosting.com, choose a cPanel plan and deploy your first Node.js or Python application today.

Frequently asked questions

Can I host a Node.js app on cPanel in Kenya? Yes. cPanel includes a Node.js application manager that lets you choose a version, set the startup file and install dependencies without writing web server configuration.

Can I host a Flask or Django app on cPanel? Yes. Use the Python application manager, point it to a passenger_wsgi.py file and expose your WSGI callable as application.

Do I need a .co.ke domain? No, but a local domain helps local recognition and trust. Your app works equally well on a .com or any other domain.

Is 2 GB of RAM enough for a production app? For typical APIs, business portals and small SaaS products, yes. Efficient caching and lean dependencies stretch that further.

Can I run an M-Pesa integration on this setup? Yes, provided your callback URL is public and served over HTTPS. Follow the idempotency and logging practices above.

What is the difference between shared cPanel hosting and a VPS for apps? A VPS gives you root access and full control but also full responsibility for security, updates and monitoring. Managed cPanel hosting handles the server layer so you can focus on code.

New to Web Hosting? Let's Get You Launched

Launching your first site or switching providers? We can help with hosting, domains, email and migrations.

Submit A Ticket

Get Expert Help With Your Hosting

Live Chat

Chat With Support

WhatsApp

We’re Online 7 AM to 9 PM, Daily

 © 2026 GalactiK Hosting 

Galactik Hosting
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.