Back-end code repository for the Saving Satoshi platform. You can find our front-end code repository here.
TBD
This guide will help you set up this project for local development.
Ensure you have the following installed on your machine:
- Node.js
- yarn
- PostgreSQL (optional, can be provisioned via docker)
- Docker
Before setting up the project, you should have the base image for the REPL which includes all the dependencies for each programming language.
cd src/base_images
- choose any of the language you want to build for, for example,
to build base image for
c++
, cd intocpp
in the base_images directory and run the following command
docker build -t cpp-base .
To build base image for javascript, cd into javascript in the base_images directory and run the following command
docker build -t js-base .
To build base image for python, cd into python in the base_images directory and run the following command
docker build -t py-base .
- Clone the code from this repository.
- Copy the
.env.example
file to.env
. - Build the project by running
yarn build
- Run
make init
to setup the database, run migration, copy necessary files and run the project for the first time. - Run
make run
to start the server. - To stop the server, run
ctlr C
, then runmake stop-deps
to stop the database.
- Run
make start-deps
to start the database. - Run
make run
to start the project. - You can now access the project at
http://localhost:8000
.
You can access the database using the DATABASE_URL
credentials in the .env
file for local development. You can use any DB client of your choice.
After pushing lesson content to master a chapter will remain disabled until a new feature flag is pushed. To unlock a new chapter you must push a feature flag request to the api with the chapter number specified. Here is the necessary scaffold to unlock the next chapter.
curl --location --request PUT '${backend.api}/v1/features/' \
--header 'Origin: http://localhost:3000/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer ${token}' \
--data '{
"feature_name": "chapter_#_enabled",
"feature_value": 1
}'
You can find our Postman workspace here.
TBD