https://github.com/remult/remult Skip to content Sign up * Product + Features + Mobile + Actions + Codespaces + Packages + Security + Code review + Issues + Integrations + GitHub Sponsors + Customer stories * Team * Enterprise * Explore + Explore GitHub + Learn and contribute + Topics + Collections + Trending + Learning Lab + Open source guides + Connect with others + The ReadME Project + Events + Community forum + GitHub Education + GitHub Stars program * Marketplace * Pricing + Plans + Compare plans + Contact Sales + Education [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this organization All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} remult / remult Public * Notifications * Fork 9 * Star 204 A CRUD framework for full stack TypeScript remult.dev License MIT license 204 stars 9 forks Star Notifications * Code * Issues 0 * Pull requests 0 * Actions * Projects 0 * Wiki * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Wiki * Security * Insights This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 1 branch 134 tags Code Latest commit @yoni-rapoport yoni-rapoport README fix typo ... 81faf4e May 22, 2022 README fix typo 81faf4e Git stats * 1,915 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .circleci added test:ci script with coverage Apr 17, 2022 .github/ISSUE_TEMPLATE Update issue templates Apr 25, 2022 .vscode docs: react tutorial May 12, 2022 docs docs: tutorials May 22, 2022 projects more work on react next May 22, 2022 tools fixed version update May 22, 2022 .gitignore fixed iscompleted for json Apr 21, 2021 .gutattributes Stabilized some auto generated docs capabilities Aug 8, 2020 CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md Apr 25, 2022 CONTRIBUTING.md Update CONTRIBUTING.md Apr 26, 2022 LICENSE Update LICENSE Oct 21, 2021 README.md README fix typo May 22, 2022 package-lock.json release 0.13.25 May 22, 2022 package.json release 0.13.25 May 22, 2022 tsconfig.json reordered files Sep 13, 2021 View code [ ] Remult What is Remult? Remult [?] Code Sharing Getting started Installation Usage Setup API backend using a Node.js Express middleware Define model classes API Ready Find and manipulate data in type-safe frontend code ...exactly the same way as in backend code [?] Data validation and constraints - defined once Enforced in frontend: Enforced in backend: Secure the API with fine-grained authorization Example App Contributing License README.md [logo] Remult CircleCI [6874747073] GitHub license npm version npm downloads chat on discord What is Remult? Remult is a full-stack CRUD framework that uses your TypeScript model types to provide: * Secure REST API (highly configurable) * Type-safe frontend API client * Type-safe backend query builder Remult [?] Code Sharing With model types shared between frontend and backend code, Remult can enforce data validation and constraints, defined once, both in the front-end and within back-end API routes. Getting started The best way to learn Remult is by following a tutorial of a simple Todo web app with a Node.js Express backend. * Tutorial with React * Tutorial with Angular * Tutorial with Vue * Tutorial with Next.js Installation npm i remult Usage Setup API backend using a Node.js Express middleware import express from 'express'; import { remultExpress } from 'remult/remult-express'; const port = 3001; const app = express(); app.use(remultExpress()); app.listen(port, () => { console.log(`Example API listening at http://localhost:${port}`); }); Define model classes import { Entity, Fields } from 'remult'; @Entity('products', { allowApiCrud: true }) export class Product { @Fields.string() name = ''; @Fields.number() unitPrice = 0; } API Ready > curl http://localhost:3001/api/products [{"name":"Tofu","unitPrice":5}] Find and manipulate data in type-safe frontend code async function increasePriceOfTofu(priceIncrease: number) { const productsRepo = remult.repo(Product); const product = await productsRepo.findFirst({ name: 'Tofu' }); product.unitPrice += priceIncrease; productsRepo.save(product); } ...exactly the same way as in backend code @BackendMethod({ allowed: Allow.authenticated }) static async increasePriceOfTofu(priceIncrease: number, remult?: Remult) { const productsRepo = remult!.repo(Product); const product = await productsRepo.findFirst({ name: 'Tofu' }); product.unitPrice += priceIncrease; productsRepo.save(product); } [?] Data validation and constraints - defined once import { Entity, Fields } from 'remult'; @Entity('products', { allowApiCrud: true }) export class Product { @Fields.string({ validate: product => { if (product.name.trim().length == 0) throw 'required'; } }) name = ''; @Fields.number({ validate: (_, field) => { if (field.value < 0) throw "must not be less than 0"; } }) unitPrice = 0; } Enforced in frontend: const product = productsRepo.create(); try { await productsRepo.save(product); } catch (e: any) { console.error(e.message); // Browser console will display - "Name: required" } Enforced in backend: > curl http://localhost:3001/api/products -H "Content-Type: application/json" -d "{""unitPrice"":-1}" {"modelState":{"unitPrice":"must not be less than 0","name":"required"},"message":"Name: required"} Secure the API with fine-grained authorization @Entity
('Articles', { allowApiRead: true, allowApiInsert: remult => remult.authenticated(), allowApiUpdate: (remult, article) => article.author.id == remult.user.id }) export class Article { @Fields.string({ allowApiUpdate: false }) slug = ''; @Field(() => Profile, { allowApiUpdate: false }) author!: Profile; @Fields.string() content = ''; } Example App CRM demo with a React + MUI front-end and Postgres database. Contributing Contributions are welcome. See CONTRIBUTING. License Remult is MIT Licensed. About A CRUD framework for full stack TypeScript remult.dev Topics react nodejs angular express crud typescript validation orm postgresql domain-driven-design fullstack Resources Readme License MIT license Code of conduct Code of conduct Stars 204 stars Watchers 6 watching Forks 9 forks Releases 5 v0.13.25 Latest May 22, 2022 + 4 releases Used by 31 * @remult * @remult * @noam-honig * @noam-honig * @noam-honig * @noam-honig * @noam-honig * @remult + 23 Contributors 5 * * * * * Languages * TypeScript 96.2% * HTML 2.5% * Other 1.3% * (c) 2022 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.