Web Tech Stack

Web Structure

Modern website uses HTML (HyperText Markup Language) to define the structure of webpage, CSS (Cascading Style Sheets) used to style and layout HTML elements. JS (JavaScript) allows you to make a webpage interaction.

CSS Frameworks

Some tools to enhance the quality and productivity of CSS

Bootstrap

Bootstrap

A simple and quick developement CSS framework for easy designing by adding predefined bootstrap class such as buttons, styles, layout on the html element class attribute. Visit Bootstrap website for more info and customization. Add the following source in html to start using bootstrap.

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>

SASS & SCSS

SASS (Syntactically Auwsome Style Sheets) is a CSS extension to add more functionality to CSS, and needs to compile to CSS. SASS have similar syntax to python. While SCSS (Sassy SASS) is a syntax of SASS similar to Java. The key feature are variables, nesting, mixins (bundle some properties), inheritance, mathematics operations and partials (multiple files). Below are the example page and code.

Show Demo

Tailwind CSS

A optimized and lightweight CSS framework with highly customizable developement and more configuration space than Bootstrap. Tailwind CSS does not impose a predefined style for components, but they have a utilities class to help building components. Tailwind also have ‘purge’ feature to remove unused CSS.

Tailwind CSS

Click here to explore more about TailwindCSS

Purge CSS

PurgeCSS

A tool to remove unused CSS. Visit PurgeCSS to learn how to use. Build tools like PostCSS or TailwindCSS can configure and automate the purging of CSS.

npm install -g purgecss
purgecss --css styles.css --content index.html --output purified.css

Font

Fonts-families tell what font type to be used. Font-weight defind the thickness of the font. Font-styles are like italic, underline, etc.

Font FamilyCharacteristics
SerifClassic, traditional official fonts
Sans-serifModern, simple fonts
MonospaceEvery character have same width
CursiveCursive writing

Scaling of fonts

UnitDescriptionExample
PixelThe absolute pixel size16px
EmRelative unit based on parent element1.5em
RemRelative to root element1.5 rem
PercentageRelative to the parent element50%
Viewport1 unit is the 1% of the browser’s visible window3vw(width); 4vh(height)
Points1 points is 1/72 inch used in traditional printing media12pt

The font size represent the height of the character from the top to the bottom of the part. IT industry uses combination of rem for consistenst typography across pages and vw for large dynamix text that adapt screen size. Default of html font size is 16px

Below shows an example using Google Fonts

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Google Fonts Example</title>
    <!-- Link to Google Fonts -->
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&family=Lobster&display=swap" rel="stylesheet">
    <style>
        body {
            font-family: 'Roboto', sans-serif;
        }
        h1 {
            font-family: 'Lobster', cursive; /* Use Lobster font */
            font-size: 48px;
        }
    </style>
</head>
<body>
    <h1>Welcome to My Website!</h1>
    <p>The title uses Lobster font while paragraph uses Roboto font </p>
</body>
</html>

Icons

Discover amazing icon from FontAwesome and embed into web.

fontawesome-example.html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Font Awesome with Custom Styles</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
    <style>
        .icon {
            margin: 15px;
        }
        /* Custom styles for different icons */
        .fa-home {
            color: #4CAF50; /* Green */
            font-size: 2em;
        }
    </style>
</head>
<body>
    <i class="fas fa-home icon"></i>    <!-- Home icon with custom styles -->
</body>
</html>

Figma

Figma is a web application for interface design. Making layout with autolayout, variable. However, the website need to be coded manually by looking at the design information. Learn more about it here

For quick web UI/UX design tutorial, watch this. For color testing, visit this website from Juxtopposed to test with color selection.

Try to implement these design: minimal, glass morphic, neobrutalist, grainy, modern

Frontend Frameworks

Frontend Frameworks provide better way to make website efficiently, dynamically, and consistent.

Static SiteDynamic Site
Website consisting only HTML, CSS, JSInteracts with backend

React vs Vue (Dynamic)

React is a JS library for building UI. React focusing on virtual DOM efficient rendering, and uses state (internal component data) and props (data passed to components) for dynamic data. It is suitable for creating complex web application.

Vue is an open-source JS framework for building single-page application similar to Angular. Vue uses reactivity system that change in data is automatically reflected to UI. Templates is available to bind DOM to Vue instance data.

FeaturesReactVue
Learning CurveSteepGentle
PerformanceGreat on large, complex projectGreat on small-medium, simple project
State ManagementUsing hooksUsing reactive data (Pinia)
Data BindingOne-way data binding (parent to child)Two-way data binding
CommunityVast and mass support and supported by FacebookGrowing Rapidly
Vue

Click here to explore more about Vue

React

Click here to explore more about React, Next.js framework and web developement concepts

Hugo (Static)

A framework wrtitten on GO for static content developement and management. It’s very quick to build up. This website is powered by Hugo.

Backend Tools

Typescript

A language derived from javascript to deal with variable type consistency and adds Java programming features like OOP, generics, enum, union and intersection types. Typescript can be compiled to javascript. Tyepscript is suitable for developing and debugging huge JS projects. Visit Typescript website to learn more.

Typescript Code
// TypeScript Example: Person and Employee Management

// Define a type alias for a string or number
type ID = string | number;

// Interface for an Employee
interface Employee {
  id: ID;
  name: string;
  age: number;
  position: string;
  displayInfo(): string;
}

// Class for a Person
class Person {
  name: string;
  age: number;

  constructor(name: string, age: number) {
    this.name = name;
    this.age = age;
  }

  greet(): string {
    return `Hello, my name is ${this.name}, and I am ${this.age} years old.`;
  }
}

// Class Employee that extends Person and implements Employee interface
class FullTimeEmployee extends Person implements Employee {
  id: ID;
  position: string;

  constructor(id: ID, name: string, age: number, position: string) {
    super(name, age);
    this.id = id;
    this.position = position;
  }

  // Implementation of displayInfo method from Employee interface
  displayInfo(): string {
    return `Employee ID: ${this.id}, Name: ${this.name}, Position: ${this.position}`;
  }
}

// Function to print a person's greeting
function printGreeting(person: Person): void {
  console.log(person.greet());
}

// Create an instance of FullTimeEmployee
const employee: FullTimeEmployee = new FullTimeEmployee(101, "John Doe", 28, "Software Engineer");

// Use the methods
printGreeting(employee); // Output: Hello, my name is John Doe, and I am 28 years old.
console.log(employee.displayInfo()); // Output: Employee ID: 101, Name: John Doe, Position: Software Engineer

Eslint

A tool to identifying and fixing common issue in JavaScript on syntax error, potential bugs and code style

Wordpress

A full-stack online web CMS (Content Management System). Build website with templates easily without coding.

Backend Framework

Server-Side RenderingClient-Side Rendering
HTML generated at serverHTML generated at client
Faster initial load, better SEO (Search Engine Optimization)Slower initial, faster transition between pages
Suitable for content-heavy website, SEO-cricital appsHighly interactive, dynamic apps
Static SiteDynamic Site
DescriptionA website consisting only of HTML, CSS, and JavaScript files with no backendA website that interacts with a backend for features like APIs or databases
Hosting PlatformNetlify, Vercel, GitHub Pages, Firebase Hosting, AWS S3 + Cloud FrontNetlify, Vercel, Heroku, Render, AWS (EC2, Elastic Beanstack, Lambda)
FrameworksReact(Vite), Vue(Vite), Next.js, Nuxt.js, HugoVue, React, Angular, Svelte, Node.js, Python, PHP Laravel, Ruby on Rails

A backend web server is used to manage client request (Apache or Ngnix). Visit production to learn more on how to make website available to public.

Production

Click here to learn more about hosting platform

Nuxt.js vs Next.js

FeaturesNuxtNext
Parent FrameworkVueReact
RenderServer-side renderServer-side render
GenerationStaticStatic
Dev toolRouting, state managementRouting, state management

Vite

A fast, modern build tool and development server for JavaScript and TypeScript projects. It focuses on lightning-fast cold starts and efficient bundling for production. Vite website

Node.js

Node.js is a JavaScript runtime environment available on backend. It is event driven, non-blocking I/O, fast and lightweight. npm (Node Package Manager) is well known for its vast ecosystem of libraries and module, it install the package globally. While npx runs package without installing them globally.

JS Node.js uses .js file extension, require(), module.exports.

ES Module ES module use .mjsfile extension, import, export. Set "type": "module" in package.json to use ES module if you’re using .js

Run npm init -y to generate package.json that record npm dependencies and metadata

Example of a basic web server using node.js

server.js
// Import the built-in modules
const http = require('http');
const fs = require('fs');
const path = require('path');
const PORT = 3000;
const FILE_PATH = './picture.jpg';

// Create an HTTP server
const server = http.createServer((req, res) => {
  const filePath = path.join(__dirname, FILE_PATH);
  fs.readFile(filePath, (err, data) => {
    if (err) {
      res.writeHead(404);
      res.end('File not found!');
      return;
    }
    // Browser will allow request made to different domain
    res.setHeader("Access-Control-Allow-Origin", "*");
    res.setHeader("Access-Control-Allow-Methods", "POST, GET, PUT");
    res.setHeader("Access-Control-Allow-Headers", "Content-Type");
    res.writeHead(200, { 'Content-Type': 'image/jpg' });
    res.end(data);
  });
});

// Define a port and start the server
server.listen(PORT, () => {
  console.log(`Server running at http://localhost:${PORT}`);
});

Run the server using this command

node server.js

To run multiple server at same time

package.json
{
  "scripts": {
    "start:hugo": "hugo server",    // Replace hugo with your actual package
    "start:node": "node server.js", // Replace "server.js" with your actual Node server file name
    "start": "concurrently \"npm run start:hugo\" \"npm run start:node\""
  }
}

Express.js

Express.js is a minimal web framework for Node.js, designed to simplify building web applications and APIs.

Express.js

Explore how Express.js works!

Django

Django is a high-level Python web framework that enables rapid development of secure and maintainable web applications. Comes with built-in admin panel, and user authentication. Django have ORM (Object-Relational Mapping) allowing developers work with database without writing raw SQL and uses MVT architecture.

  • Model: Represents the data structure and database schema. It defines the shape of the data and handles database queries via Django’s ORM.
  • View: Handles the logic for what data is presented to the user. Views fetch data from models and send it to templates.
  • Template: Responsible for rendering the final HTML that the user sees. Templates receive data from views and format it for display.

PHP

PHP (Hypertext Preprocessor) is a popular, open-source server-side scripting language designed primarily for web development. It is widely used to create dynamic and interactive web pages. PHP code is executed on the server, and the result is sent back to the client as plain HTML. PHP works by embedding PHP code within HTML using <?php ...?>

Database

A database used to store datas and can be hosted on different server.

SQL

SQL (Structured Query Language) databases are structured database using tables with rows and columns to store data, and use keys to refer to other table for relation.

SQL DatabasesFeature
PostgreSQLOpen-sourced supporting relational and object-oriented feature and have strong performance
MySQLClassic SQL database
SQLiteSuitable for smaller database

NoSQL

NoSQL Databases are suitable for unstructured data. Often used for real-time and distributed system.

NoSQL DatabasesFeature
MongoDBFor document
FirestoreGoogle cloud
RedisKey-value
Neo4jGraph database

Tech Stack

A tech stack refers to a set of tools, programming languages, and technologies that work together to build digital products or solutions such as websites, mobile, and web apps. Frontend tech stack is the client-side appplication such as visual appereance. Backend is the server-side software developement.

Tech StackTechDescription
LAMPLinux, Apache, MySQL, PHPCost efficiency, flexibility, performance
MEANMongoDB, Express.js, Angular, Node.jsJS focused, open source, fast
MERNMongoDB, Express.js, React, Node.jsMEAN with React as frontend
MEVNMongoDB, Express.js, Vue, Node.jsMEAN with Vue as frontend
ASP.NETASP.NET MVC, IIS, Angular, SQL, AzureFor Windows
PythonPython, DjangoEasy to use

Legacy Note