MongoDB sample for Ktor Server
October 23, 2025 ยท View on GitHub
An application for creating, editing and deleting articles that uses MongoDB as a storage.
Running the Application
Execute this command to run the sample:
./gradlew run
Then, you can open http://localhost:8080/ in a browser to create, edit, and delete articles.
By default, the application connects to a MongoDB instance running on localhost:27017. You can start one using the provided docker-compose.yaml:
docker-compose up
Running Tests
Tests use Testcontainers to automatically start a MongoDB container, so you don't need to manually set up any infrastructure:
./gradlew test
The MongoDB container will be automatically started before tests run and stopped afterwards.