Coder Social home page Coder Social logo

thevahidal / soul Goto Github PK

View Code? Open in Web Editor NEW
1.4K 10.0 48.0 1.04 MB

๐Ÿ•‰ A SQLite REST and realtime server

Home Page: https://thevahidal.github.io/soul/

License: MIT License

JavaScript 99.59% Shell 0.06% SCSS 0.35%
nodejs realtime rest sqlite sqlite3

soul's Issues

dev experience when running on empty db

Hey, I saw your post on HN and was curious, and have a bunch of random feedback.

I followed the readme for getting things set up. However, I didn't have an sqlite db lying around, so i made an empty one.

Studio started on a different port than 3000, probably because I'm running a different dev server on 3000, so I got a cors error when running on this different port. Possibly set cors origins to allow * in dev?

Besides that running studio I got some semi-broken UI, probably because my db is empty, and errors in console. I fixed some of them locally but ended up getting too many retries (http) errors and ended up giving up ๐Ÿ˜ญ

Anyways.. mostly a feedback around "maybe you should try to get it working with an empty db file" ?

Anyways, the concept is nice, good luck and keep it up

The `extensions.js` file throws an error when i try to run an extension

Describe the bug

I am trying to run a soul extension inside the soul/core folder but the code is throwing an error in the /core/src/extensions.js file, i have followed the instructions in here to run the extension.

To Reproduce

  1. Go to the soul/core folder and create a folder named _extensions

  2. Create a file named api.js inside the _extensions folder and copy and paste the sample extension code from here

  3. Add the path of your extension in your .env file

    EXTENSIONS=./_extensions
    
  4. Run the project

    npm run dev
    

Expected behavior
When i run the project, it throws an error in this line, it can't require the _extensions/api.js file,

Screenshots
Screen Shot 2022-12-10 at 10 58 50 PM

Additional context
The code works fine when i modify the path of the extension like this

- const apiExtensions = require(`${extensionsPath}/${extension}`);

+ const apiExtensions = require(`../${extensionsPath}/${extension}`);

Protection against SQL injection

  • Use parameterized query / prepared statement
  • Specify an environment variable to restrict transaction endpoint [default (or production) disabled]
  • Ideally, move all queries to the services directory

Fails with missing port on both Windows and Linux

Following README starting soul fails on both Windows and Linux as follows:

โฏ soul -d sqlite.db -p 8000
/mnt/c/Users/marti/AppData/Roaming/npm/node_modules/soul-cli/soul/config/index.js:32
  throw new Error(`Config validation error: ${error.message}`);
  ^

Error: Config validation error: "PORT" is required

Soul must support relative paths for extensions.

Is your feature request related to a problem? Please describe.

(#77 (comment))

Describe the solution you'd like

Soul should accept relative paths for the extensions directory. e.g. ./_extensions/

Describe alternatives you've considered

Right now we can use absolute paths. e.g. /home/user/_extensions/

Additional context
_

Soul Studio - A GUI for Soul

  • Restructure components
  • Selected tab should be shown as selected.
  • Add new record option
  • Option for selecting multiple row and deleting them
  • All cells should be editable
  • Add filters, limiting and fields option
  • All columns should be sort-able
  • Option for extending related fields
  • Add icon for the type of column in column headers next to the name
  • Reset all filters option
  • Add closable table tabs feature
  • Add option for opening new tab
  • Options as query params for persistence
  • Better styles
    • Infinite rows (and columns)
    • No white background
    • Awesome horizontal scroll experience
    • Light theme

Improve project structure

Right now Soul has no structure, but we need to change it!

-- 
-- soul/
  -- services/
  -- controllers/
  -- routes/
    -- tables/
    -- rows/
  -- index.js

Host static web-content

Is your feature request related to a problem? Please describe.

I'm trying to run react-admin against a SQLite file wrapped in Soul. But, I'm having CORS issues. I saw the .env.sample file - containing the WHITELIST, and renamed it to .env - but it didn't fix the issue. Yes, the URL in the file matches the actual origin (localhost:3000) of my node server. Update: a few minutes later the CORS issue is resolved. Silly Ian mistakenly tried to modify the behaviour of an installed instance of Soul by modifying a file in a source repo. When I ran Soul from the repo the .env trick worked perfectly :-)

I remain interested in the idea of running static content from within Soul.

Describe the solution you'd like

One solution for the above would be for the Soul server to host static web content in a sub-folder. This would neatly prevent my CORS issues, and result in one less server process (node) running on my machine.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Hmm, on reflection would an extension be a way to do this? We'd create an extension called root, that serves index.html from the root folder. Would that do it @thevahidal ?

Screenshot of studio in readme

The repo readme refers to studio, and how to start it. But, it doesn't explain the role of studio.

A picture (well, screenshot) of soul studio in the readme would paint a thousand words, IMHO.

Thanks. After upgrade it fails with:

    Thanks. After upgrade it fails with:
PS C:\Users\marti\tmp\soul-test> soul -port 8080 -d sakila.db
C:\Users\marti\AppData\Roaming\npm\node_modules\soul-cli\src\config\index.js:43
  throw new Error(`Config validation error: ${error.message}`);
  ^

Error: Config validation error: "NODE_ENV" is required

Originally posted by @maacl in #48 (comment)

Failure installing on Apple Silicon

OS: macOS Ventura 13.0
Architecture: arm64
Node: v14.20.1
NPM: 6.14.17

MacBook-Pro โžœ  npm install -g soul-cli
/Users/justin/.nvm/versions/node/v14.20.1/bin/soul -> /Users/justin/.nvm/versions/node/v14.20.1/lib/node_modules/soul-cli/soul/index.js

> [email protected] install /Users/justin/.nvm/versions/node/v14.20.1/lib/node_modules/soul-cli/node_modules/better-sqlite3
> prebuild-install || npm run build-release

prebuild-install warn install No prebuilt binaries found (target=14.20.1 runtime=node arch=arm64 libc= platform=darwin)

> [email protected] build-release /Users/justin/.nvm/versions/node/v14.20.1/lib/node_modules/soul-cli/node_modules/better-sqlite3
> node-gyp rebuild --release

  TOUCH ba23eeee118cd63e16015df367567cb043fed872.intermediate
  ACTION deps_sqlite3_gyp_locate_sqlite3_target_copy_builtin_sqlite3 ba23eeee118cd63e16015df367567cb043fed872.intermediate
  TOUCH Release/obj.target/deps/locate_sqlite3.stamp
  CC(target) Release/obj.target/sqlite3/gen/sqlite3/sqlite3.o
  LIBTOOL-STATIC Release/sqlite3.a
env: python: No such file or directory
make: *** [Release/sqlite3.a] Error 127
rm ba23eeee118cd63e16015df367567cb043fed872.intermediate
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/justin/.nvm/versions/node/v14.20.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:285:12)
gyp ERR! System Darwin 22.1.0
gyp ERR! command "/Users/justin/.nvm/versions/node/v14.20.1/bin/node" "/Users/justin/.nvm/versions/node/v14.20.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /Users/justin/.nvm/versions/node/v14.20.1/lib/node_modules/soul-cli/node_modules/better-sqlite3
gyp ERR! node -v v14.20.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build-release: `node-gyp rebuild --release`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build-release script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/justin/.npm/_logs/2022-10-29T23_55_45_410Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `prebuild-install || npm run build-release`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/justin/.npm/_logs/2022-10-29T23_55_45_567Z-debug.log

Soul must be extendable

To be able to be adapted to any needs, Soul needs to be extendable, because no matter how many built-in features it offers, eventually, people come with unique needs that the Soul can't and shouldn't have an answer for them.

For now, I'm thinking of three types of extensions:

  1. API extensions: A way to add new APIs besides the default ones
    • e.g. /api/greeting which returns a greeting message.
  2. Middleware extensions:
    • e.g. Auth middleware which forces authentication on endpoints.
  3. Callback extensions:
    • e.g. After adding a row do an action

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.