Smile Corp المستندات
العربية
Smile Hosting
لم تُترجم هذه الصفحة إلى العربية بعد، لذلك تظهر بالإنجليزية.

Run a Node.js or Python web app

Host an Express, Flask or FastAPI app - the two rules it must follow, and how to deploy it.

آخر تحديث 13 سبتمبر 2026قراءة 1 دقيقة

Choose the Node.js or Python framework when your website needs code running on the server - a login, a database, an API. If it’s only HTML, CSS and JavaScript, a static site is simpler.

The two rules

Your app will only be reachable if it:

  1. Listens on the port it’s given, which is in the PORT environment variable - not a number you pick yourself.
  2. Listens on 0.0.0.0, not localhost or 127.0.0.1.

Get either wrong and the app starts happily, but the address won’t load.

Node.js (Express)

const express = require('express');
const app = express();

app.get('/', (req, res) => res.send('Hello from Smile Hosting!'));

const port = process.env.PORT || 3000;
app.listen(port, '0.0.0.0', () => console.log(`Listening on ${port}`));

The Start Command is npm start, so add a start script to your package.json:

{
  "scripts": { "start": "node index.js" }
}

Or change the Start Command to node index.js in Settings > Build & Output Settings.

Python (Flask)

import os
from flask import Flask

app = Flask(__name__)

@app.route("/")
def home():
    return "Hello from Smile Hosting!"

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=int(os.environ.get("PORT", 5000)))

Put flask in a requirements.txt. The Start Command is python app.py.

Python (FastAPI)

Start uvicorn from your code so it picks up the port:

import os
import uvicorn
from fastapi import FastAPI

app = FastAPI()

@app.get("/")
def home():
    return {"message": "Hello from Smile Hosting!"}

if __name__ == "__main__":
    uvicorn.run(app, host="0.0.0.0", port=int(os.environ["PORT"]))

Put fastapi and uvicorn in requirements.txt, and set the Start Command to python main.py.

Deploy it

  1. Create a website with the Node.js or Python framework.
  2. Upload your code in the Source tab, including package.json or requirements.txt. Don’t upload your dependencies - no node_modules or venv folders.
  3. Check the Install Command and Start Command under Settings > Build & Output Settings.
  4. Press Deploy. Your dependencies are installed from package.json or requirements.txt, then your Start Command runs.
  5. Open the Logs tab and watch it start. When it says it’s listening, open your address.

After changing your code, press Redeploy to restart it with the new version.

نصيحة

Put secrets like database passwords in a .env file and read them from your code, rather than writing them into your files. Files starting with a dot are never shown to visitors.