- svelte is the hot new FE dev stuff. do the tutorial to get hooked. SvelteKit - its equivalent of SSR framework, not unlike next.js
- postgrest is a really nice backend to quickly prototype apps by definining data & permissions, without having to write backend.
- every layout is a fresh approach to plain css, with reusable components that make sense. borrowed from SilvanCodes/svelte-layout-components.
- some social login love thrown in for good measure, uses beyonk-adventures/svelte-social-auth
- tmux is used to run multiple processes and an editor, because nothing beats tmux and emacs (use web-mode to edit svelte!)
- postgrest - install according to instructions.
- pgjwt - postgresql jwt extension for postgrest auth
- nvm - to easily swap node/npm versions. tested with node v13.11.0.
npx degit https://github.com/guyromm/svelte-postgrest-template svelte-postgrest-app
nvm use ; ./npm-init.sh
use envs/local.tpl to create an envs/local .env shell file, and then expand/eval it using ./setenv.sh
function freeport() {
FROM=$1
TO=$2
HOWMANY=$3
comm -23 \
<(seq "$FROM" "$TO" | sort) \
<(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) \
| shuf | head -n "$HOWMANY"
}
export APPNAME=$(basename $(pwd))
export DBNAME=$APPNAME
export APPPORT=$(freeport 3000 4000 1)
export POSTGRESTPORT=$[APPPORT+1]
export SERVERPORT=$[APPPORT+2]
export JWTSECRET=$(head /dev/urandom | tr -dc A-F0-9 | head -c 64 ; echo '')
cp envs/local.tpl envs/local
sed -i -E "s/APPPORTREPLACE/$APPPORT/g" envs/local
sed -i -E "s/SERVERPORTREPLACE/$SERVERPORT/g" envs/local
sed -i -E "s/POSTGRESTPORTREPLACE/$POSTGRESTPORT/g" envs/local
sed -i -E "s/DBNAMEREPLACE/$DBNAME/g" envs/local
sed -i -E "s/JWTSECRETREPLACE/$JWTSECRET/g" envs/local
./setenv.sh local
source .env
echo 'DBNAME:'$DBNAME
./db_init.sh
./tmux.sh