Advanced JSON REST API server with modern admin dashboard for rapid prototyping and development.
- JSON File Database: Zero-config file-based storage
- RESTful CRUD: Full Create, Read, Update, Delete operations
- Schema Validation: Automatic and custom field validation
- Data Relationships: One-to-one, one-to-many, many-to-many
- Advanced Querying: Filtering, sorting, pagination, population
- Real-time Updates: WebSocket-powered live data sync
- Responsive Design: Modern, professional interface
- Collections Management: Visual data browser and editor
- Schema Editor: Field-level validation rules
- Request Monitoring: Live request logging and analytics
- Password Protection: Session-based authentication
- CORS Management: Configurable cross-origin policies
- Request Limits: Body size and rate limiting
- IP-based Rate Limiting: Prevent DoS attacks
- Admin Protection: Secure dashboard access
- Session Management: 24-hour token-based auth
- Automatic Backups: Scheduled data protection
- Export Formats: JSON, CSV, XML support
- File Upload Simulation: Multipart form handling
- Production Generator: Create optimized deployments
npm install -g jsonxapi# Start server on default port 4000
jsonxapi
# Custom port and database file
jsonxapi --port 3000 --db mydata.json
# With admin password protection
jsonxapi --port 4000 --password secretpass# Create a record
curl -X POST http://localhost:4000/users \
-H "Content-Type: application/json" \
-d '{"name": "John Doe", "email": "john@example.com"}'
# Get all records
curl http://localhost:4000/users
# Get specific record
curl http://localhost:4000/users/123
# Update record
curl -X PATCH http://localhost:4000/users/123 \
-H "Content-Type: application/json" \
-d '{"name": "Jane Doe"}'
# Delete record
curl -X DELETE http://localhost:4000/users/123Access the modern admin interface at http://localhost:4000/_admin
- Live server statistics
- Collection summaries
- Real-time request monitoring
- WebSocket connection status
- Browse and edit data visually
- Add/update/delete records
- Schema validation feedback
- Export collections in multiple formats
- Define field types and validation rules
- Set required fields and constraints
- Manage relationships between collections
- Live schema updates
- Live request logging
- HTTP method and endpoint tracking
- Response time analytics
- Error monitoring
- CORS settings management
- Request size and rate limits
- Backup and restore operations
- WebSocket settings
| Method | Endpoint | Description |
|---|---|---|
GET |
/{collection} |
Get all records |
GET |
/{collection}/{id} |
Get specific record |
POST |
/{collection} |
Create new record |
PATCH |
/{collection}/{id} |
Update record |
DELETE |
/{collection}/{id} |
Delete record |
# Filter by field value
GET /users?name=John
# Multiple filters
GET /users?status=active&role=admin
# Range queries
GET /products?price_gte=10&price_lte=100# Sort ascending
GET /users?_sort=name
# Sort descending
GET /users?_sort=name&_order=desc
# Multiple fields
GET /users?_sort=name,email&_order=asc,desc# Limit results
GET /users?_limit=10
# Skip records
GET /users?_start=20&_limit=10
# Page-based
GET /users?_page=2&_limit=10# Populate all relationships
GET /posts?_populate=true
# Populate specific fields
GET /posts?_populate=author,comments# Export as CSV
GET /users?_format=csv
# Export as XML
GET /users?_format=xml
# Download file
GET /users?_format=csv&_download=true| Option | Description | Default |
|---|---|---|
--port |
Server port | 4000 |
--db |
Database file path | db.json |
--password |
Admin dashboard password | None |
# Alternative configuration
export JX_PORT=3000
export JX_DB_FILE=data.json
export JX_ADMIN_PASSWORD=mypasswordstring- Text datanumber- Numeric valuesboolean- True/falsearray- Lists of valuesobject- Nested objects
{
"_schemas": {
"users": {
"name": {
"type": "string",
"required": true,
"minLength": 2,
"maxLength": 50
},
"email": {
"type": "string",
"required": true,
"pattern": "^[^@]+@[^@]+\\.[^@]+$"
},
"age": {
"type": "number",
"min": 0,
"max": 150
},
"active": {
"type": "boolean",
"default": true
}
}
}
}{
"_relationships": {
"posts": {
"author": {
"type": "belongsTo",
"collection": "users",
"foreignKey": "authorId"
},
"comments": {
"type": "hasMany",
"collection": "comments",
"foreignKey": "postId"
}
}
}
}- belongsTo: One-to-one, record belongs to another
- hasMany: One-to-many, record has multiple related records
- hasOne: One-to-one, record has one related record
- belongsToMany: Many-to-many through junction table
# Configure via admin dashboard or API
POST /_admin_cors
{
"enabled": true,
"origin": ["http://localhost:3000", "https://myapp.com"],
"methods": ["GET", "POST", "PATCH", "DELETE"],
"allowCredentials": true
}# Set via admin dashboard
POST /_admin_limits
{
"enabled": true,
"maxBodySize": 1048576,
"maxFileSize": 10485760,
"maxRequestsPerMinute": 1200
}- Daily automated backups
- Configurable retention period
- Backup management via admin dashboard
# Create backup via API
POST /_admin_backup
{
"name": "before-migration"
}
# Restore from backup
POST /_admin_restore
{
"backupName": "backup-2024-01-15"
}Use the admin dashboard to generate an optimized production version:
- Navigate to "Server Generator"
- Configure production settings
- Download generated server package
- Deploy to your hosting platform
- Set strong admin passwords
- Configure appropriate CORS policies
- Enable request limiting
- Set up regular backups
- Monitor request logs
const ws = new WebSocket("ws://localhost:4000/ws");
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
console.log("Real-time update:", data);
// Handle collection changes
};
// Subscribe to specific collection
ws.send(
JSON.stringify({
type: "subscribe",
collection: "users",
})
);# Products
POST /products
{
"name": "Laptop",
"price": 999.99,
"category": "electronics",
"stock": 50
}
# Orders with relationships
POST /orders
{
"customerId": 123,
"items": [
{"productId": 456, "quantity": 2}
],
"total": 1999.98
}
# Query with population
GET /orders?_populate=customer,items.product# Posts with validation
POST /posts
{
"title": "Getting Started with JSON-X Server",
"content": "This is a comprehensive guide...",
"authorId": 1,
"published": true,
"tags": ["tutorial", "api", "nodejs"]
}
# Comments relationship
POST /comments
{
"postId": 1,
"author": "John Doe",
"content": "Great article!",
"email": "john@example.com"
}We welcome contributions! Please see our Contributing Guidelines for details.
git clone https://github.com/Aladdin16659/jsonx-server
cd jsonx-server
npm install
npm run devMIT Β© Aladdin Sidahmed
- π Documentation
- π Issue Tracker
- π¬ Discussions
- π§ Email Support
Made with β€οΈ for developers who need fast, reliable JSON APIs