
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
EXTENDABLE VALIDATION LIBRARY (zod like syntax, can generate mongo models and infer types)
,
_.-"` `'_ _________________________________________________________
__ '._ __{}_/ __________ ____ ____ __________ ____ /\
|||| |'--.__\ / ____/ __ \/ __ \/ __ \ / ____/ __ \/ __ \ / /
| L.( ^ \^ / / __/ / / / / / / / / / / / / / / / /_/ / / /
\ .-' | _'| / /_/ / /_/ / /_/ / /_/ / / /___/ /_/ / ____/ / /
| | )\___/ \____/\____/\____/_____/ \____/\____/_/ / /
| \-'`:._] _______________________________________________________/ /
\__/; '-. ____________________________________________________\/
This library is actually in beta but it's used successfully in very security demanding production apps and well tested. Feel free to contact me via github to collaborate or for feature request

A powerful TypeScript validation library with advanced type inference and schema generation capabilities.
While Zod is an excellent validation library, Good Cop was created to address specific needs:
npm install good-cop
# or
yarn add good-cop
import { _, InferType } from 'good-cop'
// Define a schema
const userSchema = _.object({
name: _.string().required(),
age: _.number().min(0).max(120),
email: _.email().optional(),
role: _.enum(['admin', 'user', 'guest']).required()
})
// Infer TypeScript type
type User = InferType<typeof userSchema>
import { _, InferTypeRead, InferTypeWrite } from 'good-cop'
const _ = new Definition<{
default: {
[modelName: 'user' | 'organization']: any
}
}>({
default: {
user,
organization
}
}).init()
const user = _.mongoModel(
['creationDate'], // Auto-created fields
{
firstName: _.string(),
org: _.ref('organization')
}
)
// Types for different operations
type UserWrite = InferTypeWrite<typeof user> // For create/update
type UserRead = InferTypeRead<typeof user> // For database output
const complexSchema = _.object({
string: _.string().required(),
enum: _.enum(
_.number().min(0).max(100).round2(),
_.boolean()
),
arr: [_.email()],
otherArr: _.array(_.url()).maxLength(3).required(),
subObj: {
subField: _.genericObject('fieldName', { date: _.date() }),
regexp: _.string().regexp(/my\sregexp/),
}
})
Note: this project is used as a backbone for the green_dot framework
Contributions are welcome! Feel free to:
MIT License - feel free to use this library in your projects!
FAQs
EXTENDABLE VALIDATION LIBRARY (zod like syntax, can generate mongo models and infer types)
The npm package good-cop receives a total of 4 weekly downloads. As such, good-cop popularity was classified as not popular.
We found that good-cop demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.