Git Product home page Git Product logo

sql-hasher-app's Introduction

SQL Query Hasher App

Description

This is a Next.js project bootstrapped with create-next-app. It provides a web interface for hashing SQL query column names. It features a SQLite database to store and manage the hashed column names, an API for hashing queries, and a front-end for user interactions. The application allows users to input SQL queries, returns queries with hashed column names, and provides the ability to view and delete entries in the database.

A weekend project. Full blog about it will follow soon!

Getting Started

Prerequisites

  • Node.js (minimum v18 for compatibility with latet Next.js)
  • Docker and Docker Compose (for deployment)

Cloning the Repository

To clone the project and get started, run the following commands:

git clone https://github.com/ahmad-alkadri/sql-hasher-app.git
cd sql-hasher-app

Installation and Dev Mode

To install all necessary Node.js packages, simply run:

npm install

And finally, to run the application in Development mode:

npm run dev

This will start the Next.js development server, by default accessible at http://localhost:3000.

Development

Making Code Changes

Just like typical Next.js app, the structure of the application is as follows:

  • pages/api: Contains the API endpoints, including hashing logic and database interactions
  • pages/index.js: The main front-end component of the application.
  • Additional utility scripts and components as needed.

Running Tests

This project uses Jest for unit testing. To run the tests:

npm test

The tests cover:

  • API endpoints functionality (hashing and database interactions).
  • hashAllColumnRefObjects function correctness.

More test cases will follow. You're also free to contribute to more test cases.

Deployment

Currently there's only one mode of deployment, that is, using Docker Compose for local deployment.

Deploying with Docker Compose

  1. Build the Docker image:
docker-compose build
# For new build without cache at all: 
# `docker-compose build --no-cache`
  1. Start the application:
docker-compose up -d # In detached mode

The two commands above will build the Docker image, run tests, and if successful, start the application. The app will be accessible at http://localhost:3000 or the respective host's IP address.

  1. Stop the application:
docker-compose down
  1. Remove docker containers completely (optional):
docker-compose down --rmi all -v

sql-hasher-app's People

Contributors

ahmad-alkadri avatar dependabot[bot] avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.