Skip to content

ExamProCo/deploy-vibecoded-app-on-hostinger

Repository files navigation

NoteTaker

A sample Node.js notes application built with Express, EJS, and MySQL, ready to deploy to Hostinger.

Features

  • Create notes with a title and body
  • View all saved notes on the homepage (newest first)
  • Health check endpoint at /health

Tech stack

  • Express — web framework
  • EJS — server-rendered templates
  • mysql2 — MySQL/MariaDB driver (promise-based)
  • dotenv — environment configuration
  • Docker Compose — local MariaDB matching Hostinger

Project structure

.
├── server.js          # App entry point, routes, server bootstrap
├── db.js              # MySQL connection pool + table initialization
├── views/             # EJS templates
│   ├── partials/head.ejs
│   ├── index.ejs      # Homepage (note list)
│   ├── new.ejs        # New-note form
│   └── error.ejs
├── public/css/style.css
├── docker-compose.yml # Local MariaDB for development
├── .env.example
└── package.json

Local setup

  1. Install dependencies:

    npm install
  2. Create your environment file:

    cp .env.example .env

    The defaults already match the bundled Docker database (below), so you can leave them as-is for local development.

  3. Start a local database. Hostinger's Web/Cloud hosting runs MariaDB, so the included docker-compose.yml provides a matching MariaDB instance:

    docker compose up -d

    This starts MariaDB on DB_PORT (3306) and creates the DB_NAME (notetaker) database using the credentials from your .env. Data persists in a named volume, so notes survive restarts. Stop it with docker compose down.

    No Docker? Point the .env credentials at any existing MySQL/MariaDB server instead — just make sure the DB_NAME database exists. The notes table is created automatically on startup either way.

  4. Start the app:

    npm start

    The app runs at http://localhost:3000.

Routes

Method Path Description
GET / List all saved notes
GET /notes/new Show the new-note form
POST /notes Create a note (title + body)
GET /health Health check (verifies DB access)

Deploying to Hostinger

  1. In hPanel, create a Node.js application and a MySQL database.
  2. Set the application's environment variables (DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, DB_NAME, and optionally PORT) to match your Hostinger database. On Hostinger, DB_HOST is typically localhost.
  3. Upload the project files (or deploy via Git), set the startup file to server.js, and run npm install.
  4. Start the application. Verify it is healthy by visiting /health.

About

We will vibecode an app and deploy it to a production server on hostinger

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors