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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.12 Windows x86-64

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

Uploaded CPython 3.12 Windows x86

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

Uploaded CPython 3.12 manylinux: glibc 2.28+ ARMv7l

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

Uploaded CPython 3.12 manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.12 macOS 11.0+ ARM64

teo-0.3.0-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.0.tar.gz.

File metadata

  • Download URL: teo-0.3.0.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.0.tar.gz
Algorithm Hash digest
SHA256 e4f60dbf080f24f23cc92b22e557b4c36a550df759dc29f099d224f7c2b075fa
MD5 aae4602587208ec7275dda6dcf43f358
BLAKE2b-256 8018b12fcee0553ebe3b8f36d2b718de15474b76b147fd7410c747c32aaf322a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: teo-0.3.0-cp312-none-win_amd64.whl
  • Upload date:
  • Size: 14.8 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.0-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 ddda7d62027c61b101a4864da759f4aab81836d09ec6311fdc9d2ff0efaf09c6
MD5 9d2b0dccb9f5b3427556c6f1f68c6d02
BLAKE2b-256 b91a9352e3d5352ad6e9e53849952135b1d46afe00dac719fb8b3303dc2570bd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: teo-0.3.0-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.0-cp312-none-win32.whl
Algorithm Hash digest
SHA256 982eec4fcf55ff7a46ec4f5b3a5970891f5c9329be1e9a4ba9c590acf5994caf
MD5 97f9d3b284aaede5fb42f116ace3e4ca
BLAKE2b-256 569d4848e81e59e98e62937899d497ac31362fa0967c00caad45d8b8c718d7b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teo-0.3.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ad73a12e6eb9d3719ce252147f34f9006d4ffc6aaa3cc1838b7740b4de5a3b17
MD5 93fc16682af6836446e2704678636f31
BLAKE2b-256 614d1f8805e9cf90ed714e4e9c03ee352880626fda25936a765f7a1ad27c42cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teo-0.3.0-cp312-cp312-manylinux_2_28_armv7l.whl
Algorithm Hash digest
SHA256 0dc5d44911647a216a31a9fe85a9a2d8b7145e399432b1f1c172052db69d4f06
MD5 c68df292048b71bfe3707adf96049add
BLAKE2b-256 24ebd13f54f1c85c5597ba6bb60f1547d5ad476c38436467ef18469351ce8193

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teo-0.3.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d505bb26dd29a4ae19e2f81f298916e9909345bcc914babfb4b2fca2f4a0dc53
MD5 acfc892c654e9aa009fdadbb84289f49
BLAKE2b-256 0b11367b590020f1e42deab62ecd912203bb925b3575b4792737f0530d9323b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teo-0.3.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 100b8ae66da3d08bbe5fdffdc1362bb86c5070a3ddb96cb256265ce1b7562c66
MD5 9d01fb06fcd0e3cbf69f1da9e38a2cd4
BLAKE2b-256 1d8b93ea1ff23763e8e5428e19b3427aceab2ec6a6efe37b92a4df853de42b2b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teo-0.3.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 dd4e65f538651e7939b6f4276143a2cfec87713a3902e3720069c12cf546f9a1
MD5 b10f2b4751d490c90c5933b6fc13aa63
BLAKE2b-256 b5ec72274f8cc1a6dd6e8cf2f621dd52c5f25a383fec91a2962726199d88423e

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