
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
A powerful TypeScript nodeJs framework for building DX friendly, secure and type-safe backend services with MongoDB integration
A powerful TypeScript nodeJs framework for building DX friendly, secure and front-end / back-end type-safe backend services with MongoDB integration (other DBs coming soon) and SDK generation
Official Documentation QuickStart Guide
š§ Back/Front Type-safe API route declarations, shared models
š Secure model definitions with validation and routes exposed automatically via configuration
šŖŖ Built-in DX friendly unified security and access control
š Powerful plugin system with Managed Login, ApiKey Login, and Secure Authentication (2FA, biometric authentication and pinCode) (BETA)
šŖ File generation from templates to generate project, database, app, model...so you get up and running in no time
šļø MongoDB integration with type safety (others database drivers to come)
šØāš» DX and intellisense friendly
šļø Generate it's own SDK to use in frontend, get your backend data without await or useEffect: (Eg: const result = $.useQuery.myApiRoute()
)
ā” Fully cached in frontend via TanStack Query
š¦ VSCode / Cursor Plugin
npx green_dot generate
in a blank foldernpx green_dot generate
=> and choose 'Model'npx green_dot generate
=> and choose 'Service'š app/
āāā š myDb1/ # Each DB as its own folder
ā āāā š models/
ā ā āāā [modelName].dao.ts # Security config for the model
ā ā āāā [modelName].model.ts # Model definition file
ā āāā āļø gd.db.config.ts # DB config file specific to this database
āāā š myDb2/
ā
āāā š myApp1/ # Each APP as its own folder
ā āāā š myModule1/ # A custom module; structure is flexible
ā ā āāā myModule.testFlow.ts # api tests for your module
ā ā āāā myModule1.svc.ts # API route definition for the module
ā āāā āļø gd.apiTests.config.ts # Config file for automated API tests (BETA)
ā āāā āļø gd.app.config.ts # App config file specific to this application
āāā š myApp2/
ā
āāā āļø gd.config.ts # Global config (all roles, permissions, etc.)
Note: you can create mutiple app and dbs with the npx green_dot generate
command
getMainConfig()
=> get your main config where yuo set allRoles, allPermissionsgetActiveAppConfig()
, getActiveDbConfig()
=> get respective actual db/app confignpx green_dot generate
and select > Api Service
export const checkUserExists = svc({
// Access level
for: ['customRole', { role; 'user', hasValidatedEmail: true }],
// Type-safe input validation
input: {
email: _.email().required(),
user: _.model('myDbName', 'user'), // ref to app models
},
// Type-safe output
output: _.boolean(),
// optional security features
rateLimiter: '10/min',
...
async main(ctx, { email }) {
const nbUsers = await db.user.count(ctx.GM, { email })
return !!nbUsers
},
})
const userExists = $.checkUserExists() // type boolean
)See documentation (will come soon) for more details.
To create an api service:
npx green_dot generate
and select > Database Model
./myModel.model.ts
and ./myModel.dao.ts
files for declaring model and DAO (data access object, a security configuration for your model)const model = _.mongoModel(
// Automatic timestamp fields
['creationDate', 'updateDate'],
{
name: _.string().required(),
admin: _.ref('user').required(),
companyIdenfier: _.string().required().unique(),
address: {
street: _.string().required(),
zipCode: _.string().required(),
city: _.string().required(),
country: _.string().required(),
},
})
Configure data access with security and type safety:
// user.dao.ts
const dao = {
type: 'mongo',
// The expose config will automatically create routes for given
// permissions and config
expose: [{
// Here user and admin both can update or getOne for your model
for: ['user', 'admin'],
expose: ['getOne', 'update'],
}, {
// Here only admin can getAll
for: ['admin'],
expose: ['getAll'],
}],
// Filter is another powerful security feature, it allow to add filter
// depending on the connected user
filter: [{
on: ['read', 'write'], // for all methods
for: 'ALL', // for all perms
filter: (ctx, filter) => {
if (ctx.role === 'admin') return
// if !admin we constrain the filter to be the userId
// so we make sure the user can only acess his own user!
else filter._id = ctx._id
}
}],
// Mask allow to mask fields of a model depending on user permissions
// and methods (read, update, create...)
mask: [{
on: ['read'],
// for everyone, we mask password field on read
mask: () => ({
password: true,
}),
}, {
// only admin can see user.stats
on: ['read'],
notFor: 'admin',
mask: () => ({
stats: true
}),
}],
populate: [
// we can always populate a field if needed
'company',
],
}
Contributions are welcome!
FAQs
A powerful TypeScript nodeJs framework for building DX friendly, secure and type-safe backend services with MongoDB integration
The npm package green_dot receives a total of 11 weekly downloads. As such, green_dot popularity was classified as not popular.
We found that green_dot 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.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.