Dev Tips

Read the latest tips and tricks for building your SaaS. Get fresh developer tips every week.

2025-08-16

Use .nullish() instead of .optional().nullable() in zod

#zod #typescript

When working with zod, you might have found yourself using .optional().nullable() to make a field optional and nullable. Especially when you are working with tRPC or similar API libraries, this is a common case for API input validation.

But there is a better way to do this.

Instead of using .optional().nullable(), you can use .nullish().

const schema = z.object({ 
    name: z.string().optional().nullable(), // ❌ don't do this
    name: z.string().nullish(), // ✅ do this instead
});
2025-08-15

Create Tailwind CSS shades from your brand colors

#tailwind #css #styling #design

Create Tailwind CSS shades from your brand colors

When using Tailwind CSS to style your UI, you might have noticed that they use a shade system for colors. Usually when you pick brand colors though, you don't necessarily pick all shades for them but only a few specific colors.

To create shades that you can easily use in your Tailwind CSS classes and therefore in your UI, you can use the uicolors.app tool.

It allows you to enter the hex code of your brand color and will generate all the shades for you, as well as give you recommendations on what shades to use where in your UI including contrast ratios.

Start your scalable and production-ready SaaS today

Save endless hours of development time and focus on what's important for your customers with our SaaS starter kits for Next.js, Nuxt 3 and SvelteKit

Get started

Stay up to date

Sign up for our newsletter and we will keep you updated on everything going on with supastarter.