Giter Club home page Giter Club logo

vue-auth-skeleton's Introduction

VUE-AUTH-SKELETON

This project is a side product of testing and examining my next fullstuck environment, programing language... for web application development

Server - JWT implementation using KNEX and Express on Node.js

Client - Vue.js using Vue-router, Vuex and Workbox for PWA

;TLDR

After many years of using Microsoft Visual Studio, coding c#, asp.net for IIS & MS-SQL on windows machines, I'm looking for an open-source solution. I decided that my next fullstuck template will be node.js based. front-end: Vue.js Shell that supports most PWA features on client side. server-side: Express.js for REST API.

evolution of the web FROM STATIC TO DYNAMIC".

My first server side language was ASP3 (vb script). Things got match better when .NET born, the simple WS SOAP based integration, OOP, separation between layout and logic was great! But the basic architecture did not chage, Microsoft ASP.NET (web forms) was still postback based, the old school architecture was to render the HTML for every click, and then load the complete page, which mean low performence.

Since then, more and more open source libraries took significant part on both client and server side and Microsoft release MVC and other open source inspired or combind starter-kits and good solutions like web api.

This project architecture is a Single Page Web Application, that makes Http json request to REST APIs from different sources, some public and some Token based - the SPA layout loads only one time, and content change by replacing only the data inside the selected layout commponent, driven by a callback response or user action.

Install

Server

I'm developing on Linux Ubuntu 16.04

postgres sql instalation

create db: sudo -u postgres createdb pgmem.

config knexfile.js (user and pass).

npm install.

npm run knex migrate:latest.

npm run dev.

Client

npm install.

npm run dev.

because i'm running both project on same localhost machine, it is nessesary to open two instance of node.js, and run each on a different port, there for the client code must be modify here.

Production

npm run build, and then copy the file to /home/ubuntu/example/dist/

SSL

sudo apt-get install python-certbot-nginx

add-apt-repository ppa:certbot/certbot

sudo certbot --nginx -d domainname.com

sudo certbot renew --dry-runsudo certbot renew --dry-run

nginx

sudo apt-get install nginx -y

sudo nano /etc/nginx/sites-available/default


# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
server {
	listen 80;
	listen [::]:80;
	server_name example.com;
	location / {
		return 301 https://example.com$request_uri;
	}
}

server {
	server_name example.com;
	listen 443 ssl http2 default_server;
	listen [::]:443 ssl http2 default_server ipv6only=on;

	ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
	ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
	ssl_trusted_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
#	include /etc/nginx/snippets/ssl.conf;

	location /dev {
          proxy_pass http://localhost:3000;
          proxy_http_version 1.1;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection 'upgrade';
          proxy_set_header Host $host;
          proxy_cache_bypass $http_upgrade;
        }

	location /api {
	  proxy_pass http://localhost:3001;
          proxy_http_version 1.1;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection 'upgrade';
          proxy_set_header Host $host;
          proxy_cache_bypass $http_upgrade;	
	}

	location / {
	  alias /home/ubuntu/example/dist/;
          index index.html;
	  try_files $uri $uri/ index.html =404;
	  expires max;
          add_header Pragma public;
          add_header Cache-Control "public, must-revalidate, proxy-revalidate";
	}

  location service-worker.js {
    add_header Last-Modified $date_gmt;
    add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
    if_modified_since off;
       expires off;
       etag off;
  }
}

Other important commands:

sudo ufw status

sudo ufw allow 'Nginx HTTP'

sudo ufw deny {portnum}

sudo nginx -t

sudo systemctl restart nginx

systemctl status nginx

Thanks to

A big gratitude to Haim Lankry for guiding and supporting my C# => JavaScript transformation.

vue-auth-skeleton's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

haimlankry

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.