Files
payloadcms/packages/payload
Alessio Gravili e83eb99436 feat: remove joi schema validation (#7226)
We do not really need runtime joi schema validation - this is what TypeScript is for. If people are ignoring TypeScript errors in your schema, or JavaScript errors, that is their fault and does not warrant an extra dependency (joi), lots of code to maintain, as well as slower startups.

If we wanna keep runtime schema validation, we should switch to zod so that we can generate TypeScript types based on the schema and do not have to manually maintain config properties in 2 different places (types & schema).

**joi PROs:**
- Safety for JavaScript-only evangelists messing up their schema
- Safety for people putting @ts-expect-error or `as any` everywhere in their code

**joi CONs:**
- Larger bundle size
- More Modules
- Slower Compilation Speed in dev. Worse DX
- Slower Startup (it needs to validate) in dev. Worse DX
- More code to maintain. For every schema change we'll have to change the types AND the joi schema
- TypeScript already throws proper errors if you mess up your schema. Why have runtime errors?
- The errors are bad. They might tell you what field has an issue, but they do not tell you what exactly is wrong. You have probably seen those "Field XY, value is incorrect" errors - and value could mean anything. Worse DX
- Having extra properties in your schema, even if they are useless, doesn't cause any harm

Cons outweigh the pros
2024-07-22 13:22:54 -04:00
..
2024-07-09 09:50:37 -04:00

Payload headless CMS Admin panel built with React

GitHub Workflow Status   Discord   npm   Payload Twitter


Explore the Docs · Community Help · Try Live Demo · Roadmap · View G2 Reviews


Important

🎉 Payload 2.0 is now available! Read more in the announcement post.

Benefits over a regular CMS

  • Dont hit some third-party SaaS API, hit your own API
  • Use your own database and own your data
  • It's just Express - do what you want outside of Payload
  • No need to learn how Payload works - if you know JS, you know Payload
  • No vendor lock-in
  • Avoid microservices hell - get everything (even auth) in one place
  • Never touch ancient WP code again
  • Build faster, never hit a roadblock
  • Both admin and backend are 100% extensible

☁️ Deploy instantly with Payload Cloud.

Create a cloud account, connect your GitHub, and deploy in minutes.

🚀 Get started by self-hosting completely free, forever.

Before beginning to work with Payload, make sure you have all of the required software.

npx create-payload-app@latest

Alternatively, it only takes about five minutes to create an app from scratch.

🖱️ One-click templates

Jumpstart your next project by starting with a pre-made template. These are production-ready, end-to-end solutions designed to get you to market as fast as possible.

🛒 E-Commerce

Eliminate the need to combine Shopify and a CMS, and instead do it all with Payload + Stripe. Comes with a beautiful, fully functional front-end complete with shopping cart, checkout, orders, and much more.

🌐 Website

Build any kind of website, blog, or portfolio from small to enterprise. Comes with a beautiful, fully functional front-end complete with posts, projects, comments, and much more.

We're constantly adding more templates to our Templates Directory. If you maintain your own template, consider adding the payload-template topic to your GitHub repository for others to find.

Features

Request Feature

🗒️ Documentation

Check out the Payload website to find in-depth documentation for everything that Payload offers.

Migrating from v1 to v2? Check out the 2.0 Release Notes on how to do it.

🙋 Contributing

If you want to add contributions to this repository, please follow the instructions in contributing.md.

📚 Examples

The Examples Directory is a great resource for learning how to setup Payload in a variety of different ways, but you can also find great examples in our blog and throughout our social media.

🔌 Plugins

Payload is highly extensible and allows you to install or distribute plugins that add or remove functionality. There are both officially-supported and community-supported plugins available. If you maintain your own plugin, consider adding the payload-plugin topic to your GitHub repository for others to find.

🚨 Need help?

There are lots of good conversations and resources in our Github Discussions board and our Discord Server. If you're struggling with something, chances are, someone's already solved what you're up against. 👇

Like what we're doing? Give us a star

payload-github-star

👏 Thanks to all our contributors