Giter Site home page Giter Site logo

shivansh-yadav13 / sqlite-ui Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 11.0 542 KB

Web ๐ŸŒ based Admin Interface for SQLite ๐Ÿ—‚๏ธ Database.

License: MIT License

Go 32.96% HTML 65.14% CSS 0.16% Dockerfile 1.32% JavaScript 0.42%
css fiber-framework golang html docker sqlite sqlite3 hacktoberfest hacktoberfest2020

sqlite-ui's Introduction

SQLite-UI

๐ŸŒ SQLite UI

SQLite UI is a web user interface for SQLite database built with Golang. It is built in Golang using the Fiber package. Fiber is an Express inspired web framework You can read more about it here. Project is right now at it's very intial stage and under developement. Our plan is to make this a Good Open Source project, where people can easily start contributing, fix bugs and add more features ๐Ÿ™‚.

๐Ÿ”ง Usage

Step 1:

Pull Docker Image.

docker pull ghcr.io/shivansh-yadav13/sqlite-ui:latest

Step 2:

Start Docker container using:

docker run -p 3000:3000 -v { location of db file }:/app -e SQLITE_NAME=/app/{ db file name } shivansh-yadav13/sqlite-ui:latest

Optional: You can also use the --name and -d for the name of the container and for running in detached mode.

๐Ÿ’ป Set up Project Locally

1.) Fork the repository by click the Fork button at the top right of the page.

Screenshot from 2022-09-22 12-07-47

2.) Navigate to a directory, open the terminal and paste the following command and replace your-github-username with your GitHub username:

git clone https://github.com/your-github-username/SQLite-UI.git

3.) Build the TailwindCSS bundle, see https://tailwindcss.com/docs/installation for instruction to install the cli.

./tailwindcss -i ./static/css/app.css -o ./static/css/build.min.css --minify

4.) Now we are ready to start the server, run the following:

$ go run main.go

This will create an empty data.db in the current directory. Alternatively, you can also pass in an existing database file as follow:

$ SQLITE_NAME=<path-to-db-file> go run main.go

5.) Now you can visit localhost:3000 and you will be able to see:

Screenshot from 2022-09-22 12-21-21

๐Ÿ‘ฅ Contributors

Contributors

sqlite-ui's People

Contributors

arshad-k7 avatar dependabot[bot] avatar hamees-sayed avatar johnhorsema avatar magnaibayarmn avatar shivansh-yadav13 avatar vantekken avatar wliao008 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

sqlite-ui's Issues

Front end layout

As discussed in #6, incorporate tailwindcss and setup a dashboard style structure for the app.

[feat] Datatables that can be customized, sortable and filterable by column for Table Page

Is your feature request related to a problem? Please describe.
Thanks to @wliao008's #29 PR, we are able to have paginated tables.
However, in terms of UI, the lack of interactivity and features of the current plain HTML table makes it difficult to filter and customize the table view.

Describe the solution you'd like
The Datatables component should be able to render an interactive table where the user is able to:

  • show/hide columns
  • sort by column
  • filter by column
  • Download as CSV (TBC)

Describe alternatives you've considered
Existing no-code tools like NocoDB and Baserow already has such Datatable components written in Vue.
We can take reference from these implementations.
nocodb/nocodb
bram2w/baserow

Additional context
N/A

Support custom query when viewing data

When viewing data, allow the query to be customized. For ex, user might want to see a few columns instead of all, or might need to join with other tables, etc. The end result could be something like this:

Screen Shot 2022-10-20 at 9 00 33 AM

[feat] support for all sqlite file extensions

Issue
Sqlite database support the following file extensions
.sqlite, .sqlite3, .db, .db3, .s3db, .sl3
but sqlite-ui can only open files with .db extension.

Solution
Make the db uri flexible and allow the users to pass in file name along with the extension

db.ConnectDB(fmt.Sprintf("./sqlite_database/%s.db", dbName))

Feat: Implement `GetSQLQuery` method

We need to display the query using which the same table can be created.

Execute the query as done in the GetTables() method.

[feat]: de-duplicate the layout

The current layout is duplicated across all the pages, which is not ideal if a change is needed.

Break the layout into different templates so the layout can be "composed". The desired outcome of this, is that a new page should be self-contained.

Our current layout structure is pretty simple, mainly a left nav and a right content area. I can see something like this:

{{ define "header" }}
  ... all the header + nav element here ...
{{ end }}
{{ define "footer" }}
  ... all the footer element here ...
{{ end }}

Then in any given page, for ex when viewing the table data:

{{ template "header" . }}
... the actual data specific to this page ...
{{ template "footer" . }}

Switch to a smaller base docker image

The current docker image is base off golang:1.18, which is 900+mb when pulled down. It's not needed to run the actual end program.

There are 2 ways that this can be approached:

  1. Use a 2 step build process: build the app in the golang container, then copy the resulting binary onto a smaller image, all done via the Dockerfile.
  2. Build the app outside of the container, maybe via a Makefile, and copy the resulting binary to a smaller image.

Alpine is a pretty good choice, this'd cut the size down from 900+mb to around ~20mb.

[Feature] Add option for adding columns to the table

Create a form on templates/table_view.html which will send a post request to a route which will add a column to a particular table.
The form should also have options available when adding columns like Primary Key, DataType, Not null etc.
The name of the table can be taken from the url params.

steps:

  • Create a method for the above task on the db package.
  • Then create a handler in the routes package which will call method from the db package.
  • Create a route for the above handler.
  • Create form on templates/table_view.html and send the post request to the above route.

View data of a given table

When a user clicks on a table, we need to get and display the data, in an efficient way.

Something to think about:

  • What if the table has millions of row.
  • What if the table has tons of columns.
  • What is some fields has long text or big blob.

Of these, the first is probably the biggest concern, so at the very least, have pagination in place.

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.