Next saas-starter
⚡️ Free Next.js responsive landing page template for SaaS products made using JAMStack architecture.
Implement Flamework remotes with classes
🌉flamework-gateways-mod🌉
🌉 Gateways - Handle remote events and functions with classes
🛡️ Guards - Block certain requests before they are processed
📞 Pipes - Transform and validate parameters passed to requests
This is mainly a personal project to handle remotes with classes and decorators.
"typeRoots": ["node_modules/@rbxts", "node_modules/@flamework"],
npm install @flamework/[email protected]odding
npm install -D [email protected]
npm install @rbxts/flamework-gateways-mod
connectServer
and connectClient
should be called before igniting Flamework.
Do note that guards & pipes will not be applied to external listeners like .on
, .wait
, etc.!
type ServerGateway = OneGateway & AnotherGateway;
const server = connectServer<ServerGateway, ClientGateway>();
server.emit("clientEvent", players, ...args);
server.broadcast("clientEvent", ...args);
type ClientGateway = OneGateway & AnotherGateway;
const client = connectClient<ServerGateway, ClientGateway>();
client.emit("serverEvent", ...args);
client.request("serverInvoke", ...args).catch(...);
Gateways should be added to Flamework.addPaths()
@Gateway({
guards: [new AdminGuard(["littensy"])],
})
class AdminGateway {
constructor(private readonly adminService: AdminService) {}
@OnEvent()
@UseGuards(CommandDebounceGuard)
@UsePipes([], CommandPipe)
async processCommand(player: Player, message: string | Array<string>) {
this.adminService.runCommand(player, message as Array<string>);
}
@OnInvoke()
async getCommands() {
return this.adminService.getCommands();
}
}
Creatable guards
class AdminGuard implements CanActivate {
constructor(private readonly admins: Array<string>) {}
canActivate(context: ExecutionContext) {
return this.admins.includes(context.getPlayer().Name);
}
}
Singleton guards should be added to Flamework.addPaths()
@Guard()
class CommandDebounceGuard implements CanActivate {
constructor(private readonly roduxService: RoduxService) {}
canActivate(context: ExecutionContext) {
const state = this.roduxService.getState();
return time() >= state.commandDebounce;
}
}
Creatable pipe
class CommandPipe implements PipeTransform {
transform(value: unknown) {
assert(typeIs(value, "string"), "(CommandPipe) Value must be a string");
return value.split(" ");
}
}
Singleton pipes should be added to Flamework.addPaths()
❌ Client-side RemoteFunctions are not supported
❌ Some type limitations
Input | Output
in the parameter type to keep track (see examples).⚡️ Free Next.js responsive landing page template for SaaS products made using JAMStack architecture.
Non-blocking PostgreSQL client for Node.js written in TypeScript.
Fast and lightweight JavaScript game engine built on WebGL and glTF
IOS Android Web cross platform app for real time collaborative music listening session and playlist editing. Using...
A social media platform to create communities and make friends
My solutions for Advent of Code in various languages
Vue is a JavaScript framework for building websites. The...
TypeScript is an open source programming...
React Native is a JavaScript mobile framework developed...
React (also known as React.js or ReactJS) is a JavaScript...
Python is a dynamically typed programming language...
PHP is a popular general-purpose scripting language...
Node.js is a tool for executing JavaScript in a variety...
iOS is the operating system for all of Apple’s mobile...
Released in 2016, Angular is a rewrite of AngularJS. It...
Android was designed and built by Google in 2008. The...