Project

gemite

0.0
The project is in a healthy, maintained state
Gemite is a lightweight HTML-first programming language inspired by PHP. It allows developers to build dynamic web applications with minimal setup, built-in routing based on file structure, and integrated SQLite support.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

Gemite

A lightweight HTML-first programming language for building small web applications.

Gemite is a lightweight programming language inspired by PHP. It lets you create dynamic web applications by embedding Gemite code directly into HTML.

Its philosophy is simple:

  • HTML first
  • No framework
  • No configuration
  • Small and fast
  • Easy deployment

Features

  • HTML-first syntax
  • File-based routing
  • Built-in development server
  • SQLite support
  • Cross-platform (Windows, Linux, macOS)
  • Minimal dependencies
  • Easy to learn
  • Ruby-powered runtime

Installation

Install from RubyGems.

gem install gemite

Check the installed version.

gemite version

Quick Start

Create a new project.

mkdir myapp
cd myapp

Create index.gmt.

<?gemite
name = "Gemite"
?>

<!DOCTYPE html>

<html>
<head>
    <title>Gemite</title>
</head>

<body>
    <h1>Hello, {name}!</h1>
</body>
</html>

Run the development server.

gemite

Open your browser.

http://localhost:8000

Project Structure

myapp/

├── index.gmt
├── about.gmt
├── users/
│   └── list.gmt
│
├── public/
│   ├── css/
│   ├── js/
│   └── images/
│
└── database.db

URL mapping

index.gmt
        ↓
/

about.gmt
        ↓
/about

users/list.gmt
        ↓
/users/list

Language Guide

Comments

// Single line comment

Variables

name = "Gemite"
count = 10

Numbers

a = 10
b = 3.14

Strings

name = "Gemite"

Boolean

true
false

Arrays

items = [1,2,3]

Maps

user = Map()

Operators

Arithmetic

+
-
*
/
%

Comparison

==
!=
<
<=
>
>=

Logical

&&
||
!

if

if score >= 60
    print("Pass")
end

unless

unless logged_in
    print("Login required")
end

while

while i < 10
    i += 1
end

for

for i = 0; i < 10; i += 1
    print(i)
end

foreach

foreach item in items
    print(item)
end

break

break

continue

continue

return

return value

Functions

func hello(name)
    print(name)
end

HTML Output

<h1>{title}</h1>

Expressions inside {} are evaluated and inserted into HTML.


Built-in Functions

String

len()

substr()

split()

join()

replace()

upper()

lower()

trim()

Math

abs()

rand()

min()

max()

Time

time()

sleep()

Files

exists()

read()

write()

append()

delete()

mkdir()

copy()

move()

JSON

json_encode()

json_decode()

SQLite

db.open()

db.query()

db.exec()

db.close()

CLI Commands

Start the development server.

gemite

Specify a port.

gemite s 3000

Show the version.

gemite version

Show help.

gemite help

Examples

Hello World

<?gemite
name = "World"
?>

<h1>Hello, {name}!</h1>

Counter

count = count + 1

SQLite

db = db.open("database.db")
rows = db.query("SELECT * FROM users")

Build

Clone the repository.

git clone https://github.com/<YOUR_GITHUB>/gemite.git
cd gemite

Build the gem.

gem build gemite.gemspec

This creates:

gemite-x.y.z.gem

Install from Source

gem install ./gemite-x.y.z.gem

Verify the installation.

gemite version

Development

Install dependencies.

bundle install

Run Gemite from the source tree.

bundle exec gemite

or

ruby exe/gemite

License

Gemite is released under the MIT License.

See the LICENSE file for details.