A developer-friendly backend framework that transforms simple DSL syntax into functional Node.js/Express applications with built-in security, validation, and database support.
Author: Avi Ranjan Prasad
Validation note: core adapters are covered by local contract tests. Paid/cloud/provider adapters such as Supabase, Firebase, DynamoDB, Elasticsearch/OpenSearch, Cassandra, and Neo4j require
LIVE_ADAPTERS=trueplus real service credentials or local services for live validation. See Live Adapter Validation.
npx easybackend.js create my-api
cd my-api
npm install
npm run doctor
npm run devSTART SERVER 3000
USE MONGODB mongodb://localhost:27017/blog
SECURITY strict
DOCS openapi
ADMIN enabled
MODEL posts {
title: string
content: string
}
GET /posts FROM posts
POST /posts FROM posts
PROTECT /posts
New user guides:
- Getting Started
- easy.js Language
- AI, Cloud, and DevOps Support
- Database Support
- Live Adapter Validation
- Security Defaults
- IDE Support
- Language Specification
- Runtime Semantics
- AST Documentation
- Backward Compatibility
- Generated Code Security
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, PostgreSQL, SQLite, Redis, and additional provider adapter support
- JWT authentication
- Input validation
- Rate limiting & security headers
- CORS configuration
- Error handling
- Database migrations
- Live provider validation harness for credential-backed services
- OpenAI, Google Gemini, and Anthropic SDK support through
AIProviderManager - TensorFlow.js local ML utilities
- AWS SDK v3 for S3 and DynamoDB
- MongoDB, MySQL/MariaDB, PostgreSQL, SQLite, libSQL/Turso, SQL Server, Redis, Firebase, DynamoDB, Supabase, Elasticsearch/OpenSearch, Cassandra, and Neo4j database adapters
- Google Cloud Storage, Azure Blob Storage, and S3 storage adapters
- Docker, Docker Compose, Kubernetes, Helm, Terraform for AWS ECS/Fargate, GitHub Actions CI, Sentry, OpenTelemetry, and Prometheus
npm install easybackend.jsProvider SDKs and database drivers are optional so normal installs stay small. Install only what your app uses, for example:
npm install mongoose
npm install pg
npm install @supabase/supabase-jseasyjs doctor reads your .easy files and tells you the exact package to install when a selected provider is missing.
New projects also include an editable template/ folder. Put plain HTML, CSS, and JavaScript there and easy.js serves it at /, so you can design a small UI without setting up a separate frontend build. The generated template/api.js exposes EasyAPI.get(), EasyAPI.post(), and related helpers for calling your backend.
You can choose a UI preset:
npx easybackend.js create my-api --ui bootstrap
npx easybackend.js create my-api --ui tailwind
easyjs add ui bootstrap
easyjs add ui tailwind
easyjs add page dashboardnpx easybackend.js create my-api
cd my-api
npm install
npm startCreate 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.easyYour API is now running on http://localhost:3000
START SERVER <port>
Example:
START SERVER 3000
USE MONGODB <connection_string>
USE MYSQL <connection_string>
Examples:
USE MONGODB mongodb://localhost:27017/myapp
USE MYSQL mysql://root:password@localhost:3306/myapp
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
}
<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
AUTH <model> BY jwt
Enables JWT authentication for the specified model.
AUTH users BY jwt
PROTECT <path>
Requires JWT token for access.
PROTECT /users
PROTECT /posts
VALIDATE <model> {
field: rule:rule
field: rule:rule
}
Available rules:
required- Field is mandatoryemail- Valid email formatmin=N- Minimum length/valuemax=N- Maximum length/valuenumeric- Numeric values onlyalphanumeric- Letters and numbers onlyurl- Valid URL formatphone- Valid phone number
Example:
VALIDATE users {
email: required:email
password: required:min=6
age: numeric:min=18
name: required:min=2:max=50
}
USE LOGGER
USE AUTH
Built-in middleware: LOGGER, AUTH, CORS, COMPRESSION
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
- 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
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
USE MONGODB mongodb://user:password@host:port/dbname
Features:
- Automatic schema generation
- Timestamps (createdAt, updatedAt)
- Mongoose integration
- Flexible document structure
USE MYSQL mysql://user:password@localhost:3306/dbname
Features:
- Automatic table creation
- Connection pooling
- Prepared statements
- Transaction support ready
AUTH users BY jwt
PROTECT /api/users
Authentication is handled automatically via protected routes. Include JWT token:
Authorization: Bearer <token>
Users model receives special handling:
- Password auto-hashing
- Token generation
- Session management
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"]
}
}{
"success": true,
"data": { /* resource data */ }
}{
"success": false,
"error": "Error message",
"timestamp": "2024-01-01T12:00:00.000Z"
}npx easybackend.js create <project-name>easyjs start app.easyeasyjs dev app.easyeasyjs add model Product
easyjs add route products
easyjs add crud products
easyjs add auth jwt
easyjs add database postgres
easyjs add page dashboardeasyjs doctorIf your app says USE SUPABASE and the SDK is missing, doctor prints:
You use Supabase but @supabase/supabase-js is missing. Run npm install @supabase/supabase-js.
easyjs buildnpm run release:checkThis runs the test suite, production smoke validation, package dry-run, real pack, and a temp consumer install from the generated tarball.
easyjs --versioneasyjs --helpSTART 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
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
ENV NODE_ENV=production
EXPOSE 3000
CMD ["npm", "start"]Set before deployment:
JWT_SECRET=production-secret-key
MONGODB_URL=mongodb+srv://user:pass@cluster.mongodb.net/proddb
NODE_ENV=productioncurl http://localhost:3000/userscurl -X POST http://localhost:3000/users \
-H "Content-Type: application/json" \
-d '{
"name": "John Doe",
"email": "john@example.com",
"password": "securepass123"
}'curl -X PUT http://localhost:3000/users/123 \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <token>" \
-d '{
"name": "Jane Doe"
}'curl -X DELETE http://localhost:3000/users/123 \
-H "Authorization: Bearer <token>"- Environment Variables: Always use
.envfor sensitive data - Validation: Define comprehensive validation rules
- Security: Use strong JWT secrets in production
- Logging: Enable debug mode during development
- Database: Use connection strings with authentication
- Rate Limiting: Protect public endpoints from abuse
- Check database service is running
- Verify connection string in
.env - Check firewall rules
easyjs start app.easy --port 3001npm install
npm startMIT License - Feel free to use in personal and commercial projects
Contributions welcome! Submit issues and pull requests on GitHub.
For issues and questions:
- Open an issue on GitHub
- Check documentation
- Review examples directory
easy.js - Building backends has never been easier.