Backend Server
Go to file
Nicolai Ort 95320ca1bc
continuous-integration/drone/pr Build is failing Details
continuous-integration/drone/push Build is passing Details
🚀Bumped version to v0.11.1
2021-04-22 19:57:31 +02:00
.vscode 🐞 VSCode formatting broke code by removing all unused 2020-12-04 17:05:13 +01:00
scripts Added testing env check 2021-03-06 13:41:10 +01:00
src Added fix for the appended 2 2021-04-22 19:52:32 +02:00
.dockerignore Added sqlite testing db to ignores 2020-11-25 18:32:01 +01:00
.drone.yml added new ci secret 2021-04-07 18:13:00 +02:00
.env.ci Set country code for the ci env to DE 2021-01-19 15:49:35 +01:00
.env.example Added sqlite as to env.sample db of choice [skip ci] 2021-01-21 15:27:11 +01:00
.gitignore Added tmp files to gitignore 2021-01-07 19:19:21 +01:00
CHANGELOG.md 🧾New changelog file version [CI SKIP] [skip ci] 2021-04-22 17:53:09 +00:00
Dockerfile Revert "Switched normal images to chached registry" 2021-03-12 20:20:46 +01:00
LICENSE Initial commit 2020-11-24 16:51:18 +00:00
README.md Added readme description for testing env 2021-03-06 13:42:10 +01:00
docker-compose.yml Updated default docker-compose 2021-04-07 16:10:22 +02:00
jest.config.js basic jest + typescript support 2020-12-05 18:49:09 +01:00
licenses.md 📖New license file version [CI SKIP] [skip ci] 2021-04-14 16:58:11 +00:00
ormconfig.js basic build works 2020-12-12 12:29:14 +01:00
package.json 🚀Bumped version to v0.11.1 2021-04-22 19:57:31 +02:00
tsconfig.json basic build works 2020-12-12 12:29:14 +01:00

README.md

@lfk/backend

Backend Server

Quickstart 🐳

Use this to run the backend with a postgresql db in docker

  1. Clone the repo or copy the docker-compose
  2. Run in toe folder that contains the docker-compose file: docker-compose up -d
  3. Visit http://127.0.0.1:4010/api/docs to check if the server is running
  4. You can now use the default admin user (demo:demo)

Dev Setup 🛠

Local dev setup utilizing sqlite3 as the database.

  1. Rename the .env.example file to .env (you can adjust app port and other settings, if needed)
  2. Install Dependencies
    yarn
    
  3. Start the server
    yarn dev
    

Run Tests

# Run tests once (server has to run)
yarn test

# Run test in watch mode (reruns on change)
yarn test:watch

# Run test in ci mode (automaticly starts the dev server)
yarn test:ci

Use your own mail templates

You use your own mail templates by replacing the default ones we provided (either in-code or by mounting them into the /app/static/mail_templates folder).

The mail templates always come in a .html and a .txt variant to provide compatability with legacy mail clients. Currently the following templates exist:

  • pw-reset.(html/txt)

Generate Docs

yarn docs

ENV Vars

You can provide them via .env file or docker env vars. You can use the test:ci:generate_env package script to generate a example env (uses bs data as test server and ignores the errors).

Name Type Default Description
APP_PORT Number 4010 The port the backend server listens on. Is optional.
DB_TYPE String N/A The type of the db u want to use. It has to be supported by typeorm. Possible: sqlite, mysql, postgresql
DB_HOST String N/A The db's host's ip-address/fqdn or file path for sqlite
DB_PORT String N/A The db's port
DB_USER String N/A The user for accessing the db
DB_PASSWORD String N/A The user's password for accessing the db
DB_NAME String N/A The db's name
NODE_ENV String dev The apps env - influences debug info. Also when the env is set to "test", mailing errors get ignored.
POSTALCODE_COUNTRYCODE String/CountryCode N/A The countrycode used to validate address's postal codes
PHONE_COUNTRYCODE String/CountryCode null (international) The countrycode used to validate phone numers
SEED_TEST_DATA Boolean False If you want the app to seed some example data set this to true
MAILER_URL String(Url) N/A The mailer's base url (no trailing slash)
MAILER_KEY String N/A The mailer's api key.
IMPRINT_URL String(Url) /imprint The link to a imprint page for the system (Defaults to the frontend's imprint)
PRIVACY_URL String(Url) /privacy The link to a privacy page for the system (Defaults to the frontend's privacy page)

Visual Studio Code

  • will be automatically recommended via ./vscode/extensions.json

Staging

Branches & Tags

  • vX.Y.Z: Release tags created from the main branch
    • The version numbers follow the semver standard
    • A new release tag automaticly triggers the release ci pipeline
  • main: Protected "release" branch
    • The latest tag of the docker image get's build from this
    • New releases get created as tags from this
  • dev: Current dev branch for merging the different feature branches and bugfixes
    • The dev tag of the docker image get's build from this
    • Only push minor changes to this branch!
    • To merge a feature branch into this please create a pull request
  • feature/xyz: Feature branches - nameing scheme: feature/issueid-title
  • bugfix/xyz: Branches for bugfixes - nameing scheme:bugfix/issueid-title