https://github.com/7togkid/gaman
GamanJS is a modern backend framework built for resilience, scalability, and simplicity.
https://github.com/7togkid/gaman
backend framework javascript js ts typescript web
Last synced: 9 months ago
JSON representation
GamanJS is a modern backend framework built for resilience, scalability, and simplicity.
- Host: GitHub
- URL: https://github.com/7togkid/gaman
- Owner: 7TogkID
- License: mit
- Created: 2025-06-05T16:20:57.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-06-21T10:58:13.000Z (9 months ago)
- Last Synced: 2025-06-25T12:17:34.443Z (9 months ago)
- Topics: backend, framework, javascript, js, ts, typescript, web
- Language: TypeScript
- Homepage: https://gaman.github.io/
- Size: 1.58 MB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
GamanJS
GamanJS is a modern backend framework built for resilience, scalability, and simplicity.
---
## π§ Philosophy
"Gaman" (ζζ
’) β patience, perseverance, and resilience. These principles are at the heart of GamanJS, empowering developers to build robust and modular web applications effortlessly.
## β¨ Packages
| Package | Release Notes |
| ---------------------------------------------- | ------------- |
| [gaman](https://github.com/7TogkID/gaman) | v0.0.21 |
| [create-gaman](packages/create-gaman) | v0.0.1 |
| [@gaman/ejs](packages/gaman-ejs) | v0.0.11 |
| [@gaman/static](packages/gaman-static) | v0.0.3 |
| [@gaman/cors](packages/gaman-cors) | v0.0.1 |
| [@gaman/basic-auth](packages/gaman-basic-auth) | v0.0.1 |
| [@gaman/cli](packages/gaman-cli) | v0.0.3 |
## π Get Started
For complete documentation, examples, and best practices, visit the **GamanWiki**:
[https://github.com/7TogkID/gaman/wiki](https://github.com/7TogkID/gaman/wiki)
### Install the CLI
You can install the GamanJS CLI globally using your preferred package manager:
```bash
npm i -g @gaman/cli
```
### Create a New Project
To create a new GamanJS project, use the `gaman new` command:
```bash
gaman new
```
This will scaffold a new GamanJS project with the necessary structure.
### Run Your Project
Start your server with:
```bash
# Using Node
npm run dev
```
## π Updating the CLI
To update your GamanJS CLI to the latest version:
```bash
gaman upgrade
```
## π Project Structure
After creating a new project, your file structure will look like this:
```css
src/
βββ main.ts
βββ main.block.ts
```
## βοΈ Example Code
Hereβs a quick example to get you started:
`src/main.ts`
```ts
import mainBlock from "main.block";
import gaman from "gaman";
gaman.serv({
blocks: [mainBlock], // your blocks
server: {
port: 3431, // optional
host: "0.0.0.0", // optional
},
});
```
`src/main.block.ts`
```ts
import { defineBlock, Response } from "gaman";
export default defineBlock({
path: "/",
all: (ctx) => {
console.log("middleware ALL");
},
routes: {
"/": (ctx) => {
return Response.json({ message: "β€οΈ Welcome to GamanJS" });
},
"/article/*": (ctx) => {
ctx.locals.userName = "Angga7Togk"; // set data locals
},
"/article": {
POST: [
async (ctx) => {
const json = await ctx.json();
return Response.json(json /**return JSON */, { status: 200 });
},
],
"/json": {
GET: (ctx) => {
const userName = ctx.locals.userName;
// return like Response.json()
return {
user_name_from_local: userName,
};
},
},
"/text": {
GET: (ctx) => {
const userName = ctx.locals.userName;
// return like Response.text()
return userName;
},
},
},
},
});
```
Happy coding! β€οΈ GamanJS Team