Skip to content
emch04Public

About

Astratra: a framework and a set of SDKs for building apps with AI built in.

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Astratra

English | FranΓ§ais

npm Licence: MIT XERJ Corpus Hub contributor Powers Humalis

Astratra is a framework and a set of SDKs for building apps with AI built in.

It is both, and the difference is who is in charge:

  • The framework. createSaasApp() (@astratra/saas-kit) assembles the whole application β€” sign-in, sessions, CSRF, accounts, errors β€” and calls your code at the places it provides (extendRoutes, verifyPassword, the stores). create-astratra-app sets the shape of a new project.
  • The SDKs. Packages that talk to a service for you, such as the client of the local model service in @astratra/models.
  • The building blocks. Libraries you call yourself, with no structure imposed: @astratra/security, @astratra/client, @astratra/ai, @astratra/ledger and the others.

They ship as independent npm packages for SaaS back ends and web or mobile front ends: users, roles, sessions, security middleware, persistence adapters, a dashboard, and the common pieces behind AI assistants, payments, accounting, booking and mobile apps.

Each package does one job and takes its dependencies by injection: a store, a transport, a model, a clock, a key source. Your application decides the business rules, the database and the providers; Astratra supplies the parts that are the same from one project to the next.

Astratra and Humalis

Humalis is a programming language written in French, by the same author. The servers it produces are built on Astratra: @astratra/saas-kit, @astratra/security and @astratra/store-postgres for sign-in, sessions and storage, and @astratra/prerender for its websites. A Humalis app is therefore an Astratra app, written as sentences.

Who it is for

  • Developers starting a SaaS, an internal tool or an MVP who want a solid base instead of rewriting authentication, rate limiting, roles and settings.
  • Teams that already have an application and want to adopt one package at a time, for example the audit log, the webhook pipeline or the AI router.

What it is not

  • It is not a finished application. You still write your domain model, your screens and your product rules.
  • It is not a hosted service and does not run anything for you.
  • It is not a security audit, a compliance framework or legal advice. The security packages reduce common risks; they do not remove the need for a review of your own application.
  • It does not impose a role model. Roles are plain strings supplied by your project.

Requirements

  • Node.js 22 or later (CI runs on 22.x and 24.x).
  • Express 4 or 5, for the packages that mount routes or middleware (@astratra/saas-kit, @astratra/credentials, @astratra/wallet, @astratra/agent, @astratra/security). The repository installs Express 5; CI also runs their tests with Express 4.
  • npm workspaces: the repository root is an npm workspace.
  • Docker, only for @astratra/testkit (throwaway MongoDB or PostgreSQL containers).

Quick start

Create a full application (API, web dashboard, authentication, roles, settings, notifications):

npm create astratra-app@latest my-app
cd my-app
npm install
npm run dev:api
npm run dev:web

Create an API only:

npm create astratra-app@latest my-api -- --template api

Add optional building blocks at generation time with --with, for example --with payments,privacy,notify, or --with all. Without --with, the project is exactly the same as before.

Installing packages in an existing project

Each package is published on its own. Install only what you use:

npm install @astratra/core @astratra/security
npm install @astratra/saas-kit @astratra/store-postgres pg
npm install @astratra/ai

Every package has a README with its installation, a minimal example, its main options and what it does not do. The table below links to them.

Packages

The 44 packages in packages/ are all published under the @astratra scope, except create-astratra-app, which is published under its own name. Versions are the ones in each package.json; the history of every package is in CHANGELOG.md.

Foundations and security

Package Version What it does
@astratra/core 1.3.0 API responses, errors, logs, request IDs, environment configuration, Google service account access tokens, uploads, request validation chains
@astratra/security 1.15.1 JWT and RBAC, rate limiting (memory or Redis), CSP, heuristic WAF, WebAuthn passkeys, HMAC between services, chained audit log
@astratra/credentials 1.2.1 Encrypted service keys stored in your database, editable from the interface without a restart
@astratra/entitlements 1.1.0 Plans, features, billing and status guards, tenant isolation that fails closed, invitations by link, AI quotas and budgets
@astratra/flags 1.1.0 Deterministic feature flags and experiments: targeting, gradual rollout, OpenFeature-compatible provider
@astratra/privacy 1.1.0 Right of access, right to erasure with human approval, anonymisation, log redaction
@astratra/resilience 1.2.0 Circuit breaker, TTL cache that degrades instead of failing, retry with jitter, cluster job lock
@astratra/i18n-server 1.1.0 Translation of API messages, locale resolution, readability audit of error messages

AI

Package Version What it does
@astratra/ai 2.0.1 Multi-provider AI routing with quotas and fallback, tool registry, agent loop, risk levels with confirmation, local llama.cpp provider
@astratra/agent 1.4.2 Durable tasks, budgets, plans, completion checks, context summaries, consumption tracking, user feedback (πŸ‘/πŸ‘Ž), a timed task scheduler and an approval queue for proposed actions
@astratra/models 1.3.1 Local CPU model service (embeddings, reranking, NLI, entities, speech-to-text) and its Node client; price catalogue and cost calculation
@astratra/conscience 1.5.2 Documented memory of an agent's decisions (outcomes, corrections, lessons with evidence, self-model, lineage, erasure) under a deterministic governor without any language model
@astratra/memory 2.1.1 Per-person memories for an assistant: hybrid recall, duplicate merging, undoable corrections, PostgreSQL store
@astratra/rag 1.1.0 Document retrieval: chunking, injected embeddings, hybrid search, source verification, document reading through an optional service
@astratra/voice 1.2.0 Server-side text-to-speech (Piper, ffmpeg), versioned caches, provider chain with key rotation, local transcription
@astratra/live 1.1.1 Real-time voice call sessions and client protocol helpers
@astratra/app-guide 1.1.0 Role-aware in-app guide generated from the screen configuration, with coverage checks
@astratra/repomap 1.1.0 Weighted symbol map of a repository, for exploring code within a token budget
@astratra/web-search 1.2.1 Web search for agents: several engines with fallback, rank fusion without content mixing (one entry = one page = one site), verbatim passages, SSRF-safe page reading, an isolated integrated browser (JavaScript pages, links, site search), tool definitions and an MCP server

Business logic

Package Version What it does
@astratra/payments 1.2.0 Payment webhook pipeline: raw-body signature checks, replay protection, provider-safe responses
@astratra/shipping 1.2.0 Shipping labels without the traps: carrier contract, Sendcloud adapter (labels, service points, tracking), signed tracking webhook with replay protection, free test mode
@astratra/ledger 1.1.0 Double-entry accounting: balanced, immutable entries, sequential numbering, period closing, reconciliation, OHADA charts of accounts
@astratra/booking 1.1.0 Appointment slot engine without a database: availability, exceptions, time zones, capacity, atomic booking through an injected store
@astratra/collab 1.1.0 Real-time collaborative editing: Hocuspocus server wired to your authentication, Yjs snapshots, named versions
@astratra/srs 1.1.0 Spaced repetition on FSRS: cards, grading, due dates, daily queue, statistics
@astratra/fhir 1.1.0 FHIR R4 helpers on the official Medplum types: minimal validation, references, builders
@astratra/loyalty 1.1.0 Stamp cards and monthly-quota passes, computed without a database
@astratra/wallet 1.2.1 Apple Wallet and Google Wallet passes kept up to date (loyalty cards, event tickets, boarding passes): signing, web service, add-to-wallet links, removal
@astratra/pdf 1.1.0 PDFKit layout primitives: text that fits its box, paginated tables, card sheets with vector QR codes
@astratra/mcp 1.0.0 Model Context Protocol with no dependency: client, server, stdio and Streamable HTTP; Origin check, size and time limits; speaks with the official SDK
@astratra/qr 1.0.0 QR codes with no dependency, Node and browser: all modes, L/M/Q/H, versions 1 to 40, best mask; SVG, PNG, data URL
@astratra/s3 1.0.0 S3 client with no dependency (AWS S3, R2, MinIO, SeaweedFS): objects, ranges, streams, lists, batch delete, presigned GET and PUT; SigV4 with node:crypto
@astratra/closure 1.1.0 Period closing checklist with blocking and acknowledged items, and an archive free of credentials
@astratra/notify 1.3.0 Outbound e-mail, SMS and push: injected transport, header-injection safe, never throws; Web Push and APNs without SDK

Web and mobile

Package Version What it does
@astratra/saas-kit 2.1.1 Backend starter: createSaasApp() assembles users, authentication, settings, notifications and dashboard routes
@astratra/store-mongo 1.2.0 MongoDB (Mongoose) persistence adapters for the SaaS stores
@astratra/store-postgres 1.2.0 PostgreSQL (pg) persistence adapters for the SaaS stores
@astratra/saas-kit-ui 1.5.0 React dashboard for @astratra/saas-kit, πŸ‘/πŸ‘Ž feedback bar
@astratra/react 1.1.0 Bare React primitives for sessions, permissions and API calls, without an imposed dashboard
@astratra/client 1.2.0 Framework-agnostic client plumbing: refresh on 401, route guard, password rules, offline queue
@astratra/prerender 1.1.0 SEO prerendering for Vite and React sites: one HTML file per route, sitemap from the same list
@astratra/native 1.1.0 Mobile plumbing: keychain session, biometric gate, push registration, payment return
@astratra/native-ui 1.3.0 UI kit for React Native and Expo, with pure logic testable in Node, πŸ‘/πŸ‘Ž feedback bar
@astratra/app-version 1.1.0 Announcements of new mobile builds: public version route, one announcement per version
create-astratra-app 1.12.2 Project generator: full stack, API only, or Expo app, with optional building blocks

Monitoring and tooling

Package Version What it does
@astratra/tooling 1.7.1 Workspace audit (secrets, routes, translations), test runner, deployment with rollback, app publishing, AI evaluation
@astratra/testkit 2.0.0 Security tests with no dependency (fuzzing, attack catalogue, ReDoS, resource bombs, differential, standard vectors, constant time, secrets in logs, authorization matrix, races, faults, mutations, lockfile), disposable MongoDB or PostgreSQL test databases, reproducible per-country fake data, guard against production databases

The example examples/dashboard-ui shows @astratra/saas-kit-ui against the saas-kit API. It is not published.

Principles

  • Injection, not assumptions. Stores, transports, models, providers, keys and clocks are passed in. A package never hard-codes your database, your mail provider or your AI vendor.
  • Security as a constraint. Security-sensitive packages document their defaults in their README, and each package says how it handles secrets.
  • Stable 1.x contracts. All packages are at version 1.x or later. A minor version adds without breaking; a major version changes behaviour and is described in CHANGELOG.md.
  • Independent packages. Each package has its own version and its own dependencies. You install the ones you need; none forces another on you except through a declared dependency.
  • Tested and verified. The continuous integration runs lint, typecheck, all workspace test suites, and installs every published package in a clean project.

Limits of the current version

  • There is no generic SQL adapter (MySQL, SQLite) and no migration tool. The MongoDB and PostgreSQL adapters are the two real persistence adapters.
  • The agent loop in @astratra/ai does not handle images (vision). Human confirmation by risk level and token streaming are supported.
  • The WAF in @astratra/security is a heuristic layer. It does not replace parameterised queries, context-aware output encoding or a network WAF.
  • WebAuthn passkeys are an integration primitive; the credential store is an interface without a provided implementation.
  • Astratra does not provide encryption at rest for your whole database (only service keys stored by @astratra/credentials are encrypted), nor a centralised security log. Your project decides what its compliance needs.

Contributing

See CONTRIBUTING.md for setup, tests, lint, versioning and pull requests. To report a vulnerability, see SECURITY.md; please do not open a public issue for it.

Development

npm install
npm test --workspaces
npm run lint
npm run typecheck

Publishing rules (versions, order, checks) are in docs/PUBLISHING.md.

Repository layout

.github/workflows/   continuous integration (lint, typecheck, tests, package installation)
packages/            the 43 published packages, one directory each
examples/            the unpublished dashboard example
scripts/             publication script and package installation check
docs/                publishing rules, design notes, guides

License

MIT. Copyright (c) 2026 Astratra contributors.

About

Astratra: a framework and a set of SDKs for building apps with AI built in.

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages