Skip to content

enijar/web-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Web Template

Opinionated template for building modern and scalable web projects.

Development Mode

Set up environment variables:

cp .env.example .env

Start app in development mode:

npm install
npm start

Production Build

Set up environment variables:

cp env.example env

Build app in production mode:

npm install
npm run build

Run app in production:

# Install PM2 globally to manage the server process
npm add -g pm2
pm2 start --name app server/build/index.js

NGINX config:

server {
    server_name _;
    listen 80;
    listen [::]:80;
    client_max_body_size 500m;

    index index.html;
    root /var/www/project-name/client/build;

    location / {
        try_files $uri $uri/ /index.html =404;
    }

    location ~ ^/(api|trpc) {
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_pass http://localhost:3000;
    }
}

About

Opinionated template for building modern and scalable web projects.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published