Git Product home page Git Product logo

saltcorn's Introduction

Saltcorn Banner

Build and Test OpenCollective

Saltcorn

Saltcorn is an extensible open source no-code database application builder. Use it to build web applications based on relational data with flexible views, datatypes and layouts.

This repository contains the core codebase, including the code necessary to self-host an instance and to host a multitenant instance.

Trying out Saltcorn

A multitenant instance of Saltcorn is running at saltcorn.com, and you can create a new application under a subdomain at https://saltcorn.com/tenant/create. This service is free but there are no guarantees about the security or availability of your application or the information you are storing. This service should only be used to explore the capabilities of saltcorn.

For self-hosting, a 1 GB virtual private server is sufficient to run Saltcorn unless you expect high traffic volumes. Installation instructions are given below. If hosting on DigitalOcean, which offers a 1GB virtual machine for $5 per month, please consider using my referral code which will give you $100 credit over 60 days.

Acknowledgements

Saltcorn is using PostgreSQL, node.js, node-postgres, express, live-plugin-manager, craft.js, jQuery-Menu-Editor, Blockly, CodeMirror and other awesome free and open source projects.

Quickstart with Docker

You can run a local instance for quick testing by running the following command:

cd ./deploy/examples/test && docker-compose up -d

and then go to http://localhost:3000 in your web browser.

NOTE: The dependencies to build mobile apps are quite large, they are not installed in the standard docker image (saltcorn/saltcorn). To use an image that includes the mobile dependencies as well, either use 'saltcorn/saltcorn-with-mobile' directly or replace 'saltcorn/saltcorn' with 'saltcorn/saltcorn-with-mobile' in the docker-compose file.

Quick install server on Debian/Ubuntu

This has been tested on Debian 10, 11 and 12, Ubuntu 18.04, 20.04 and 22.04, OpenSuSE, AlmaLinux, and Fedora. All you need is to run these three lines on the command line shell, as root or as a user with sudo access:

wget -qO - https://deb.nodesource.com/setup_16.x | sudo bash -
sudo apt-get install -qqy nodejs
npx saltcorn-install -y

The first two lines will install Node.js 16 (you can also use 18 or 20). The last line will call the Saltcorn install script accepting all the defaults, which installs PostgreSQL and sets up Saltcorn as a service listening on port 80.

If you want a different port, different database backend, or to not install as a service, you can omit the final -y to get an interactive installation:

wget -qO - https://deb.nodesource.com/setup_16.x | sudo bash -
sudo apt-get install -qqy nodejs
npx saltcorn-install

Install from NPM packages

Instructions have been tested on Ubuntu 20.04 on a 1GB VM.

TL;DR: npm install -g @saltcorn/cli && saltcorn setup

Installing node and npm

For a recent version (v16) of Node.js:

wget -qO - https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs libpq-dev build-essential python-is-python3

You can also use Node 18 or 20.

Install saltcorn

npm install -g @saltcorn/cli

If this fails, you may need to tell npm to disregard file permissions during compilation:

npm install -g @saltcorn/cli --unsafe

Sometimes, the above commands fail to install the library sd-notify (which is useful for integrating with systemd) even though it is installable. You can rectify that by installing it subsequently:

npm install -g sd-notify

Setup (automated)

if you are root, create a user with sudo and switch to that user:

adduser saltcorn
adduser saltcorn sudo
su saltcorn
cd
mkdir -p ~/.config/

then run

saltcorn setup and follow the instructions given.

Setup (manual)

NOTE: this is somewhat out of date; see instead https://wiki.saltcorn.com/view/ShowPage?title=Install%20on%20Ubuntu, in paticular the last section.

Skip this section if you ran saltcorn setup or npx saltcorn-install

  1. Install PostgreSQL: sudo apt install postgresql postgresql-client

  2. Either,

    • Create a JSON file .saltcorn in your XDG config directory (on Ubuntu this is normally $HOME/.config) with these values:

      • host: address of PostgreSQL server
      • port: port of PostgreSQL server
      • database: PostgreSQL database
      • user: PostgreSQL user name
      • password: PostgreSQL user password
      • sslmode: PostgreSQL SSL Mode
      • sslcert: PostgreSQL SSL Certificate
      • sslkey: PostgreSQL SSL Key
      • sslrootcert: PostgreSQL SSL Root Certificate
      • session_secret: Saltcorn session secret
      • multi_tenant: run as multi-tenant (true/false)

      For example:

      {
         "host":"localhost",
         "port":5432,
         "database":"saltcorn",
         "user":"tomn",
         "password":"dgg2342vfB",
         "session_secret":"hrh64b45b3",
         "multi_tenant":true
      }
      

      Or,

    • Set environment variables. SALTCORN_SESSION_SECRET, SALTCORN_MULTI_TENANT (defaults to false), and either DATABASE_URL or PGHOST, PGPORT, PGUSER, PGDATABASE, PGPASSWORD. You can also set PGSSLMODE, PGSSLCERT, PGSSLKEY, PGSSLROOTCERT (see Postgres Documentation)

Run

saltcorn serve

Server install

Install saltcorn as a service

Installing saltcorn as a service will mean it runs in the background and restarts automatically if the system reboots.

create a file /lib/systemd/system/saltcorn.service with these contents:

[Unit]
Description=saltcorn
Documentation=https://saltcorn.com
After=network.target

[Service]
Type=notify
WatchdogSec=5
User=saltcorn
WorkingDirectory=/home/saltcorn
ExecStart=/home/saltcorn/.local/bin/saltcorn serve -p 80
Restart=always
Environment="NODE_ENV=production"

[Install]
WantedBy=multi-user.target

run:

sudo systemctl daemon-reload
sudo systemctl start saltcorn
sudo systemctl enable saltcorn

This may be in a different location in non-Debian systems, e.g. in /etc/systemd/system instead.

In order to allow the saltcorn user to open port 80, you need to permission node.js to allow this by running:

sudo setcap 'cap_net_bind_service=+ep' `which node`

SSL certificate

Use Let's Encrypt or Cloudflare to get a free SSL certificate (for https).

Install from source (for saltcorn developers)

Installing node and npm on Ubuntu

sudo apt install nodejs npm libpq-dev

will give you a usable version. For a more recent version (v16) of Node.js:

wget -qO - https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs libpq-dev

Prepare Node

assuming you have cloned this repository to $HOME/saltcorn (otherwise adjust PATH)

npm config set prefix ~/.local
echo 'export PATH=$HOME/saltcorn/packages/saltcorn-cli/bin:$HOME/.local/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

Install packages

run

npm install --legacy-peer-deps
npm run tsc

to install everything. If successful, you should now be able to run saltcorn in your shell.

NOTE: the installation builds the 'saltcorn/cordova-builder' docker image, and the first build takes several minutes. You can set the environment variable SKIP_DOCKER_IMAGE_INSTALL to 'true' (or disable docker) if you don't want to build it.

Packages

Development tips

Prettier

we use prettier:

npm install -g prettier

to format code:

git ls-files | grep -v builder_bundle | xargs prettier --write

Run this before every pull request.

dev server

nodemon packages/saltcorn-cli/bin/saltcorn serve

to also watch a local module

nodemon --watch ../saltcorn-kanban/ packages/saltcorn-cli/bin/saltcorn serve

React build builder

cd packages/saltcorn-builder
npm install
npm install [email protected]
npm run build

React rebuild on save

in saltcorn/packages/saltcorn-builder/ run:

git ls-files | entr npm run builddev

but this is not a production build, so run

npm run build

when done.

If you get this error: Error: error:0308010C:digital envelope routines::unsupported, run this and try again: export NODE_OPTIONS=--openssl-legacy-provider.

Build tsdocs

npm install --legacy-peer-deps
npm run tsc

then

npm run docs

TSDocs will then be available in docs/.

To deploy these to https://saltcorn.github.io/tsdocs/:

cp -R docs/* /path/to/tsdocs
cd /path/to/tsdocs
git add .
git commit -am 'version number or other message...'

saltcorn's People

Contributors

aleksandrsokolov avatar alfonsolr09 avatar atozzio avatar bexicaaa avatar christianhugoch avatar dependabot[bot] avatar deranjer avatar djalal avatar gianlucafiore avatar gilanghamidy avatar globalcow avatar glutamate avatar gxpcluster avatar hainecki avatar hakdo avatar igorkb avatar jenslw avatar kevin8181 avatar kkumara3 avatar lubeda avatar mhier avatar olifink avatar pyhedgehog avatar snyk-bot avatar trivikr avatar wpguide1 avatar zinkh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

saltcorn's Issues

Problem with install on Ubunty 18

root@XXX:~# npm install -g @saltcorn/cli
npm WARN deprecated [email protected]: request has been deprecated, see https://git hub.com/request/request/issues/3142
npm WARN deprecated [email protected]: this library is no longer supported
/usr/bin/saltcorn -> /usr/lib/node_modules/@saltcorn/cli/bin/saltcorn

[email protected] install /usr/lib/node_modules/@saltcorn/cli/node_modules/connect -sqlite3/node_modules/sqlite3
node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and node@ 14.10.0 (node-v83 ABI, glibc) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/usr/lib/node_modu les/@saltcorn/cli/node_modules/connect-sqlite3/node_modules/sqlite3/lib/binding'
gyp WARN EACCES current user ("nobody") does not have permission to access the d ev dir "/root/.cache/node-gyp/14.10.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_m odules/@saltcorn/cli/node_modules/connect-sqlite3/node_modules/sqlite3/.node-gyp "
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/@s altcorn/cli/node_modules/connect-sqlite3/node_modules/sqlite3/.node-gyp'
gyp ERR! System Linux 4.15.0-117-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gy p/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/lib/node_mod ules/@saltcorn/cli/node_modules/connect-sqlite3/node_modules/sqlite3/lib/binding /node-v83-linux-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_pa th=/usr/lib/node_modules/@saltcorn/cli/node_modules/connect-sqlite3/node_modules /sqlite3/lib/binding/node-v83-linux-x64" "--napi_version=6" "--node_abi_napi=nap i" "--napi_build_version=0" "--node_napi_label=node-v83"
gyp ERR! cwd /usr/lib/node_modules/@saltcorn/cli/node_modules/connect-sqlite3/no de_modules/sqlite3
gyp ERR! node -v v14.10.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_mo dules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build -- module=/usr/lib/node_modules/@saltcorn/cli/node_modules/connect-sqlite3/node_mod ules/sqlite3/lib/binding/node-v83-linux-x64/node_sqlite3.node --module_name=node _sqlite3 --module_path=/usr/lib/node_modules/@saltcorn/cli/node_modules/connect- sqlite3/node_modules/sqlite3/lib/binding/node-v83-linux-x64 --napi_version=6 --n ode_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
node-pre-gyp ERR! stack at ChildProcess. (/usr/lib/node_modules/@ saltcorn/cli/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:314:20)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1047:16)
node-pre-gyp ERR! stack at Process.ChildProcess.handle.onexit (internal/chi ld_process.js:287:5)
node-pre-gyp ERR! System Linux 4.15.0-117-generic
node-pre-gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/@saltcorn/cli/n ode_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/lib/node_modules/@saltcorn/cli/node_modules/connect-s qlite3/node_modules/sqlite3
node-pre-gyp ERR! node -v v14.10.0
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp /bin/node-gyp.js configure --fallback-to-build --module=/usr/lib/node_modules/@s altcorn/cli/node_modules/connect-sqlite3/node_modules/sqlite3/lib/binding/node-v 83-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/usr/lib /node_modules/@saltcorn/cli/node_modules/connect-sqlite3/node_modules/sqlite3/li b/binding/node-v83-linux-x64 --napi_version=6 --node_abi_napi=napi --napi_build
version=0 --node_napi_label=node-v83' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build
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 log ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-09-09T13_55_30_907Z-debug.log

Feature: support external identity provider

As an application admin in Saltcorn
I should be able to configure an external identity provider (IdP) in my application
In order to grant users access based on roles/profiles defined in my corporate identity management solution.

I'd like to integrate Saltcorn to our cloud platform but without capability to centralize user/roles management such as Keycloak for all apps developed by users, enterprise use cases will quickly be limited.

We may be able to help if you provide some guidance.
And thanks for nice work!

[/tenant/create] Add more fields

This is idea for improvement.

I suggesting to add few optional fileds to https://saltcorn.com/tenant/create
image

The suggested fields:

  1. Site name (currently accessable in Configuration\Site Name)

  2. Site admin email -> will be saved in tenant information at main site and available in [/tenant/list] . See issue #296
    In future also we can add:
    2.1. copy admin user info from main site to tenant -> this will allow to create tenant with predefined admin user
    2.2. send email to admin user with invitation to work with tenant

  3. Site logo (currently accessable in Configuration\Site logo)

  4. Default language (when it will be in Configuration)

  5. Choose common "Visibilty" of App.

Also add description that fields are optional and can be defined later in Configuration.

May be some other fields can be suitable.

Also I think that Configuration\basic url need to be set by default to Application name (subdomain name) after creation of site.

P.S. Also we need to test creation of subdomain with cyrilics characters - i ll do this later.

[Enhancement request] better date formatting

Hello,
Right now dates are shown this way :
2020-01-01T00:00:00.000Z which is understandable, but for most people will not get it, I saw you're using moment.js in saltcorn, so it wouldn't be complicated to get a more human readable date like 2020-01-01 00:00, what would be better is to let users choose the formatting according to their languages or to their needs.
Thanks ๐Ÿ˜Š I tried to do it myself but iam afraid to break everything .

Probleb - If admin deleted field (column in table) the Saltcorn should delete this field from view or ...

Or do some else to avoid the exceptions on run time like:

User
TypeError: Cannot read property 'type' of undefined
at new Field (/usr/lib/node_modules/@saltcorn/cli/node_modules/@saltcorn/data/models/field.js:13:12)
at /usr/lib/node_modules/@saltcorn/cli/node_modules/@saltcorn/data/base-plugin/viewtemplates/list.js:118:17
at Array.forEach ()
at Object.get_state_fields (/usr/lib/node_modules/@saltcorn/cli/node_modules/@saltcorn/data/base-plugin/viewtemplates/list.js:116:19)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async View.get_state_fields (/usr/lib/node_modules/@saltcorn/cli/node_modules/@saltcorn/data/models/view.js:41:14)
at async View.get_state_form (/usr/lib/node_modules/@saltcorn/cli/node_modules/@saltcorn/data/models/view.js:207:22)
at async /usr/lib/node_modules/@saltcorn/cli/node_modules/@saltcorn/server/routes/view.js:29:26
A report has been logged and a team of bug-squashing squirrels has been dispatched to deal with the situation.

[Markdown] Exception on empty values

The scenario:

  1. Open Edit View for table record with empty markdown field

  2. Close Edit.

  3. You will receive message:
    image

  4. Try to open List View for this table. You'll receive exception:

Internal Error
Error: Input data should be a String
at MarkdownIt.parse (/home/saltcorn/plugin_packages/markdown-it/lib/index.js:519:11)
at MarkdownIt.render (/home/saltcorn/plugin_packages/markdown-it/lib/index.js:544:36)
at Object.run (/home/saltcorn/plugin_packages/@saltcorn/markdown/markdown.js:18:44)
at Object.key (/usr/lib/node_modules/@saltcorn/cli/node_modules/@saltcorn/data/base-plugin/viewtemplates/viewable_fields.js:160:59)
at /usr/lib/node_modules/@saltcorn/cli/node_modules/@saltcorn/markup/table.js:95:73
at Array.map ()
at /usr/lib/node_modules/@saltcorn/cli/node_modules/@saltcorn/markup/table.js:94:20
at Array.map ()
at /usr/lib/node_modules/@saltcorn/cli/node_modules/@saltcorn/markup/table.js:91:22
at newf (/usr/lib/node_modules/@saltcorn/cli/node_modules/contractis/contract.js:66:45)
at Object.run (/usr/lib/node_modules/@saltcorn/cli/node_modules/@saltcorn/data/base-plugin/viewtemplates/list.js:211:10)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async View.run (/usr/lib/node_modules/@saltcorn/cli/node_modules/@saltcorn/data/models/view.js:141:12)
at async /usr/lib/node_modules/@saltcorn/cli/node_modules/@saltcorn/server/routes/view.js:28:20
A report has been logged and a team of bug-squashing squirrels has been dispatched to deal with the situation.

Calendar View

Idea to improvement.

Add Calendar view to Saltcorn.

Feature: [View] Allow to set date representation

version 0.2.2
I think that we need to support Date Format like YYYY-MM-DD e.g. for output Date values in views.

image

  1. I suggest to have ability to define common data / time formats for particular tenant.

  2. Also in concrete view for cocnrete date field it will be great to have ability to set up date format.

Translations

How could I translate Saltcorn? Is there a way to create translations besides hardcoding, so that different users could select different languages?

Link in table

When rendering table content as a link, the link points to a page that doesn't exist, link should rather open a modal or a Show/Edit view of the item clicked.
Example :
image
After click
image

Idea to Add login name for the user

Currently only email used to identify user of Saltcorn site.

The more familiar practice that user also can define user name or nickname and use it as login name.

Login name should be unique.

Idea to Add functionality of regular backup

  1. Regular backups should be performed on a schedule.

  2. Regular backups should be stored in filesystem.

  3. Parameters for backup: schedule (aka crontab 0 0 * * * - everyday at 00 00), path to store backup files

  4. Parameters should be saved in saltcorn confuguration.

Feature: Clone current record in List View.

The idea is to have ability to quickly do clone of current record of table data.

This is can be combination of Action in Row with Link to other view.

For example if we will base on "Link to other view":
image

So has to be defined additional control "Action" where Admin can choos:

  • Edit
  • Clone

If Admin choose Clone than:

When User click to clone
The Saltcorn opens RecordEdit view (in example IssueTypeEdit) populated with data from current record.

User changes data and click to Save.

The Saltcorn creates new record based on user input,

[/auth/login] Amount of login failure attempts and capture

I suggest to add check for amounts of login failure and add capture input after X failure attemps on login screen.

The amount of login failures has to be defined in configuration.
The default value is 3.
If it equals to zero than amount hasnt limit.

Imho The amount of login attempts and capture are important protection from bots and hackers.

Feature request : Filter and sort data in a list view

I know this is possible by using search filter, but sometimes we need to have prefiltered list view, for example i have a table with projects, some of them are current while others are archived, i need a view with only current projects, so i can show it in my dashboard depending on the archived toggle.

[/auth/login] the language for Login screen

Related to #264.

image

The problem - the login screen shows language that browser set as default.

Scenario to repeat:

  1. Change user language in user settings from default language for your browser

  2. Logout

  3. I'll see login screen in default language for browser

My suggestion is to add language picker to login screen to allow change language on login screen or save in cookies current language.

Support of mysql

I just want to give some valuable support for the project. So ill try to develop mysql support on weekends.

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.