Repository to hold Sentency server code. The server is be done using Ktor, a simple web framework for Kotlin.
Ktor come with built-in libraries but it's mostly a "plug what you need" type of framework, because of that we had to add some third party libraries to fill some gaps:
- Ktor: Ktor is an asynchronous framework for creating microservices, web applications, and more.
- Exposed: an ORM framework for Kotlin created by JetBrains
- KMongo: a Kotlin toolkit for Mongo
- Koin: a smart Kotlin injection library to keep you focused on your app, not on your tools
The project is configured to be deployed using docker. First step is to create the distribution of the application (in this case using Gradle):
./gradlew installDist
To build the docker image go to the root of the project and run the command:
docker build -t sentency-server .
After the image is build to run locally you can execute:
docker run -p 7000:7000 sentency-server:latest
The project load environment variables to fill some important parameters on the server. They can be defined when running the docker image, on the docker-compose or in the environment itself.
- FLAVOR: If it is production or development. Production flavor will try to use Postgre
- API_KEY: Value that will be used to wrap all calls.
- DB_NAME: When in production the name of the database
- DB_USERNAME: When in production the username of the user that connects to database
- DB_PASSWORD: When in production the password to connect to database
- JWT_SECRET: Secret used to generate JWT tokens
- JWT_ISSUER: Issuer of the JWT tokens
- MONGO_HOST: Host address of Mongo Database
- RECAPTCHA_SECRET: ReCaptcha secret key to validate ReCaptcha V3 tokens
- GCP_API_KEY: Key used to enable translation suggestions for quotes
To generate test coverage report Jacoco was configured as an extension of the test task. Execute the command:
./gradlew test
to execute tests and generate code coverage reports.