What You Get

What You Get

Automatically exposed CRUD API endpoints.

πŸ“ Exposed API Endpoints

GET    /api/{model}      # List all
POST   /api/{model}      # Create
GET    /api/{model}/:id  # Get one
PATCH  /api/{model}/:id  # Update
DELETE /api/{model}/:id  # Delete

πŸ“Š Example Model

  • users β†’ /api/users
GET    /api/users      # List all users
POST   /api/users      # Create user
GET    /api/users/1    # Get one user
PATCH  /api/users/1    # Update user
DELETE /api/users/1    # Delete user

πŸ”’ Protected Fields

By default, the following fields cannot be updated:

  • id
  • createdAt
  • created_at

🎨 Custom Restrictions (Optional)

To customize which fields are updatable for a model, update customUpdatableFields in server/utils/modelMapper.ts:

// server/utils/modelMapper.ts
export const customUpdatableFields = {
  users: ["name", "avatar"], // Only these fields
};

πŸ’‘ Key Features

  • βœ… Auto-discovers models from the schema
  • βœ… Auto-detects updatable fields
  • βœ… Smart naming with pluralization
  • βœ… Zero configuration required

Just add a schema β†’ Run the migration β†’ Done!