Welcome to Gingee! This guide will introduce you to the fundamental concepts and the core philosophy behind the platform. Understanding these ideas will help you build powerful, secure, and scalable applications quickly.
Gingee is designed around a single guiding principle: drastically reduce the time from an idea to a running, production-ready application.
Traditional backend development involves dozens of small, time-consuming decisions and setup tasks: choosing a framework, setting up a server, configuring a database pool, managing CORS, structuring your project, and more. Gingee handles all of this for you. It's a "batteries-included" platform that lets you focus on your unique business logic from day one.
A Gingee server has a simple, predictable folder structure. The key directories are:
web
is considered a distinct App.my_app
.
db
, crypto
, fs
, and image
live here.Gingee features a powerful and flexible routing engine that automatically maps incoming URL requests to your server scripts or static files. It supports two distinct modes to fit your application's needs. The two modes can also be used together.
NOTE:
index.html
for any request that doesn't match a specific API route or static file. This enables client-side routing libraries like React Router to function seamlessly.For simplicity and rapid development, this is the default behavior. You don't need to configure anything—just create files.
box
folder.
GET /my-app/users/list
→ executes web/my-app/box/users/list.js
.GET /my-app/css/style.css
→ serves the file at web/my-app/css/style.css
.For building RESTful APIs with clean, dynamic URLs, you can activate a more powerful routing mode by creating a routes.json
file in your app's box
folder.
path: "/users/:userId/profile"
in routes.json
.../my-app/users/123/profile
.{ "userId": "123" }
.routes.json
file provides a clear, single source of truth for all of your application's endpoints, mapping them to specific server scripts and HTTP methods. When this file exists, it takes precedence over file-based routing.IMPORTANT: The /box/ folder is never included in the url paths. Eg. a URL /
gbox
) & Secure ExecutionSecurity is not an afterthought in Gingee; it is the default. Every server script you write is executed inside a secure sandbox called the "gbox".
$g
) to interact with the world.import
/from
) on the fly, so you can write modern JavaScript without any build steps.gingee()
Middleware & the $g
GlobalThis is the heart of the Gingee development experience. Every server script is wrapped in a call to the gingee()
middleware, which prepares the environment and provides a powerful, simplified API.
module.exports = async function() {
await gingee(async ($g) => {
// Your code goes here
$g.response.send("Hello, World!");
});
};
The $g
object is your secure gateway to everything you need for a request, including the parsed request ($g.request
), a response builder ($g.response
), the logger ($g.log
), and your app's configuration ($g.app
).
Gingee provides a rich standard library of "app modules" to handle common tasks securely and efficiently. These are required by name (e.g., require('db')
) from any server script.
auth
: Provides authentication-related functions, including JWT creation and verification
cache
: Provides a secure interface for caching data within the Gingee application context.
chart
: Provides functionality to create and manipulate server-side charts
crypto
: Provides an essential cryptographic toolkit.
dashboard
: Provides functionality to create and manage a dashboard layout with multiple charts.
db
: Provides a unified interface for database operations, allowing dynamic loading of different database adapters
encode
: Provides various encoding and decoding utilities for strings, including Base64, URI, hexadecimal, HTML, and Base58.
fs
: Provides secure, sandboxed synchronous and asynchronous file operations.
html
: Provides functions for parsing and manipulating HTML from string, file and url sources.
httpclient
: Provides functions to perform GET and POST requests, supporting various content types to simplify http calls
image
: Provides a simple and secure way to manipulate images, including resizing, rotating, format conversion etc.
pdf
: Provides functionality to create PDF documents, and includes a custom font registry system.
qrcode
: Provides functions to generate QR codes and 1D barcodes.
utils
: provides functions for generating random data, validating inputs, manipulating strings, and more.
uuid
: Provides functions to generate and validate UUIDs (Universally Unique Identifiers).
zip
: Provides functions to zip and unzip files and directories securely.
platform
: Provides special Gingee platform level functions. To be used by only platform-level apps which are configured at server level (in gingee.json) as 'privileged apps'
IMPORTANT: All Gingee modules are required by name (eg. 'fs'). Some of these names intentionally are similar to NodeJS built-in modules for developer familiarity only. Gingee by default locks out access for all NodeJS built-in modules and third party modules with the exception of 'querystring', 'url' and 'mime-types'. A whitelist of built-in and third party modules can be configured in gingee.json but it is not recommended to do so to preserve the sandboxed nature of Gingee apps.
gingee.json
, app.json
, etc.)Configuration in Gingee is declarative and split across several manifest files, each with a clear purpose. This separation keeps server-level concerns apart from application-specific ones.
gingee.json
: The master file for the entire server instance. It controls global settings like server ports, the central caching provider (Memory or Redis), and logging policies.app.json
: The manifest for a single application, located in its box
folder. It defines the app's name, database connections, startup scripts, and middleware.pmft.json
: The security manifest for a distributable application. Here, a developer declares the permissions (e.g., db
, fs
) the app requires to function. The CLI reads this file to get consent from an administrator during installation.routes.json
: An optional manifest for enabling advanced, dynamic URL routing for an application, perfect for building clean RESTful APIs.For a full breakdown, see the Server Config and App Structure reference guides.
The gingee-cli
is an essential, all-in-one tool for the entire application lifecycle. It is used for both local development and production server management. Its key capabilities include:
gingee-cli init
.add-app
and add-script
.install-app
), upgrading (upgrade-app
), rolling back (rollback-app
), and deleting applications on a remote server.list-store-apps
and install-store-app
.For detailed usage of all commands, see the CLI Command Reference MD / HTML.
Gingee is unique in its origin and development philosophy. It was co-authored by a human architect and a Generative AI partner, embracing a workflow we call "Dialog-Driven Development." High-level goals are discussed and refined in a collaborative dialogue, and the AI generates the implementation, which is then tested and validated.
You are encouraged to adopt this same powerful workflow. The key is to provide the AI with a "knowledge bundle" of the platform's architecture.
How to Start an AI-Assisted App Development Session:
ai-context.md
file in the project's docs/ai-context
directory.