Skip to content

vlad1slove1/landing

Repository files navigation

🚀 UP-DP landing


🛠️ Stack:

stack icons


📦 Project Setup Guide

⚙️ Prerequisites

⚠️ Project requires Node.js v18 and npm v9.8.1 (or later)

Use nvm (Node Version Manager) to install and manage the required versions of Node.js and npm:

  1. Install nvm: If nvm isn't installed, follow the official installation guide.

    Or, run this commands:

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
    export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
    # These should pick up the nvm command
    source ~/.bashrc
  2. Install Node.js (v18 or higher) and npm (latest):

    This will install the latest long-term support (LTS) version of Node.js and the latest compatible npm version.

    nvm install --lts  
    nvm use --lts  
  3. Verify installation:

    node -v  
    npm -v  

📥 Follow these simple steps to get the project up and running:

1. Clone the Repository

First, clone the project repository to your local machine:

git clone https://github.com/vlad1slove1/landing.git
cd landing

2. Install Dependencies

Next, install the required dependencies using npm:

npm install

3. Setting Up .env

Copy or rename the .env.example file to .env:

cp .env.example .env

Then open the .env file and set the appropriate values for your environment variables:

NEXT_PUBLIC_TELEGRAM_BOT_TOKEN=personal bot token
NEXT_PUBLIC_TELEGRAM_CHAT_ID=chat_id for specific telegram group

NEXT_PUBLIC_SITE_URL=production url for backend utilities

Save the .env file after updating all the variables

4. Start the Development Server

Once the dependencies are installed, run the development server:

npm run dev

The app will now be running on http://localhost:3000

5. Lint the Project

To check the code for style and potential issues, run the linting command:

npm run lint

6. Build the Project

To create a production build of the project, run the following command:

npm run build

🐳 Run with Docker

Build the image:

docker build -t landing .

Run the container:

docker run -p 3000:3000 landing

Now app is up and running on http://localhost:3000


🚢 Docker image as systemd service

1. Create a new service file:

Create a new service file in /etc/systemd/system/:

sudo nano /etc/systemd/system/landing.service

Add the following content:

[Unit]
Description=landing container
After=docker.service
Wants=network-online.target docker.socket
Requires=docker.socket

[Service]
Restart=always
ExecStart=/usr/bin/docker run -p 3000:3000 landing
ExecStop=/usr/bin/docker stop landing

[Install]
WantedBy=multi-user.target

2. Enable and Start the Service

Enable and start the service using:

sudo systemctl daemon-reload
sudo systemctl enable landing.service
sudo systemctl start landing.service

3. Check the Status

Verify that the service is running:

sudo systemctl status landing.service

Now the Dockerized app is running as a systemd service!