The TypeScript native cloud.

Replace Express, Mongo, Postgres, Kafka, S3, Socket.io, Auth0 and more with standard APIs already built into TypeScript.



Use APIs you already know

Rather than adding new opinionated APIs for functionality like persistence, streaming and blob storage, Freestyle leverages the APIs already built into ecmascript standards.

TypeScript is The Database

Put @cloudstate on any class and it's properties will be stored forever and available in any request.


@cloudstate
class CloudEmailList {
  emails: string[] = [];
  add(email: string) {
    this.emails.push(email);
  }
  list() {
    return this.emails;
  }
}

Own your infrastructure

Freestyle is built to encourage open source collaboration. Rather than relying on external services for things like authentication, Freestyle provides a foundation that full stack packages can be built on top of.

Authentication

Instead of using an auth provider like Auth0, you can use our open source freestyle-auth package.


import { PasskeyAuthentication } from "freestyle-auth";

@cloudstate
class AuthenticationCS extends PasskeyAuthentication {
  static id = "auth" as const;

  override _createUser() {
    return new UserCS(crypto.randomUUID(), "", "");
  }
}

@cloudstate
export class UserCS {
  constructor(
    public id: string,
    public username: string,
    public image: ImageCS,
    public displayName?: string
  ) {}

  _assertSelf() {
    const auth = useLocal(AuthenticationCS);
    const user = auth.getCurrentUser();
    if (user !== this) throw new Error("You do not have permission for this operation.");
  }

  setDisplayName(displayName: string) {
      this._assertSelf();
      this.displayName = displayName;
    }
  }
}

import { PasskeyAuthenticationModal } from "freestyle-auth/react";

export function SignInPage() {
  const auth = useCloud<typeof AuthenticationCS>("auth");
  return (
    <PasskeyAuthenticationModal
      auth={auth}
      onSignedIn={() => {
        window.location.href = "/dashboard";
      }}
    />
  );
}

Deploy your entire stack in 1 command.

All pure TypeScript. No config needed.

computer:~$

npx freestyle deploy


Everyone is now a cloud engineer.

Use native TypeScript APIs everywhere, instead of integrating cloud boilerplate, so you can finally focus on writing business logic.

© 2024 Freestyle