Meteor Settings Validator Type-Safe Package

Hey Meteor Community,

I’m excited to share a new utility package that I created and we’ve been using in our projects: the Meteor Settings Validator.

What it does: This package simplifies Meteor.settings validation using a Zod schema, ensuring your settings adhere to the expected structure.

How to use:

  1. Installation:
meteor add hschmaiske:meteor-settings-validator
meteor npm i zod
  1. Usage:
import { MeteorSettingsValidator } from "hschmaiske:meteor-settings-validator";

const MeteorSettingsSchema = z.object({
  public: z.object({
    // Define your public settings structure here
  }),
  // Add other properties as needed
});

const settingsValidator = new MeteorSettingsValidator(MeteorSettingsSchema);
const settings = settingsValidator.get();

Contribute: Feel free to contribute through issues and pull requests. It’s a simple yet powerful utility to streamline your Meteor development.
GitHub repository link.

Cheers,
Henrique

4 Likes

We have been using it and we found it to be useful, especially when you have more people in your team and sometimes needs to add keys for your settings, having a solution that warns you when something is off is great!

Nice work. Been doing this manually using Zod for quite a while now.

1 Like

Let me know if you have any ideas for improvement. Happy to help :smile: