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 @teocloud/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 '@teocloud/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.0a1.tar.gz (140.4 kB view details)

Uploaded Source

Built Distributions

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

Uploaded CPython 3.12 Windows x86-64

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

Uploaded CPython 3.12 Windows x86

teo-0.3.0a1-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.0a1-cp312-cp312-manylinux_2_28_armv7l.whl (17.1 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.28+ ARMv7l

teo-0.3.0a1-cp312-cp312-manylinux_2_28_aarch64.whl (18.0 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.12 macOS 11.0+ ARM64

teo-0.3.0a1-cp312-cp312-macosx_10_12_x86_64.whl (15.2 MB view details)

Uploaded CPython 3.12 macOS 10.12+ x86-64

File details

Details for the file teo-0.3.0a1.tar.gz.

File metadata

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

File hashes

Hashes for teo-0.3.0a1.tar.gz
Algorithm Hash digest
SHA256 9d4f50561a546ab0543b22688c214650259367f8d4eb0308146878758c2ca4e5
MD5 bcda1ee299e47efc98fc2287a7e658a0
BLAKE2b-256 cfb8523743271bf7404171123c6b48451200968f57bb50f903845cc02138b0ed

See more details on using hashes here.

File details

Details for the file teo-0.3.0a1-cp312-none-win_amd64.whl.

File metadata

  • Download URL: teo-0.3.0a1-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.0a1-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 7a5b69153b2d5dd5925719da5528e5d5d5bb27d7ffa5622acdf828893168690c
MD5 19b8677d7e19ea2f7b09e9abaa719b85
BLAKE2b-256 67e9c5eba2d01b1c5d5abbaaec3ca10fe1c3e36d9a7e231c4c8d32f3fb49516f

See more details on using hashes here.

File details

Details for the file teo-0.3.0a1-cp312-none-win32.whl.

File metadata

  • Download URL: teo-0.3.0a1-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.0a1-cp312-none-win32.whl
Algorithm Hash digest
SHA256 452dbe77a17d92b01fbb19e6b6f328a11472cd0eb0afc07ca4d7361ce3826daa
MD5 420ed580174fa99422d216d20810d622
BLAKE2b-256 a02791a2f8d7cb31beecdf30ce21ff9c4872a92f4c43a8cacfb025f75484888b

See more details on using hashes here.

File details

Details for the file teo-0.3.0a1-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for teo-0.3.0a1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6213496b78d67d6fd352e6e70adf68e9b9e9e01c67c46bbaf11a6941377b8a06
MD5 be1879fb9d625bf6bc3e809b78e5cba9
BLAKE2b-256 ea99af24e3eadb92c9ba9d28e8c585755fb849399f5bce71bc958908f90a6ff9

See more details on using hashes here.

File details

Details for the file teo-0.3.0a1-cp312-cp312-manylinux_2_28_armv7l.whl.

File metadata

File hashes

Hashes for teo-0.3.0a1-cp312-cp312-manylinux_2_28_armv7l.whl
Algorithm Hash digest
SHA256 f486d7c5b72f505579a1b8d236e64a0cbb2916921c48ed0b0ead328239dc4787
MD5 464b54749cab8edb43fc496d3ad1ef75
BLAKE2b-256 02e86bb620f649a508383aa4ea4eb088d319bc6acd0abd79a54fe905e0d593a0

See more details on using hashes here.

File details

Details for the file teo-0.3.0a1-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for teo-0.3.0a1-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d618f4152f78f20f71ce995ec7ba197d39806e3cf1721cba5668de9fccc2e22c
MD5 a7ea6ec6db2b122f1db566f074d98c8f
BLAKE2b-256 ea305d92e6033a1fd0f5d4d60ce625254f599d61c1a65eb6a308c83ed300f820

See more details on using hashes here.

File details

Details for the file teo-0.3.0a1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for teo-0.3.0a1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dd4828c49630eb04e9233af98d3e048829e373b00de11096696ded00e1d28b23
MD5 14da2acab1a6c5478f05de65a3702de8
BLAKE2b-256 dfacb4b17b94e01a067a46744346e52c3b4b4a24b6a487b336994cd08ef835ba

See more details on using hashes here.

File details

Details for the file teo-0.3.0a1-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for teo-0.3.0a1-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 22e2b2f6c7b1b51011bc8ca14b63a4ee99d431baac1ebddbe5427e0b7ce8bc4d
MD5 28a99497217621552ab6e21628ac6c8d
BLAKE2b-256 d892312a1211a6d0ffea30e3a5d58a0c6445f17642d2368ace5b8f49bdfd2dc6

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