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.1.tar.gz (141.2 kB view details)

Uploaded Source

Built Distributions

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

Uploaded CPython 3.12 Windows x86-64

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

Uploaded CPython 3.12 Windows x86

teo-0.3.1-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.1-cp312-cp312-manylinux_2_28_armv7l.whl (17.1 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.28+ ARMv7l

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

Uploaded CPython 3.12 manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.12 macOS 11.0+ ARM64

teo-0.3.1-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.1.tar.gz.

File metadata

  • Download URL: teo-0.3.1.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.1.tar.gz
Algorithm Hash digest
SHA256 326439ec5f01f7dacc71c7bf294595f5c4b9c639a3e283f94fcffd98538460b9
MD5 007ee5b998352669445f18abe7436ba2
BLAKE2b-256 443bcce80fd576c9e0bde6fd6d5b8cddbac2ceb3ed7122a13250411720231ff3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: teo-0.3.1-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.1-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 3affc495e85de4285726bfa142bde16d0fd96e94bdee692f508dfccd00569cff
MD5 a10d5c104f68ef12b14f885a36daf274
BLAKE2b-256 f35886282c68b25bc90a13a104a1d00b6f304d085569fe52a126491c817e5534

See more details on using hashes here.

File details

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

File metadata

  • Download URL: teo-0.3.1-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.1-cp312-none-win32.whl
Algorithm Hash digest
SHA256 a460fb3f33cbc71c59336451ae3607900a80cb37c0a40a707ff8aee033ecad41
MD5 eabc45f22a40ceed440073830a169f50
BLAKE2b-256 a518653a0f1cdec631f5afd245c9d3c51ab7a1468d6c237b5fc9bfce9b8533a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teo-0.3.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4277328530153342c54b873f52e3da84462b05c88c923197f4fb25a1d52e89e6
MD5 151eb6c03f430027df748c5371f43dce
BLAKE2b-256 c689ea0de9fdd8a9bf5c14fa6be4521886591d90595e8d8001cf4552e9bcbe27

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teo-0.3.1-cp312-cp312-manylinux_2_28_armv7l.whl
Algorithm Hash digest
SHA256 59d9de617802e612f26ae54f784f4b94b523f36213318a6ddb3917e4834dd89d
MD5 28404d2ae0efdfbd345f7ce3589c0bb5
BLAKE2b-256 cefc1284835f758e92db44697afa0111de6c444c3199c46801c415b279ded69b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teo-0.3.1-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3d76bb2a77c764f2f69c25d3dad5e31d622d47abf3fbe64af2cc3a0aae835f24
MD5 68f081660f738fc2bcf7f381df1fc0b6
BLAKE2b-256 8b74a16562d2ab3fb4315ac313eefd66b4e9441afb41418c072d631c44c102d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teo-0.3.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d41d54cc750e39cd776a541b3c68e862f8a4a404e0f00b770a7d19e487065d8a
MD5 56a437ee302892be73dc0d768ec891c8
BLAKE2b-256 286fc9dc6cc7a7a092854dfe52507ac557ccb4812e75f4b80add8adf90333a37

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teo-0.3.1-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 62769ef77a5c4d3f0fa593b5d73131d260a76768913fa1d0379a018288748411
MD5 10fe9ac57e03a0a754446660d179c1a1
BLAKE2b-256 8f6ce74b859319e8d7f6c6d5cffbc2d40e23c8ddf4c9663c764e18d7a0fa6f1f

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