Skip to content

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.

License

Notifications You must be signed in to change notification settings

iammohdzaki/Starter-Project-Ktor

Repository files navigation

Starter Project Ktor

Kotlin Code Scanning kotlin_lint License

Overview

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.

Features

  • 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.

Getting Started

Prerequisites

Installation

  1. Clone the repository:

    git clone https://github.com/iammohdzaki/Starter-Project-Ktor.git
    cd Starter-Project-Ktor
  2. Build the project:

    ./gradlew build
  3. Run the application:

    ./gradlew run

Configuration

The application can be configured using the application.conf file located in the resources directory.

MongoDB Configuration

Ensure MongoDB is running locally or update the connection string in application.conf:

mongodb {
    connectionString = "mongodb://localhost:27017"
    database = "ktor_database"
}

API Documentation

Swagger is used for API documentation. Once the application is running, you can access the Swagger UI at http://localhost:8080/docs.

Project Structure

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

Contributing

Contributions are welcome! Please fork this repository and submit pull requests.

  1. Fork it (https://github.com/iammohdzaki/Starter-Project-Ktor/fork)
  2. Create your feature branch (git checkout -b feature/my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin feature/my-new-feature)
  5. Create a new Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

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.

Resources

License

Stars

Watchers

Forks

Languages