Luftschloss is a simple, lightweight and dependency-free webserver in Node.js.
# (If you don't have yarn installed install it with `npm install -g yarn`)
# Install dependencies used for building the project
yarn install
# Build all projects and apps
npx nx run-many -t build --all
All packages are located in the packages folder. The apps folder contains all applications that are built on top of
the packages and can be viewed as a showcase of the packages.
@luftschloss/client: A http client for Node.js@luftschloss/common: The core package containing common functionality used by most other packages.@luftschloss/mocking: Automatically mock your api calls.@luftschloss/openapi: An openapi extension for the@luftschloss/serverpackage. Just write your code and the openapi spec will be generated automatically.@luftschloss/openapi-schema: The schema generation logic for the@luftschloss/openapipackage.@luftschloss/proxy: A proxy server for the@luftschloss/serverpackage built on top of the@luftschloss/clientpackage.@luftschloss/server: The luftschloss http server@luftschloss/static: Static file extensions for the@luftschloss/serverpackage.@luftschloss/testing: Testing utilities for the@luftschloss/serverpackage. Use this to test your server without ever having to start it.@luftschloss/validation: A custom validation library which can be used on the client and server side. It is used by the@luftschloss/openapipackage.
⚠️
- make sure that you have set Thunder-client: Save To Workspace to
truein your vscode settings- make sure that you disable Thunder-client: Follow Redirect in the thunderclient settings
- make sure you delete the
shortener.dbfile and theusers.dbfile before starting the application to make sure
that the database is empty
The application in apps/url-shortener is a simple url shortener application. It uses the @luftschloss/openapi
package in combination with the @luftschloss/server to automatically generate an openapi spec.
The @luftschloss/client package is used to verify that the urls which should be shortened actually exist and return a
successful status code.
Be aware of the fact that without a JWT you will not be able to shorten urls. Obtain an JWT by making a request to the authentication service. The authentication service has to be running for the url-shortener to work.
# Start the application
npx nx serve url-shortener
# Open the openapi spec (choose one of the following)
open http://127.0.0.1:3200/docs/swagger
open http://127.0.0.1:3200/docs/stoplight
open http://127.0.0.1:3200/docs/redocThe application in apps/authentication is a simple authentication application. It uses the @luftschloss/openapi and
@luftschloss/server packages to automatically generate an openapi spec.
# Start the application
npx nx serve authentication
# Open the openapi spec (choose one of the following)
open http://127.0.0.1:3300/docs/swagger
open http://127.0.0.1:3300/docs/stoplight
open http://127.0.0.1:3300/docs/redoc
# Open vs-code and open the thunderclient extension
# 1. Run the *authentication* collection before the *url-redirect* collection
code apps/authentication
# Build the docker images
nx container url-shortener
nx container authentication# Tag the docker images
docker tag luftschloss/url-shortener:main andfaxle/url-shortener:latest
docker tag luftschloss/authentication:main andfaxle/authentication:latest# Push the docker images to docker hub to repo andfaxle/wscbs
docker push andfaxle/url-shortener:latest
docker push andfaxle/authentication:latest# Start the docker images
docker run -p 3200:3200 luftschloss/url-shortener:main
docker run -p 3300:3300 luftschloss/authentication:main
# Add a new docker build target to an application
nx g @nx-tools/nx-container:init <app-name>