DEV Community

Cover image for GopServer: Turn Any Database into a REST API in 3 Minutes
Real Gop
Real Gop

Posted on

GopServer: Turn Any Database into a REST API in 3 Minutes

We've all been there. New project. Same ritual:

  1. Spin up a server (Node, Python, Go...)
  2. Configure the ORM and DB connection
  3. Write nearly identical CRUD controllers for every table
  4. Manually wire up JWT, sessions, and rate limiting

I got tired of this cycle — so I built GopServer: a single binary that turns any relational database into a production-ready REST API, with zero backend code.


✨ What is GopServer?

GopServer is a high-performance API engine written in Go. You point it at your database, edit a JSON config file, and your API is live. No recompilation. No complex deployments. Just a ~11MB static binary.

Key Features

Feature Details
🗄️ Multi-DB Support PostgreSQL, MySQL, MSSQL, Oracle, SQLite
⚡ Zero Code Add a table to tables.json → instant endpoint
🔐 Robust Security JWT, Session Cookies, Static Tokens built-in
🔍 Advanced Filtering contains, gt, isnull, sortby URL operators
🎛️ Granular Control Hide sensitive columns or lock fields from modification

🛠️ The 3-Minute Setup

Step 1 — Configure the Connection

In conf/app.conf, define your database credentials:

db_type     = postgres
db_server   = localhost
db_password = ${DB_PASSWORD}
db_name     = my_app_db
Enter fullscreen mode Exit fullscreen mode

Step 2 — Define Your Tables

In conf/tables.json, choose which tables are exposed and what actions are allowed:

{
  "products": {
    "pk": "id",
    "columns": ["id", "name", "category", "price", "stock"],
    "allow_post": 1,
    "allow_put": 1,
    "allow_delete": 0
  }
}
Enter fullscreen mode Exit fullscreen mode

Step 3 — Run & Query

Start the binary and your API is live:

./gopserver
Enter fullscreen mode Exit fullscreen mode

Filter by field:

GET /api/v1/products?category=Electronics&price__lt=500
Enter fullscreen mode Exit fullscreen mode

Bulk insert (single atomic transaction):

POST /api/v1/products  →  send a JSON array
Enter fullscreen mode Exit fullscreen mode

💻 Frontend Integration — No Token Management Needed

Because GopServer handles Session Cookies natively, you don't need to mess with localStorage or manual token headers:

const API = '/api/v1';

// Login using Session Cookies
async function login(user, pass) {
  const res = await fetch(`${API}/auth/login-session`, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ user, pass }),
    credentials: 'include'
  });
  const json = await res.json();
  if (json.success) loadProducts();
}

// Fetch data with built-in pagination
async function loadProducts(page = 1) {
  const res = await fetch(`${API}/products?limit=10&page=${page}`, {
    credentials: 'include'
  });
  const json = await res.json();
  console.log(`Page ${json.page} of ${json.total_pages}`);
}
Enter fullscreen mode Exit fullscreen mode

No middleware. No extra libraries. Just fetch.


🔑 Licensing: Try Before You Buy

  • Demo Mode (Free): On by default. GET is limited to 3 records; POST/PUT/DELETE are disabled — enough to explore and prototype.
  • Full Mode (One-Time Purchase): Tied to your hardware ID (HWID). No subscriptions, no recurring fees.

To activate: POST /activate → get your hardware code → contact vendor for your license key.


💬 What Do You Think?

GopServer was born out of my own frustration with backend boilerplate. I'd love to hear from you:

  • Which database do you use most?
  • What feature would make this fit your workflow better?

👉 Try it / Docs: api-server.app

Top comments (0)