LiveCodeServer-database-API is a database-agnostic API with industrial security, and can be adapted to any project. Using Server, you can do all database operations over HTTP using RPC (remote procedure call) rather than REST, which seems a more natural fit for LiveCode.
The repo is available at https://github.com/stam66/LiveCodeServer-database-API.
This project was derived from an effort to provide HTTP access to a MySQL database I'm using in a webapp project (not LiveCode), where I wanted to write companion apps (probably in LiveCode) to use the same database, and actually wanting to play with Server I guess.
Server is the middleware on the remote server that bridges between client app and database. I generated a working version of this, but then I got Claude Code to review my repo, and it surprised me with a large number of critical vulnerabilities I hadn't even considered (like preventing hackers from using time to response as a way of predicting chars in the password, MIME-sniffing, IP-based rate limiting, etc).
With Claude's help, I've created a rock-solid API for my project and then got it to help create a generalisable API, that can be used either with MySQL, PostreSQL, SQLite or ODBC - there are templates for all and a generic endpoint template. It also includes a template for data audit that will capture any data changes in detail automatically.
In short, you would create an API directory on your server that has a database configured and LiveCode Server installed, copy the basic files and modify some templates for your specific setup and it should just work (he says...).
Security features include:
Security Headers
- X-Content-Type-Options: Prevents MIME-sniffing
- X-Frame-Options: Prevents clickjacking
- X-XSS-Protection: Enables browser XSS protection
- CORS: Cross-origin resource sharing configured
- CSP: Content Security Policy
- validateNumericID() - Validates and sanitizes numeric IDs
- sqlEscape() - Escapes SQL special characters
- JWT-based authentication with HMAC-SHA256 (JSON Web Token)
- Constant-time password comparison (timing attack protection)
- Token expiration (default: 30 minutes)
- Salted password hashing with PBKDF2-like approach
- IP-based rate limiting (configured per endpoint)
- Automatic cleanup of expired limits
- Proxy/load balancer support (X-Forwarded-For)
Feedback/comments welcome here and (preferably) on GitHub - just raise an issue at https://github.com/stam66/LiveCodeServer-database-API.
Stam