Giter Club home page Giter Club logo

guestbook-app's Introduction

Guestbook App

Simple retro guestbook app with steps how to deploy it to production server with automatic TLS (HTTPS).

Screenshot

Development

npm run dev

Production Server Installation

Create a new server with a provider such as:

  • Linode/Akamai
  • Digital Ocean
  • Hetzner
  • etc.

What do we need to install?

  • Git (to clone the repository)
  • Node.js (runtime)
  • Caddy (web server with automatic TLS)

Node.js

Use NodeSource to install Node.js.

After test if it works:

node --version

Install the application

cd /opt
git clone https://github.com/rostislavjadavan/guestbook-app
cd guestbook-app
npm install

Note: Don't forget to create .env file with database credentials.

PM2 process manager

For process management we will use PM2 (https://pm2.keymetrics.io/docs/usage/quick-start/).

To make application persistent we need to:

# Generate startup script
npm run pm2:init

# Start the application
npm run pm2:start

# Save the process list
npm run pm2:save

More information: https://pm2.keymetrics.io/docs/usage/startup/

Caddy

https://caddyserver.com/

Install

Configure

Edit /etc/caddy/Caddyfile:

example.com {
    tls email@example.com

    reverse_proxy localhost:3000
}

To check for errors you can use caddy validate command.

Note: Replace example.com with your actual domain name and [email protected] with your email address. Your email address will be used as a contact for the certificate provider, Let's Encrypt (https://letsencrypt.org/).

Don't forget to restart Caddy after editing the config file:

systemctl restart caddy

After restart it should automatically obtain TLS certificate and serve the application. If not check the logs via journalctl -u caddy.

Database

Create new database at https://neon.tech/

CREATE TABLE messages (
    id SERIAL PRIMARY KEY,
    name VARCHAR(255) NOT NULL,
    message TEXT NOT NULL,
    timestamp TIMESTAMP DEFAULT current_timestamp
);

guestbook-app's People

Contributors

rostislavjadavan avatar

Watchers

 avatar

Forkers

nightguarder

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.