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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.12 Windows x86-64

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

Uploaded CPython 3.12 Windows x86

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

Uploaded CPython 3.12 manylinux: glibc 2.28+ ARMv7l

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

Uploaded CPython 3.12 manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.12 macOS 11.0+ ARM64

teo-0.3.3-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.3.tar.gz.

File metadata

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

File hashes

Hashes for teo-0.3.3.tar.gz
Algorithm Hash digest
SHA256 c9ca9df58f3b7684745e8b27e7969b80842457fdf56484a495adac7cc3c3b5fa
MD5 49f963264b151503bb3bb17ecc2630ff
BLAKE2b-256 1aba5d09016ea2d6a22872673479f8a2a13be7e01dfecedd145c6bc43c148edb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: teo-0.3.3-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.3-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 be0547495a7e6cb7eca62b82437483d66b83e7bb3ea563544a92a258961d9d4a
MD5 47292e2ce4cd93a351da2aa2cf3fed47
BLAKE2b-256 df08b972502606fbeaca7f6623f5ba31e3f7bdca57002fc8b8ff9d67b8f09653

See more details on using hashes here.

File details

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

File metadata

  • Download URL: teo-0.3.3-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.3-cp312-none-win32.whl
Algorithm Hash digest
SHA256 9b1c538e4d7db3f286ebafad9a1584eb79a6eabc2cae2481dc328c18a20e334e
MD5 209ce4543a361bc080592c89ae73072b
BLAKE2b-256 00b9797fe2f8f144b1931f03e7f3d601cd08364b906cdb3c09b01aff51a624a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teo-0.3.3-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 139e1df1b4e2ed5cb83757e7790d39fc90fc347c041359683c0924a5638bb1a3
MD5 4c789435f1d10a9533453f15693aef9e
BLAKE2b-256 0e8480287c8d3fc0378c9350e75b0785c792be8dbe2ceb6d7033effbfcc5cb3c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teo-0.3.3-cp312-cp312-manylinux_2_28_armv7l.whl
Algorithm Hash digest
SHA256 f2c25048c1076fb76f8af56383592b123707d910f7023f69b6ff08f743c4e3e5
MD5 6b59c3a3194f92fb90ea15f2d57db62f
BLAKE2b-256 41fbb67040db49b624c2687db61a7a8d1b66d2571bc81827f44f7cdb48571173

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teo-0.3.3-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 35356e5d81992f02378097f8ac42cbf8edd58c8522b063a94603b76421789ade
MD5 9cd7eac419ebd2c1594ecbb40562a52a
BLAKE2b-256 8efb5a809a3ba5dff8a6ed6e370e7a07690fee98fb0ccb2489b0865b192f1dc1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teo-0.3.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a26a8a374076791536876d95cea2a43e2f654e1cd65b6be4ae2db552aac3a138
MD5 7a65e06c44296a31e831aac6aebd3010
BLAKE2b-256 053bffdae3a304b9b00205faba9325ba3fb91b01b7b28fc1b823621567649fbd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teo-0.3.3-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7025cc3d2dc97f3ed816e5525cd8b8e24082d94c457739086a44088eccdb5331
MD5 68783589bccf724497b399b11b45e3a0
BLAKE2b-256 b88adddddd536fb5bf13e06cbccce72042de307ab2b9246cdea8849825a34263

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