No project description provided
Project description
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file teo-0.3.4.tar.gz
.
File metadata
- Download URL: teo-0.3.4.tar.gz
- Upload date:
- Size: 141.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab9b6c14653c038e38d6d0c440a6d9fa0a864a92e69daf9a7b0c7b51efbd6e80 |
|
MD5 | 227aedbb38a664b42e25d2f594271618 |
|
BLAKE2b-256 | 2af40b1273db48e5f3f3396a3e9c37da29ff2e580c984c1c15ce7ba0bec87fc2 |
File details
Details for the file teo-0.3.4-cp312-none-win_amd64.whl
.
File metadata
- Download URL: teo-0.3.4-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4aaa202dabb16bd8abae977786a5741001e75c00e76426bc07a0728aa7aac410 |
|
MD5 | d4640d07d0bae80747e7391f61fb0682 |
|
BLAKE2b-256 | 4f57e40c317e56a7feee6b5f337338d5bc99541355823d7331b5a20f60ecda10 |
File details
Details for the file teo-0.3.4-cp312-none-win32.whl
.
File metadata
- Download URL: teo-0.3.4-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d4fc09644b14cccb63244697ab1e1e02820b36453b1cdec4eef9f4722fd6441 |
|
MD5 | 469584a8e5bd2da53938e9cd7197e135 |
|
BLAKE2b-256 | bd007bc3cec88efca3540a59ccc9d95f5a3651ccd1c62326e9936bf6a07b76c3 |
File details
Details for the file teo-0.3.4-cp312-cp312-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: teo-0.3.4-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 18.5 MB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 245bef495e79f83206059b70bc2db44f5a6e9179e96db8c9f28dfd9c84a33797 |
|
MD5 | 9666f12e2f5ba466fbf96349b2b801ed |
|
BLAKE2b-256 | 1ee8b1dffd6ae52b72e74037ba7fdf4eee0f3c59e1f5353ab292139620a16424 |
File details
Details for the file teo-0.3.4-cp312-cp312-manylinux_2_28_armv7l.whl
.
File metadata
- Download URL: teo-0.3.4-cp312-cp312-manylinux_2_28_armv7l.whl
- Upload date:
- Size: 17.1 MB
- Tags: CPython 3.12, manylinux: glibc 2.28+ ARMv7l
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c91558974c6e89f73581aefa9fe67bf94c060ab55223f691f749921bc21cb00a |
|
MD5 | 3fad6fccb6adc2f3462e527f12e53a23 |
|
BLAKE2b-256 | bb0b426860dfbe36cb2e1963e4c785326e4a0ebd0c8877c679ed44bf750ea191 |
File details
Details for the file teo-0.3.4-cp312-cp312-manylinux_2_28_aarch64.whl
.
File metadata
- Download URL: teo-0.3.4-cp312-cp312-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 18.1 MB
- Tags: CPython 3.12, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67dbcd8b745469c8c8b9dace1c8c31eee4e676144e6d41053948a3b1d7831c61 |
|
MD5 | 53b96b99226848abca518950de8573ad |
|
BLAKE2b-256 | 016c15a071c953ab007e098f6420a16f44102233ec60d6f35eaf08b5e835e72d |
File details
Details for the file teo-0.3.4-cp312-cp312-macosx_11_0_arm64.whl
.
File metadata
- Download URL: teo-0.3.4-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 14.5 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49522635bc2b76273328c4b95915e106e3ff773a4d807c42776976e2157760e8 |
|
MD5 | 6564ea3272601d822aa90d4a121933b4 |
|
BLAKE2b-256 | aa4a7ff9b6956a38b54e19bdfb080efddc39a964c4533b6150c03fe61c0a499c |
File details
Details for the file teo-0.3.4-cp312-cp312-macosx_10_12_x86_64.whl
.
File metadata
- Download URL: teo-0.3.4-cp312-cp312-macosx_10_12_x86_64.whl
- Upload date:
- Size: 15.3 MB
- Tags: CPython 3.12, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f02620518424667cbaa424c428d4d279b332b0ce157b7f67b2ffebccc5da98f9 |
|
MD5 | 9640930b30220da9ca4048f3cfbbf435 |
|
BLAKE2b-256 | 75ad3d523cf2a066068abb2fc1e2daa3ce05c945d4345664d23b7af2d9e56042 |