npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

aseasy

v1.0.7

Published

A production-ready backend framework with a simple DSL for building secure, scalable Node.js applications

Readme

easy.js - Production-Ready Backend Framework

A developer-friendly backend framework that transforms simple DSL syntax into fully functional, production-ready Node.js/Express applications with built-in security, validation, and database support.

🎯 What is easy.js?

easy.js simplifies backend development by letting you write backend applications in a clean, human-readable DSL instead of complex Express.js code. Write simple declarations, get a fully functional REST API with:

  • Express.js server setup
  • MongoDB & MySQL support
  • JWT authentication
  • Input validation
  • Rate limiting & security headers
  • CORS configuration
  • Error handling
  • Database migrations

⚡ Quick Start

Installation

npm install easy.js

Create a Project

npx easyjs create my-api
cd my-api
npm install
npm start

Your First API

Create app.easy:

START SERVER 3000

USE MONGODB mongodb://localhost:27017/mydb

MODEL users {
  name: string
  email: string
  password: string
}

AUTH users BY jwt

GET /users FROM users
POST /users FROM users
PUT /users/:id FROM users
DELETE /users/:id FROM users

VALIDATE users {
  email: required:email
  password: required:min=6
  name: required
}

PROTECT /users

Run it:

easyjs start app.easy

Your API is now running on http://localhost:3000

📖 Language Syntax

Server Configuration

START SERVER <port>

Example:

START SERVER 3000

Database Configuration

USE MONGODB <connection_string>
USE MYSQL <connection_string>

Examples:

USE MONGODB mongodb://localhost:27017/myapp
USE MYSQL mysql://root:password@localhost:3306/myapp

Model Definition

MODEL <name> {
  field: type
  field: type
}

Supported types: string, number, boolean, date, object, array

Example:

MODEL users {
  name: string
  email: string
  age: number
  isActive: boolean
}

Routes

<METHOD> <path> FROM <model>

Methods: GET, POST, PUT, DELETE, PATCH

Examples:

GET /users FROM users
GET /users/:id FROM users
POST /users FROM users
PUT /users/:id FROM users
DELETE /users/:id FROM users

Authentication

AUTH <model> BY jwt

Enables JWT authentication for the specified model.

AUTH users BY jwt

Protected Routes

PROTECT <path>

Requires JWT token for access.

PROTECT /users
PROTECT /posts

Validation Rules

VALIDATE <model> {
  field: rule:rule
  field: rule:rule
}

Available rules:

  • required - Field is mandatory
  • email - Valid email format
  • min=N - Minimum length/value
  • max=N - Maximum length/value
  • numeric - Numeric values only
  • alphanumeric - Letters and numbers only
  • url - Valid URL format
  • phone - Valid phone number

Example:

VALIDATE users {
  email: required:email
  password: required:min=6
  age: numeric:min=18
  name: required:min=2:max=50
}

Middleware

USE LOGGER
USE AUTH

Built-in middleware: LOGGER, AUTH, CORS, COMPRESSION

🏗️ Project Structure

easyjs/
├── cli/                    # Command-line interface
├── parser/                 # DSL parser & tokenizer
│   ├── Parser.js
│   ├── Tokenizer.js
│   └── ASTBuilder.js
├── compiler/               # Compiler to Express.js
│   └── Compiler.js
├── runtime/                # Runtime engine
│   └── RuntimeEngine.js
├── core/                   # Core modules
│   ├── router.js          # Route handler generation
│   ├── database.js        # Database manager
│   ├── auth.js            # Authentication & JWT
│   ├── validator.js       # Input validation
│   ├── logger.js          # Logging utility
│   └── middleware.js      # Middleware factory
├── adapters/              # Database adapters
│   ├── mongodb.js
│   └── mysql.js
├── examples/              # Example applications
├── index.js               # Entry point
├── package.json
└── README.md

🔐 Security Features

Built-in Protections

  • JWT Authentication: Secure token-based authentication
  • Password Hashing: bcryptjs for secure password storage
  • Rate Limiting: Protection against brute force attacks
  • Helmet.js: Secure HTTP headers
  • CORS: Configurable cross-origin resource sharing
  • Input Validation: Comprehensive validation rules
  • Input Sanitization: Automatic input cleaning
  • SQL Injection Prevention: Parameterized queries

Environment Configuration

Create .env file:

JWT_SECRET=your-secure-secret-key
JWT_EXPIRY=24h
MONGODB_URL=mongodb://localhost:27017/myapp
MYSQL_URL=mysql://root:password@localhost:3306/myapp
DEBUG=false

🗄️ Database Support

MongoDB

USE MONGODB mongodb://user:password@host:port/dbname

Features:

  • Automatic schema generation
  • Timestamps (createdAt, updatedAt)
  • Mongoose integration
  • Flexible document structure

MySQL

USE MYSQL mysql://user:password@localhost:3306/dbname

Features:

  • Automatic table creation
  • Connection pooling
  • Prepared statements
  • Transaction support ready

🔑 Authentication

Setup

AUTH users BY jwt
PROTECT /api/users

API Endpoints

Authentication is handled automatically via protected routes. Include JWT token:

Authorization: Bearer <token>

User Management

Users model receives special handling:

  • Password auto-hashing
  • Token generation
  • Session management

✅ Validation

Comprehensive input validation with clear error messages:

VALIDATE users {
  email: required:email
  password: required:min=6:max=128
  age: numeric:min=18
}

Error responses:

{
  "success": false,
  "error": "Validation failed",
  "details": {
    "email": ["email must be a valid email"],
    "password": ["password must be at least 6 characters"]
  }
}

📡 API Response Format

Success Response

{
  "success": true,
  "data": { /* resource data */ }
}

Error Response

{
  "success": false,
  "error": "Error message",
  "timestamp": "2024-01-01T12:00:00.000Z"
}

🛠️ CLI Commands

Create New Project

easyjs create <project-name>

Start Production Server

easyjs start app.easy

Development Mode (Watch Mode)

easyjs dev app.easy

Build for Production

easyjs build

Show Version

easyjs --version

Show Help

easyjs --help

📚 Complete Example

START SERVER 4000

USE MONGODB mongodb://localhost:27017/blog

MODEL posts {
  title: string
  content: string
  author: string
  published: boolean
  views: number
}

MODEL comments {
  postId: string
  text: string
  author: string
}

GET /posts FROM posts
GET /posts/:id FROM posts
POST /posts FROM posts
PUT /posts/:id FROM posts
DELETE /posts/:id FROM posts

GET /posts/:postId/comments FROM comments
POST /posts/:postId/comments FROM comments
DELETE /comments/:id FROM comments

VALIDATE posts {
  title: required:min=3:max=200
  content: required:min=10
  author: required
}

VALIDATE comments {
  text: required:min=1:max=1000
  author: required
  postId: required
}

PROTECT /posts
PROTECT /comments

🚀 Deployment

Docker

FROM node:18-alpine

WORKDIR /app

COPY package*.json ./
RUN npm install

COPY . .

ENV NODE_ENV=production
EXPOSE 3000

CMD ["npm", "start"]

Environment Variables

Set before deployment:

JWT_SECRET=production-secret-key
MONGODB_URL=mongodb+srv://user:[email protected]/proddb
NODE_ENV=production

🧪 Testing Your API

Get All Users

curl http://localhost:3000/users

Create User

curl -X POST http://localhost:3000/users \
  -H "Content-Type: application/json" \
  -d '{
    "name": "John Doe",
    "email": "[email protected]",
    "password": "securepass123"
  }'

Update User

curl -X PUT http://localhost:3000/users/123 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <token>" \
  -d '{
    "name": "Jane Doe"
  }'

Delete User

curl -X DELETE http://localhost:3000/users/123 \
  -H "Authorization: Bearer <token>"

📝 Best Practices

  1. Environment Variables: Always use .env for sensitive data
  2. Validation: Define comprehensive validation rules
  3. Security: Use strong JWT secrets in production
  4. Logging: Enable debug mode during development
  5. Database: Use connection strings with authentication
  6. Rate Limiting: Protect public endpoints from abuse

🐛 Troubleshooting

Database Connection Failed

  • Check database service is running
  • Verify connection string in .env
  • Check firewall rules

Port Already in Use

easyjs start app.easy --port 3001

Module Not Found

npm install
npm start

📄 License

MIT License - Feel free to use in personal and commercial projects

🤝 Contributing

Contributions welcome! Submit issues and pull requests on GitHub.

📞 Support

For issues and questions:

  • Open an issue on GitHub
  • Check documentation
  • Review examples directory

easy.js - Building backends has never been easier. ✨