Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SKLIDE

License: MIT Python 3.12 FastAPI PostgreSQL React Tests

An AI productivity platform with a security-first, multi-tenant backend — where the deterministic engine owns correctness and the AI is a governed, advisory layer that can explain a plan but never make it infeasible or overspend.

Status: MVP complete and demonstrable end-to-end. 114 passing tests against real Postgres + Redis (testcontainers); CI gates: ruff, mypy (strict), import-linter, and an RLS coverage gate. Built backend-first, security-first, one reviewed batch at a time.


What it does

Register → Login → Project → Goal → AI decompose → review & accept tasks
        → deterministic plan → AI analysis → dashboard & analytics

A user creates a goal, the AI proposes a task breakdown (advisory, validated), the user accepts it into real tasks, the deterministic scheduler turns open tasks into a feasible day-plan (with explicit overflow), and the AI writes an advisory analysis (summary, risks, focus) — all surfaced on a themed, responsive dashboard.

Features

  • Auth — register / login / refresh / logout / logout-everywhere; EdDSA JWTs with token-version revocation; Argon2id; rotating refresh tokens with reuse detection.
  • Organizations, Projects, Goals, Tasks — full CRUD, tenant-isolated, with goal↔task links and computed goal progress.
  • AI goal decomposition — goal → proposed tasks through a governed gateway; advisory, validated, explicitly accepted (idempotent), with auditable provenance on created tasks.
  • Deterministic planner — capacity-bounded, total-ordered (due date → priority → id), no double-booking, nothing dropped silently (overflow + reason); pinned scheduler_version.
  • AI plan analysis — deterministic risk detection (overdue / overflow / near-deadline / high-priority unscheduled) + an advisory AI narrative; never mutates the plan.
  • Dashboard & analytics — computed productivity metrics + an AI-insights panel.
  • Frontend — React/TS SPA: protected routing, token-refresh, dark/light mode, responsive.

Technical highlights

  • Database-enforced multi-tenancy. PostgreSQL Row-Level Security (ENABLE + FORCE) on every tenant table, with a three-role model (aurio_owner migrations, aurio_app runtime NOBYPASSRLS, aurio_maint BYPASSRLS for system-only). A CI coverage gate fails the build if any organization_id table lacks a policy — isolation can't regress by omission.
  • No broad bypass in the request path. Pre-tenant lookups (login, membership, refresh) go through narrow, audited SECURITY DEFINER functions; composite foreign keys make cross-org references impossible at the DB.
  • Fail-closed everywhere — missing tenant context, downed Redis, unverifiable membership all deny; AI output is untrusted and deterministically validated before use.
  • AI cost governance. Every LLM call passes one gate: atomic estimate → reserve → reconcile (Redis Lua) against per-org and per-user caps, then an immutable usage line item — overspend is structurally impossible, and the gateway is the only seam allowed to touch a provider SDK (enforced by import-linter).
  • The LLM proposes; the engine disposes. The scheduler is pure integer-minute arithmetic with a total order and a pinned version — replayable and testable; the AI is advisory.
  • Tested against the real thing — testcontainers spin real Postgres + Redis; migrations, RLS, JWT, budget gate, and every endpoint are exercised end-to-end.

Tech stack

Backend FastAPI · SQLAlchemy 2 (async) · asyncpg · Alembic · PostgreSQL 16 · Redis · Pydantic · PyJWT (EdDSA) · Argon2 · structlog. Frontend React 18 · TypeScript · Vite · TanStack Query · Zustand · Tailwind · React Router. Infra/quality Docker Compose · uv · ruff · mypy (strict) · import-linter · pytest + testcontainers.

Quick start

cp .env.example .env          # fill in real secrets
docker compose -f infra/compose/docker-compose.prod.yml --env-file .env up -d --build
docker compose -f infra/compose/docker-compose.prod.yml --env-file .env run --rm seed
# open http://localhost  ·  login: demo@sklide.app / demo-password-123

Demo script (≈3 min)

  1. Register / log in → land on the dashboard (dark/light toggle, responsive).
  2. Projects → create "Launch SKLIDE v1".
  3. Goals → create "Reach private beta" (target date, link to the project).
  4. Goal detailDecompose → review proposed tasks → Accept → real tasks created.
  5. Tasks → mark a couple done (status flows into metrics).
  6. Plans → generate a plan (allocations + overflow) → Analyze → advisory summary.
  7. Dashboard / Analytics → live counts, planned-vs-completed minutes, goal progress, AI insights.

Seeded demo data shows all of this immediately. Live AI decompose/analyze call Claude when ANTHROPIC_API_KEY is set (via the wired Anthropic adapter); without a key they fail closed with 503 and the seed's canned AI output still drives the full demo.

Screenshots checklist

Capture for the portfolio (light + dark): Login · Dashboard (with AI insights) · Projects · Goals list · Goal decomposition review · Tasks · Plan (allocations + overflow) · Plan AI analysis · Analytics. Add under assets/screenshots/ and embed here.

Project structure

backend/   FastAPI app (modules: identity, auth, audit, projects, goals, ai, planner,
           analytics), migrations, tests, scripts/seed_demo.py
frontend/  React/TS SPA (lib, stores, api hooks, components, pages)
infra/     docker images (api, web), compose (dev + prod), postgres initdb (roles/RLS fns)

Testing & quality

cd backend && uv run pytest -q          # 114 tests · real Postgres + Redis
uv run ruff check . && uv run mypy app && uv run lint-imports
cd frontend && npm run build            # strict tsc + production bundle

Status & roadmap

Solid — database-enforced tenant isolation (RLS + CI gate), fail-closed auth, the AI budget gate, the deterministic planner, and 114 tests against real Postgres + Redis. Tracked debt — live-API evaluation of the wired AI adapter, a durable (Postgres) budget ledger backing the Redis gate, and moving scheduled work onto Celery workers.

Resume bullets

  • Built a multi-tenant SaaS backend (FastAPI / async SQLAlchemy / PostgreSQL) with database-enforced tenant isolation via Row-Level Security and a CI coverage gate that fails the build if any org-scoped table lacks a policy.
  • Designed a fail-closed auth system — EdDSA JWTs with token-version revocation, Argon2id, refresh-token rotation with family reuse detection, and credential lookups via narrow SECURITY DEFINER functions (no broad BYPASSRLS in the request path).
  • Implemented an AI cost-governance gateway: an atomic estimate→reserve→reconcile budget gate (Redis Lua) enforced before every LLM call, with per-org/per-user caps, table-driven model routing, and immutable per-call usage metering.
  • Built a deterministic, versioned scheduling engine (integer-minute, total-ordered, explicit overflow) and a separate advisory AI layer that explains plans without making them infeasible.
  • Shipped a React/TypeScript SPA (TanStack Query, Zustand, Tailwind) with token-refresh interceptors, protected routing, and dark mode.
  • Wrote 114 tests against real Postgres + Redis (testcontainers) with strict mypy, ruff, and import-linter contracts in CI.

About

Security-first, multi-tenant AI productivity platform: PostgreSQL row-level security, a governed AI cost/budget gateway, and a deterministic scheduling engine. FastAPI · async SQLAlchemy · React/TypeScript.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages