CodeSquared lets you ship fast by programatically generating
frontend code from your API definition
We have created generators for popular TypeScript libraries to help you get started fast. You can use them immediately, customize them or combine them to create your perfect generator stack.
Want to see a generator added? Drop us an email at support@codesquared.com
v0.0.59
Last updated 4 weeks ago
v0.0.33
Last updated 4 weeks ago
v0.0.20
Preparing to ship
v0.0.11
Preparing to ship
v0.0.19
Shipping soon
export class GetFetch extends OperationInsertable {constructor({ context, operation, settings }: OperationInsertableArgs) {super({ context, operation, settings })this.createAndRegisterDefinition({identifier: Identifier.createVariable(`${settings.identifier.name}Response`),schema: operation.toSuccessResponse().resolve().toSchema(),schemaToValueFn: toZodValue})}toString() {return `async () => {const response = await fetch('${this.operation.path}');const data = await response.json();return ${this.settings.identifier.name}Response.parse(data);}`}}
CodeSquared transformers use simple string templates to define output code.
Using native behaviour makes code generation accessible to all JavaScript developers. This approach also enables us to reuse and nest code generated by other transformers.
Use generated code as building blocks or compose them into a full application.
import { product } from '@/models/products';import { z } from 'zod';const productsResponse = z.array(product);export const getProducts = async () => {const response = await fetch('/products');const data = await response.json();return productsResponse.parse(data);}