Authentication
inside your app.
Email/password or OIDC sign-in, sessions and API keys. One Rust runtime, embedded in your existing server.
cargo add syntropika-stargate --rename stargatenpm install @syntropika/stargatepython -m pip install syntropika-stargateGo links to the Rust C ABI. Build from source
- Runtime
- Rust
- Storage
- Turso
- Integrations
- 4 languages
- License
- Apache 2.0
Your server.
Your identity.
Mount Stargate in your application. Your application owns the HTTP server, TLS and configuration. Authentication stays close to the code it protects.
- Sign in, your way.
- Local email/password accounts, your OIDC provider, or both. Keep the choice inside your application.
- Give every key a purpose.
- Scoped API keys with expiration and revocation. Secrets are shown once and stored as hashes.
- A place for every account.
- An embedded panel for profiles, keys, sessions and administrator user management, with configurable branding.
One runtime.
Your stack.
The same authentication logic, whether you build with Axum, Express, FastAPI or net/http.
Explore the integrationsYour applicationserver.rs
use axum::{routing::get, Router};
use stargate::{
AuthConfig, LocalConfig, Policy, Stargate,
StorageConfig, TursoConfig,
};
let mut config = AuthConfig::new(
"https://app.example.com".parse()?,
StorageConfig::Turso(TursoConfig::new("./stargate.db")),
);
config.local = Some(LocalConfig::default());
let auth = Stargate::new(config).await?;
let private = Stargate::require(
Router::new().route("/private", get(|| async { "private" })),
Policy::Authenticated,
);
let app = auth.mount(Router::new().merge(private));Your applicationserver.ts
import express from 'express';
import { createAuth, turso } from '@syntropika/stargate';
const app = express();
const auth = await createAuth({
baseUrl: 'https://app.example.com',
storage: turso('./stargate.db'),
local: {},
});
app.use(auth.middleware());
app.get('/private', auth.required(), (req, res) => {
res.json({ user: req.stargateIdentity.user_id });
});Your applicationserver.py
from fastapi import FastAPI
from stargate import Auth, Local, Turso
app = FastAPI()
auth = Auth(
base_url="https://app.example.com",
storage=Turso("./stargate.db"),
local=Local(),
)
auth.mount(app)
@app.get("/private")
@auth.required()
async def private(user):
return {"user": user.id}Your applicationserver.go
import (
"net/http"
stargate "github.com/syntropika/stargate/packages/go"
)
auth, err := stargate.New(stargate.Config{
BaseURL: "https://app.example.com",
Storage: stargate.Turso("./stargate.db"),
Local: &stargate.LocalConfig{},
})
if err != nil { return err }
defer auth.Close()
mux := http.NewServeMux()
mux.Handle("/auth/", auth.Handler())
mux.Handle("/private", auth.Require(http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("private"))
},
)))