This is a starter project for building server-side applications using Ktor, a framework for building asynchronous servers and clients in connected systems. This template integrates MongoDB for database operations, Koin for dependency injection, and Swagger for API documentation. Serialization is handled using Kotlin Serialization.
- Kotlin 2.0: Leverage the latest features of Kotlin.
- Ktor: Asynchronous framework for building microservices and web applications.
- MongoDB: NoSQL database integration.
- Koin: Dependency injection framework.
- Swagger: Auto-generated API documentation.
- Kotlin Serialization: Serialize and deserialize Kotlin objects.
-
Clone the repository:
git clone https://github.com/iammohdzaki/Starter-Project-Ktor.git cd Starter-Project-Ktor
-
Build the project:
./gradlew build
-
Run the application:
./gradlew run
The application can be configured using the application.conf
file located in the resources
directory.
Ensure MongoDB is running locally or update the connection string in application.conf
:
mongodb {
connectionString = "mongodb://localhost:27017"
database = "ktor_database"
}
Swagger is used for API documentation. Once the application is running, you can access the Swagger UI at http://localhost:8080/docs
.
Starter-Project-Ktor
├── build.gradle.kts
├── gradle
│ └── wrapper
├── gradlew
├── gradlew.bat
├── settings.gradle.kts
└── src
├── main
│ ├── kotlin
│ │ ├── di
│ │ ├── models
│ │ ├── routes
│ │ │ └── services
│ ├── resources
│ │ ├── languages
│ │ │ ├── lang_ar.json
│ │ │ └── lang_en.json
│ │ ├── openapi
│ │ │ └── documentation.yml
│ │ ├── application.conf
│ │ └── logback.xml
└── test
└── kotlin
Contributions are welcome! Please fork this repository and submit pull requests.
- Fork it (https://github.com/iammohdzaki/Starter-Project-Ktor/fork)
- Create your feature branch (
git checkout -b feature/my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin feature/my-new-feature
) - Create a new Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.