A Visual SQL Query Viewer for Node.js Beginners



🚀 QueryScope — A Simple SQL Query Viewer for Node.js Beginners

Have you ever wished you could run SQL queries and instantly see the results in your browser — without setting up a full database or opening a terminal?

That’s exactly why I built QueryScope 🧠💡


What is QueryScope?

QueryScope is a beginner-friendly SQL query viewer built using Node.js, Express, EJS, and @electric-sql/pglite.

It allows you to write queries in a simple .sql file, run them automatically, and see the results beautifully formatted in your browser — all in one place.

It’s perfect for:

  • Students learning SQL or Node.js

  • Developers experimenting with SQL queries

  • Anyone who prefers visual data over terminal output


Why I Built It

When learning SQL, most tutorials focus on databases and terminal outputs. But as a beginner, I wanted something more interactive — something that shows results visually and helps me understand what each query is doing.

That’s how QueryScope was born — a small but powerful tool to make learning databases fun, visual, and beginner-friendly.


How It Works

Here’s what happens under the hood:

  1. You write queries inside query.sql.

  2. The app reads and cleans them (removes comments).

  3. Queries are executed using the PGlite in-memory SQL engine.

  4. Results are sent to an EJS template.

  5. You open http://localhost:8000 — and boom 💥, your data is neatly displayed!

No PostgreSQL server, no database config — just Node.js and your queries.


Tech Stack

QueryScope uses:

  • Node.js + Express – backend and server

  • EJS – renders query results as HTML

  • @electric-sql/pglite – lightweight in-memory SQL engine

  • CSS (optional) – add styling or a dark theme


Folder Structure

QueryScope/
│
├── index.js          # Main server logic
├── query.sql         # Write your SQL queries here
│
├── views/
│   └── cars.ejs      # Template for displaying query results
│
└── public/
    └── style.css     # Optional styling

Example Query

Here’s a fun example:

/* Show unsold Dodge cars from the 60s, or Ford/Triumph cars from the 70s */
SELECT brand, model, year, sold
FROM cars
WHERE ((brand = 'Dodge' AND year BETWEEN 1960 AND 1969)
    OR (brand IN ('Ford', 'Triumph') AND year BETWEEN 1970 AND 1979))
  AND sold IS NOT TRUE;

Open your browser and see the results instantly — no terminal required!


Why It’s Useful for Learning

  • Learn Node.js + SQL integration without external DB setup

  • Understand how Express routes render templates

  • See queries being parsed, filtered, and displayed visually

  • Gain confidence writing backend + database mini projects


How to Run It

git clone https://github.com/yourusername/QueryScope.git
cd QueryScope
npm install
npm start

Then open http://localhost:8000 in your browser. 🎉

Boom — live SQL in your browser!


Future Enhancements

I’m planning to add:

  • Theme switcher (dark/light mode)

  • 🔁 Auto reload on query changes

  • 🔍 Search and filter for results

  • 📄 Export as CSV


Final Thoughts

QueryScope isn’t just a tool — it’s a learning playground. It helps new developers see SQL come alive visually and understand how the backend and database layers connect.

If you’re new to Node.js or databases, give it a try — your first “mini SQL app” can be running in minutes!

📦 GitHub Repository: github.com/vzl-rbi/QueryScope

⭐ Don’t forget to star the repo if you find it helpful!


Post a Comment

Previous Post Next Post
Put Your Advertisement Here