Skip to content

harishtpj/AutoREST

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌐 AutoREST

made-with-ruby

Generate full-featured API servers for your database tables in seconds.

ℹ About

AutoREST is a database-agnostic RESTful API generator for Ruby. With just your database credentials, it scaffolds a live API server supporting CRUD operations — no Rails, no boilerplate.

Supported Databases:

  • SQLite
  • MySQL
  • PostgreSQL
  • Oracle

✨ Features

  • 🛠 Generates RESTful APIs from your database schema
  • 🔌 Pluggable DB adapter system
  • 🎛 CLI interface powered by Thor
  • 🗃 Supports major relational DBs via corresponding gems
  • 🔥 Runs on Puma + Rack

🚀 Installation

Add this line to your application's Gemfile:

gem 'autorest'

And then execute:

$ bundle install

Or install it as a gem:

$ gem install autorest

Note: Depending on the DB you use, you may need to install additional gems manually:

  • sqlite3
  • mysql2
  • pg
  • ruby-oci8

🏃🏻‍♀️ Quickstart

To get your hand on AutoREST, run:

autorest boot sqlite://[path/to/sqlite.db]/[table_name]

If you want to try with MySQL/PostgreSQL/Oracle, run:

autorest boot mysql://[username]:[password]@[host]:[port]/[database]/[table_name]

for PostgreSQL (or) Oracle, use pg:// (or) orcl:// respectively instead of mysql://

Now you can access the server at http://localhost:7914

🖥 CLI usage

  1. Via Interactive CLI
$ autorest new
  1. Via YAML config file
$ autorest server <path/to/config>.yml
  1. Via DSN
$ autorest boot mysql://[username]:[password]@[host]:[port]/[database]/[table_name]

For more information visit AutoREST documentation.

📦 Configuration example

db:
  kind: :mysql # :sqlite, :mysql, :pg, :orcl
  host: localhost
  port: 3306
  user: root
  passwd: secret
  name: mydb # for sqlite: path/to/sqlite.db, for oracle: SID
  tables: [users, posts]

server:
  host: 127.0.0.1
  port: 8080

🌐 API endpoints

Once the server is running, you can access the following RESTful API endpoints for the selected tables:

  • GET /<table> - Returns all rows from table
  • GET /<table>/:id - Returns a single row by ID (or any primary key)
  • POST /<table> - Creates a new row in table
  • PUT /<table>/:id - Updates an existing row by ID (or any primary key)
  • PATCH /<table>/:id - Updates an existing row by ID (or any primary key)
  • DELETE /<table>/:id - Deletes a row by ID (or any primary key)

The PATCH method simply allows one to update a subset of the columns, whereas the PUT method allows one to update all columns.

✍🏻 Contributing

Contributions are welcome! While the basic functionality of this project works, there is a lot of room for improvement. If you have any suggestions or find any bugs, please open an issue or create a pull request.

📝 License

Copyright © 2025 M.V.Harish Kumar.

This project is MIT licensed.

About

Generate full-featured API servers for your database tables in seconds.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published