you can find the live version of Small World at: https://smallworld.kiwi
lein install
- install postgres: https://postgresapp.com (database)
- run
bin/setup
to create a local postgres db calledsmallworld-local
-
run
bin/start-dev.sh
- sets the environment variables
- starts the server: http://localhost:3001
- starts the frontend hot-reloading*
- starts the repl
-
connect Calva repl in VSCode to the repl running in the terminal (optional – the previous step starts a repl in your terminal, so this step is just for people who prefer to use the Calva repl instead of the terminal repl)
- command in VSCode:
Calva: Connect to a running REPL server in the project
- how to reload your code into the repl:
Calva: Load Current File and Dependencies
- how to reload the backend code in the running server:
(restart-server)
- command in VSCode:
* if you want to start just the frontend hot-reloading, without the server:
lein figwheel
. you probably won't use this often, aslein repl
starts the frontend hot-reloading as well as the server.
you have two options:
- reload the entire file into the repl
- command in VSCode:
Calva: load current file and dependencies
- pros: simpler because it just reloads everything that file needs, so you don't need to worry about it
- cons: slower
- command in VSCode:
- evaluate just the form that you want to update in the code
- e.g. you can evaluate just the `(defroutes app ...) form if you updated code within
- pros: faster
- cons: more likely that you forget to evaluate a dependency that's needed and the whole thing doesn't actually update as you expect
bin/make-and-deploy.sh
here are the steps that script follows, broken down into separate subscripts:
-
build a production version
bin/make-jar.sh
-
optional: run the jar locally to make sure it works, and open it at http://localhost:8080
bin/run-jar.sh
-
deploy the jar to heroku
bin/deploy
-
view heroku logs to check if deployment succeeded
bin/heroku-logs.sh
![]() |
![]() |
![]() |
---|---|---|
- the server sends emails via SendGrid. view/edit the templates here: https://mc.sendgrid.com/dynamic-templates
-
open Heroku Postgres instance in terminal:
heroku pg:psql postgresql-rigid-43177 --app small-world-friends
-
open local Postgres instance in terminal:
/Applications/Postgres.app/Contents/Versions/14/bin/psql -p5432 "devonzuegel"
-
view all tables:
select table_name from information_schema.tables where table_schema = 'public';
-
make a user go through welcome flow again:
update settings set welcome_flow_complete = false where screen_name = 'devon_dos';
-
get column names of a table:
select column_name, data_type from information_schema.columns where table_name = 'friends';
-
reset a user: (BE CAREFUL, THIS IS VERY DESTRUCTIVE!)
delete from twitter_profiles where request_key = 'devon_dos'; delete from friends where request_key = 'devon_dos'; delete from settings where screen_name = 'devon_dos'; delete from access_tokens where request_key = 'devon_dos';
-
add a column:
ALTER TABLE "settings" ADD COLUMN locations jsonb;
- run command line inside of Heroku:
heroku ps:exec --app=small-world-friends
- view environment variables for process with pid 4:
cat /proc/4/environ | tr '\0' '\n'
- run prod jar locally:
lein uberjar # builds the jar java -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8 -jar target/smallworld.jar -m smallworld.web