Skip to main content

No project description provided

Project description

Teo



Schema-driven web server framework.

Quickstart   •   Official website   •   Docs   •   Blog   •   Discord

Introduction

Teo is schema-driven web server framework. The server side API is native to Rust, Node.js and Python.

Highlights & Features

  • Native to Rust, Node.js and Python
  • Innovative schema definition inspired by GraphQL and Prisma
  • Auto database migration
  • Supports MySQL, PostgreSQL, SQLite and MongoDB
  • Generated ORM types and interfaces
  • Generated query clients for frontend
  • Very efficient and performant
  • Data sanitization, transformation and validation
  • Builtin user sessions
  • Builtin permission check
  • First in last out middlewares
  • Custom route handlers
  • Generated customizable admin dashboard
  • Plays great with AI tools

Getting started

The fastest way to get started with Teo is by following the Quickstart guide.

Installation

Install Node.js edition.

npm install @teodevgroup/teo

Install Python edition.

pip install teo

Install Rust edition.

cargo install teo

Write a schema-only server

To write a server is quite simple with Teo. Create a file named schema.teo. Specify which database to connect and which port to listen.

connector {
  provider: .sqlite,
  url: "sqlite::memory:"
}
 
server {
  bind: ("0.0.0.0", 5050)
}
 
model User {
  @id @autoIncrement @readonly
  id: Int
  @unique @onSet($if($presents, $isEmail))
  email: String
  name: String?
  @relation(fields: .id, references: .authorId)
  posts: Post[]
}
 
model Post {
  @id @autoIncrement @readonly
  id: Int
  title: String
  content: String?
  @default(false)
  published: Bool
  @foreignKey
  authorId: Int
  @relation(fields: .authorId, references: .id)
  author: User
}

Start the server with teo serve command. Now you can create, update, delete, read, aggregate and group by. Read our Query client guide for detailed usage.

Write custom handlers

Declare the handler in the schema.

@map(.get, "/echo/:data", interface: "EchoCaptures")
declare nonapi handler echo(): Any

Implement the handler with program code.

Node.js implementation

import { App, Response, Request } from '@teodevgroup/teo'
import { EchoPathArguments } from './entities'
 
const app = new App()
app.mainNamespace().defineHandler("echo", (request: Request) => {
    const captures: EchoCaptures = request.captures()
    return Response.string(captures.data, "text/plain")
})
app.run()

Python implementation

from asyncio import run
from teo import App, Response, Request
from entities import EchoCaptures
 
async def main():
    app = App()
    def echo_handler(request: Request):
        captures: EchoCaptures = request.captures()
        return Response.string(captures["data"], "text/plain")
    app.main_namespace().define_handler("echo", echo_handler)
    await app.run()
 
run(main())

Rust implementation

mod entities;
 
use tokio::main;
use teo::prelude::{App, Response, Result, path};
use crate::entities::EchoCaptures;
 
#[main]
async fn main() -> Result<()> {
    let app = App::new()?;
    app.main_namespace_mut().define_handler("echo", |captures: EchoCaptures| async move {
        Ok::<Response, Error>(Response::string(captures.data(), "text/plain"))
    });
    app.run().await
}

Tutorials

We prepared a Beginner tutorial series to help you learn and understand Teo.

Issues

Welcome to submit issues in this repo.

Contributing

Read our Contributing guide to set projects up and start contributing.

License

TEO is under Apache 2.0 license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

teo-0.3.2.tar.gz (141.2 kB view details)

Uploaded Source

Built Distributions

teo-0.3.2-cp312-none-win_amd64.whl (14.7 MB view details)

Uploaded CPython 3.12 Windows x86-64

teo-0.3.2-cp312-none-win32.whl (12.9 MB view details)

Uploaded CPython 3.12 Windows x86

teo-0.3.2-cp312-cp312-manylinux_2_28_x86_64.whl (18.5 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.28+ x86-64

teo-0.3.2-cp312-cp312-manylinux_2_28_armv7l.whl (17.1 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.28+ ARMv7l

teo-0.3.2-cp312-cp312-manylinux_2_28_aarch64.whl (18.1 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.28+ ARM64

teo-0.3.2-cp312-cp312-macosx_11_0_arm64.whl (14.4 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

teo-0.3.2-cp312-cp312-macosx_10_12_x86_64.whl (15.3 MB view details)

Uploaded CPython 3.12 macOS 10.12+ x86-64

File details

Details for the file teo-0.3.2.tar.gz.

File metadata

  • Download URL: teo-0.3.2.tar.gz
  • Upload date:
  • Size: 141.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.7.4

File hashes

Hashes for teo-0.3.2.tar.gz
Algorithm Hash digest
SHA256 441dc1928dc6c35dffc43a44d655759af631efaebc42542bdfc95b971b7a4566
MD5 d6080df731cfd5178a2eabfcdab76fed
BLAKE2b-256 60867f563d763c1a3e2151138a87b893b7859a782e7df406d0d522be58fd8138

See more details on using hashes here.

File details

Details for the file teo-0.3.2-cp312-none-win_amd64.whl.

File metadata

  • Download URL: teo-0.3.2-cp312-none-win_amd64.whl
  • Upload date:
  • Size: 14.7 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.7.4

File hashes

Hashes for teo-0.3.2-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 d8be63f458cb081b547a444f1652925420ffe48dd46544a8ffb83a64546064dd
MD5 c534582f49689e31c8142a51dcd1e7e2
BLAKE2b-256 ee95223a1e45559b374bb0e0d8c67348f5c073877c9df6962c26e20403016c27

See more details on using hashes here.

File details

Details for the file teo-0.3.2-cp312-none-win32.whl.

File metadata

  • Download URL: teo-0.3.2-cp312-none-win32.whl
  • Upload date:
  • Size: 12.9 MB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.7.4

File hashes

Hashes for teo-0.3.2-cp312-none-win32.whl
Algorithm Hash digest
SHA256 2e2ae40a6b6e46b3128dd7fb861074452b32e3cc78403876d3a5c99adf98d419
MD5 f1315315fc8cd6b8dc58be8797cb62bd
BLAKE2b-256 c4661c82c0d767813f3382fec9950b1ab1a4e76fa03c99b0560a48d2dce1965c

See more details on using hashes here.

File details

Details for the file teo-0.3.2-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for teo-0.3.2-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 09dc01d739a6a66c075173bb10bd5a0a6bcb9d0d1eb7c92f1f425191e0478005
MD5 2eef759496b3f99d8de13e13bf9334f1
BLAKE2b-256 38af1c1dc473b6054a4677bc445c7c8f6f4047acf02d94948cc4b9f702aa67c1

See more details on using hashes here.

File details

Details for the file teo-0.3.2-cp312-cp312-manylinux_2_28_armv7l.whl.

File metadata

File hashes

Hashes for teo-0.3.2-cp312-cp312-manylinux_2_28_armv7l.whl
Algorithm Hash digest
SHA256 98df0e6fe90abadd2cb5d14acb970e22d29a426a2f441f80b5e0812a07af6494
MD5 8c639a443f1d04e6d709c582e7b3e081
BLAKE2b-256 65bfe3594f901f7e607c9e420a5086b1f0682c3d3852feb63f9c22dcd33cf69e

See more details on using hashes here.

File details

Details for the file teo-0.3.2-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for teo-0.3.2-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3585a7c799dea2bb4c339ef4d42ec6b9180ba4d135a42a281ad91760b60de0f0
MD5 6de9fc4a1d97b1372b3c606de3e9bfe8
BLAKE2b-256 2b5dfc59b9d18c8aa12abc2bf091654006ae4c02e44789ff9b95c6c26e6bfb08

See more details on using hashes here.

File details

Details for the file teo-0.3.2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for teo-0.3.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a0a1ef61bca3ef13b9e14c8c9d12489899ff42dc51e391e3b686d4acfe27054d
MD5 f20de014d98329157ebbd85251a7fa29
BLAKE2b-256 5f9ddebb9542c577359a060ad21699e066dbc0f79a9efab27fea6a4765c6dabe

See more details on using hashes here.

File details

Details for the file teo-0.3.2-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for teo-0.3.2-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 abb6a941ece7b6cb9452d0f1e70cf98fbffe51cb24076934cc19f688024b494e
MD5 0c03add30e416136e32780d263b94f56
BLAKE2b-256 95c341cf3ba94c4b14ccc78b4210aeefb6f28db5d49d9a1ea2d1ecbaff164abf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page