10 releases
new 0.3.1 | May 20, 2025 |
---|---|
0.3.0 | May 20, 2025 |
0.2.7 | May 19, 2025 |
0.1.0 | Mar 20, 2025 |
#233 in Command line utilities
964 downloads per month
135KB
3K
SLoC
Kinetics
Kinetics is a hosting platform for Rust applications that allows you to deploy all types of workloads by writing only Rust code.
#[endpoint(
url_path = "/path",
environment = {"SOME_VAR": "SomeVal"},
)]
pub async fn endpoint(
_event: Request,
_secrets: &HashMap<String, String>,
) -> Result<Response<Body>, Error> {
let resp = Response::builder()
.status(200)
.header("content-type", "text/html")
.body("Hello!".into())?;
Ok(resp)
}
Check out more examples here. Including REST API endpoints, queue workers, and cron jobs.
Features
🦀 Only Rust code required
Just apply attribute macro to your function, and Kinetics will handle the rest. No other tools required.
🚀 Supports any workload
Deploy REST API endpoints, queue workers, and cron jobs.
🏕️ Works offline
Test your functions locally with no connection to the internet. We mock DB as well, so all requests to DB also work locally. No configuration required.
💿 Comes with DB
Seamlessly provision KV DB if your workload needs a persistent storage.
🔑 Secrets
Automatically provision secrets from .env.secrets
file.
📚 Real time logs Monitor your functions with just CLI.
🤖 No infrastructure management
The infrastructure is provisioned automatically, e.g. a queue for the worker workload.
🌍 CDN
REST API endpoints are served through a Content Delivery Network (CDN).
Try it
# 1. Install
cargo install kinetics
# 2. Login or sign up
kinetics login <email>
# 3. Apply one of attribute macro
# E.g. add #[endpoint()] to your function
# 4. Test locally
# View all resources first to get the full name of your function. Run in the dir with the project.
kinetics list
kinetics invoke FullyQualifiedFunctionName \
--payload '{"param": "value"}' \
--headers '{"Authorization": "Bearer *"}' \
--table mytable
# 5. Deploy
# Run in the dir of your crate
kinetics deploy
Kinetics is currently in ⚠️ active development and may contain bugs or result in unexpected behavior. The service is free for the first 100,000 invocations of your functions, regardless of the type of workload.
If you have any issues, please contact us at support@usekinetics.com.
Documentation
All configuration can be done through attribute macro parameters, or through modifications to existing Cargo.toml
file in your project. All types of workloads support environment variables. These can be changed without redeploying (this feature is WIP).
Endpoint
The following attribute macro parameters are available:
url_path
: The URL path of the endpoint.environment
: Environment variables.
Worker
Attribute macro parameters:
concurrency
: Max number of concurrent workers.fifo
: Set to true to enable FIFO processing.environment
: Environment variables.
Cron
Attribute macro parameters:
schedule
: Schedule expression.environment
: Environment variables.
Secrets
Store secrets in .env.secrets
file in the root directory of your crate. Kinetics will automatically pick it up and provision to all of your workloads in the second parameter of the function as HashMap<String, String>
.
Example:
# .env.secrets
API_KEY=your_api_key_here
#[endpoint()]
pub async fn endpoint(
event: Request,
secrets: &HashMap<String, String>,
) -> Result<Response<Body>, Error> {
println!("API key: {}", secrets.get("API_KEY").unwrap());
Database
Database is defined in Cargo.toml
:
[package.metadata.kinetics.kvdb.test]
# You will need this name to connect to the database
# If not defined then the resource name from above will be used as DB name
name = "test"
Connect to the database (we provision AWS DynamoDB) using the name defined in Cargo.toml
:
#[endpoint()]
pub async fn endpoint(
event: Request,
secrets: &HashMap<String, String>,
) -> Result<Response<Body>, Error> {
let config = aws_config::load_defaults(aws_config::BehaviorVersion::latest()).await;
let client = Client::new(&config);
client
.get_item()
.table_name("test")
.key("id", AttributeValue::S("id"))
.send()
.await?;
Commands
kinetics login
- Log in with emailkinetics invoke
- Invoke function locallykinetics deploy
- Deploy your applicationkinetics destroy
- Destroy application and all of its resourceskinetics logout
– Log out the current userkinetics logs
- View application logs [Coming soon]
Support & Community
- support@usekinetics.com. Help with builds, deployments, and runtime.
- GitHub Issues. Persistent bugs, and feature requests.
Dependencies
~39–56MB
~885K SLoC